[all-commits] [llvm/llvm-project] fe8a16: [unittest] teach gTest to print entries of DenseMa...

Sam McCall via All-commits all-commits at lists.llvm.org
Wed Jun 28 02:30:12 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: fe8a168161a3b4c1bbd2d8d916c510cfe4711cbd
      https://github.com/llvm/llvm-project/commit/fe8a168161a3b4c1bbd2d8d916c510cfe4711cbd
  Author: Sam McCall <sam.mccall at gmail.com>
  Date:   2023-06-28 (Wed, 28 Jun 2023)

  Changed paths:
    M llvm/unittests/ADT/DenseMapTest.cpp
    M third-party/unittest/googletest/include/gtest/internal/custom/gtest-printers.h

  Log Message:
  -----------
  [unittest] teach gTest to print entries of DenseMap as pairs

When an assertion like the following fails:
   EXPECT_THAT(map, ElementsAre(Pair("p", "nullable"))));
Error message before:
   Actual: { 40-byte object <E8-A5 9C-7F 25-37 00-00 58-7E 51-51 D0-7F 00-00 00-00 00-00 00-00 00-00 01-00 00-00 00-00 00-00 00-DA C7-7F 25-37 00-00> }
After:
   Actual: { ("p", "nonnull") }

It is not ideal that we need to refer directly to DenseMapPair inside the
internal namespace, but I believe the practical maintenance risk is low.
This change is covered by DenseMap's unittests, as we've covered SmallString etc
in the past.

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




More information about the All-commits mailing list