[llvm] [NFC][ADT] Introduce a test harness for StringRefTest (PR #105500)

Rahul Joshi via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 04:51:36 PDT 2024


================
@@ -16,20 +16,7 @@
 #include "gtest/gtest.h"
 using namespace llvm;
 
-namespace llvm {
-
-std::ostream &operator<<(std::ostream &OS, const StringRef &S) {
----------------
jurahul wrote:

Hmm, I can see that even without these, the StringRef and the pair gets printed properly:

```
[ RUN      ] StringRefTest.Construction
/home/rjoshi/upstream_llvm/llvm-project/llvm/unittests/ADT/StringRefTest.cpp:41: Failure
Expected equality of these values:
  ""
    Which is: 0x55db55e939d4
  StringRef("a")
    Which is: "a"
```

and

```
/home/rjoshi/upstream_llvm/llvm-project/llvm/unittests/ADT/StringRefTest.cpp:166: Failure
Expected equality of these values:
  std::make_pair(StringRef("he"), StringRef("lo"))
    Which is: ("he", "lo")
  Str.split('y')
    Which is: ("hello", "")
```

https://github.com/llvm/llvm-project/pull/105500


More information about the llvm-commits mailing list