[spirv-reader][ir] Emit both sides of test error.
When emitting a failed `EXPECT_IR` emit both the expected and actual
strings.
Change-Id: I7aa5128db1032262bbe5ce3f2d5c6d01f3780e6c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/241094
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: dan sinclair <dsinclair@chromium.org>
diff --git a/src/tint/lang/spirv/reader/helper_test.h b/src/tint/lang/spirv/reader/helper_test.h
index 9437e42..a627874 100644
--- a/src/tint/lang/spirv/reader/helper_test.h
+++ b/src/tint/lang/spirv/reader/helper_test.h
@@ -42,12 +42,12 @@
// Helper macro to run the parser and compare the disassembled IR to a string.
// Automatically prefixes the IR disassembly with a newline to improve formatting of tests.
-#define EXPECT_IR(asm, ir) \
- do { \
- auto result = Run(asm); \
- ASSERT_EQ(result, Success) << result.Failure(); \
- auto got = "\n" + result.Get(); \
- ASSERT_THAT(got, testing::HasSubstr(ir)) << got; \
+#define EXPECT_IR(asm, ir) \
+ do { \
+ auto result = Run(asm); \
+ ASSERT_EQ(result, Success) << result.Failure(); \
+ auto got = "\n" + result.Get(); \
+ ASSERT_THAT(got, testing::HasSubstr(ir)) << "GOT:\n" << got << "EXPECTED:\n" << ir; \
} while (false)
/// Base helper class for testing the SPIR-V parser implementation.