From 4d778e630a1902e59e2c0f92674d7f9bda026cf6 Mon Sep 17 00:00:00 2001 From: Noam Preil Date: Sun, 9 Aug 2020 17:53:56 -0400 Subject: [PATCH] Tests: print generated C on test failure --- src-self-hosted/test.zig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src-self-hosted/test.zig b/src-self-hosted/test.zig index 7d4cc7d563..265c26b2dc 100644 --- a/src-self-hosted/test.zig +++ b/src-self-hosted/test.zig @@ -478,6 +478,10 @@ pub const TestContext = struct { for (all_errors.list) |err| { std.debug.warn(":{}:{}: error: {}\n================\n", .{ err.line + 1, err.column + 1, err.msg }); } + if (case.cbe) { + const C = module.bin_file.cast(link.File.C).?; + std.debug.warn("Generated C: \n===============\n{}\n\n===========\n\n", .{C.main.items}); + } std.debug.warn("Test failed.\n", .{}); std.process.exit(1); }