[all-commits] [llvm/llvm-project] 38ac40: [NFCI][Support] Avoid ASSERT_/EXPECT_TRUE(A <op> B)

Sam Elliott via All-commits all-commits at lists.llvm.org
Fri Jan 21 05:15:51 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 38ac4093d9d2ae28d631ca1cc5802533989165c5
      https://github.com/llvm/llvm-project/commit/38ac4093d9d2ae28d631ca1cc5802533989165c5
  Author: Archibald Elliott <archibald.elliott at arm.com>
  Date:   2022-01-21 (Fri, 21 Jan 2022)

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

  Log Message:
  -----------
  [NFCI][Support] Avoid ASSERT_/EXPECT_TRUE(A <op> B)

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).

Reviewed By: mubashar_

Differential Revision: https://reviews.llvm.org/D117319




More information about the All-commits mailing list