[all-commits] [llvm/llvm-project] 1eeeab: [lldb][test] Modernize assertEqual(value, bool) (#...

Jordan Rupprecht via All-commits all-commits at lists.llvm.org
Wed Feb 21 18:39:14 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1eeeab82c6eb185f5139e633a59c2dbcb15616e4
      https://github.com/llvm/llvm-project/commit/1eeeab82c6eb185f5139e633a59c2dbcb15616e4
  Author: Jordan Rupprecht <rupprecht at google.com>
  Date:   2024-02-21 (Wed, 21 Feb 2024)

  Changed paths:
    M lldb/test/API/commands/expression/call-throws/TestCallThatThrows.py
    M lldb/test/API/commands/expression/dont_allow_jit/TestAllowJIT.py
    M lldb/test/API/commands/statistics/basic/TestStats.py
    M lldb/test/API/commands/trace/TestTraceSave.py
    M lldb/test/API/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
    M lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
    M lldb/test/API/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
    M lldb/test/API/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
    M lldb/test/API/functionalities/module_cache/simple_exe/TestModuleCacheSimple.py
    M lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py
    M lldb/test/API/functionalities/thread/backtrace_limit/TestBacktraceLimit.py
    M lldb/test/API/macosx/arm-corefile-regctx/TestArmMachoCorefileRegctx.py
    M lldb/test/API/macosx/lc-note/addrable-bits/TestAddrableBitsCorefile.py
    M lldb/test/API/macosx/lc-note/firmware-corefile/TestFirmwareCorefiles.py
    M lldb/test/API/macosx/lc-note/kern-ver-str/TestKernVerStrLCNOTE.py
    M lldb/test/API/macosx/lc-note/multiple-binary-corefile/TestMultipleBinaryCorefile.py
    M lldb/test/API/macosx/queues/TestQueues.py
    M lldb/test/API/macosx/safe-to-func-call/TestSafeFuncCalls.py
    M lldb/test/API/python_api/interpreter/TestRunCommandInterpreterAPI.py

  Log Message:
  -----------
  [lldb][test] Modernize assertEqual(value, bool) (#82526)

Any time we see the pattern `assertEqual(value, bool)`, we can replace
that with `assert<bool>(value)`. Likewise for `assertNotEqual`.

Technically this relaxes the test a bit, as we may want to make sure
`value` is either `True` or `False`, and not something that implicitly
converts to a bool. For example, `assertEqual("foo", True)` will fail,
but `assertTrue("foo")` will not. In most cases, this distinction is not
important.

There are two such places that this patch does **not** transform, since
it seems intentional that we want the result to be a bool:
*
https://github.com/llvm/llvm-project/blob/5daf2001a1e4d71ce1273a1e7e31cf6e6ac37c10/lldb/test/API/python_api/sbstructureddata/TestStructuredDataAPI.py#L90
*
https://github.com/llvm/llvm-project/blob/5daf2001a1e4d71ce1273a1e7e31cf6e6ac37c10/lldb/test/API/commands/settings/TestSettings.py#L940

Followup to 9c2468821ec51defd09c246fea4a47886fff8c01. I patched `teyit`
with a `visit_assertEqual` node handler to generate this.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list