[libc-commits] [libc] [libc][test] Align custom matchers with GoogleMock (PR #240616)

Alexey Samsonov via libc-commits libc-commits at lists.llvm.org
Mon Nov 9 23:12:16 PST 2026


================
@@ -31,11 +32,17 @@ TEST(LlvmLibcQueueTest, SList) {
   struct Contains : public testing::Matcher<Head> {
     string s;
     Contains(string s) : s(s) {}
-    bool match(Head head) {
+    // NOLINTNEXTLINE(readability-identifier-naming)
+    bool MatchAndExplain(Head head,
+                         testing::MatchResultListener *listener) const {
       Entry *e;
       CharVector v;
       SLIST_FOREACH(e, &head, entries) { v.append(e->c); }
-      return s == v.c_str();
+      if (s == v.c_str())
+        return true;
+      *listener << "actual elements: "
----------------
vonosmas wrote:

do you need to output what they expected contents as well (here and below)?

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


More information about the libc-commits mailing list