[PATCH] D117319: [NFCI][Support] Avoid ASSERT_/EXPECT_TRUE(A <op> B)

Sam Elliott via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 14 07:32:25 PST 2022


lenary created this revision.
lenary added reviewers: simon_tatham, michaelplatings, mubashar_.
Herald added a subscriber: arphaman.
lenary requested review of this revision.
Herald added a project: LLVM.

The error messages in tests are far better when a test fails if the test
is written using ASSERT_/EXPECT_<operator>(A, B) rather than
ASSERT_/EXPECT_TRUE(A <operator> B).

This commit updates all of llvm/unittests/Support to use these macros
where possible.

This change has not been possible in:

- llvm/unittests/Support/FSUniqueIDTest.cpp - due to not overloading operators beyond ==, != and <.
- llvm/unittests/Support/BranchProbabilityTest.cpp - where the unchanged tests are of the operator overloads themselves.

There are other possibilities of this conversion not being valid, which
have not applied in these tests, as they do not use NULL (they use
nullptr), and they do not use const char* (they use std::string or
StringRef).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117319

Files:
  llvm/unittests/Support/Casting.cpp
  llvm/unittests/Support/CommandLineTest.cpp
  llvm/unittests/Support/DynamicLibrary/DynamicLibraryTest.cpp
  llvm/unittests/Support/ErrorTest.cpp
  llvm/unittests/Support/FSUniqueIDTest.cpp
  llvm/unittests/Support/IndexedAccessorTest.cpp
  llvm/unittests/Support/JSONTest.cpp
  llvm/unittests/Support/MemoryBufferTest.cpp
  llvm/unittests/Support/Path.cpp
  llvm/unittests/Support/ProgramTest.cpp
  llvm/unittests/Support/TarWriterTest.cpp
  llvm/unittests/Support/TargetParserTest.cpp
  llvm/unittests/Support/TimerTest.cpp
  llvm/unittests/Support/UnicodeTest.cpp
  llvm/unittests/Support/VirtualFileSystemTest.cpp
  llvm/unittests/Support/YAMLIOTest.cpp
  llvm/unittests/Support/YAMLParserTest.cpp
  llvm/unittests/Support/raw_ostream_test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117319.399998.patch
Type: text/x-patch
Size: 44850 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220114/18e9ff45/attachment.bin>


More information about the llvm-commits mailing list