[ir][spirv-writer] Add helper macro for unit tests

Adds an `EXPECT_INST` macro that checks for an instruction in the
output, dumping the full output if not found. Indentation and comments
are enabled in the disassembly to make it easier to see the issue.

Bug: tint:1906
Change-Id: I297207769ad992b22524c0f62fcb732e8bdd1a0f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/139481
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
diff --git a/src/tint/writer/spirv/ir/test_helper_ir.h b/src/tint/writer/spirv/ir/test_helper_ir.h
index debe5d8..27559be 100644
--- a/src/tint/writer/spirv/ir/test_helper_ir.h
+++ b/src/tint/writer/spirv/ir/test_helper_ir.h
@@ -27,6 +27,10 @@
 
 namespace tint::writer::spirv {
 
+// Helper macro to check whether the SPIR-V output contains an instruction, dumping the full output
+// if the instruction was not present.
+#define EXPECT_INST(inst) ASSERT_THAT(output_, testing::HasSubstr(inst)) << output_
+
 /// The element type of a test.
 enum TestElementType {
     kBool,
@@ -83,7 +87,9 @@
             return false;
         }
 
-        output_ = Disassemble(generator_.Result(), SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES);
+        output_ = Disassemble(generator_.Result(), SPV_BINARY_TO_TEXT_OPTION_FRIENDLY_NAMES |
+                                                       SPV_BINARY_TO_TEXT_OPTION_INDENT |
+                                                       SPV_BINARY_TO_TEXT_OPTION_COMMENT);
         return true;
     }