authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-14 18:02:33-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-03-15 10:48:15-07:00
log6664d2418d0348c6432a1c93c96b4412f80036a8
treecf713f610f947f596e71ea777978c69d7f5d286b
parent6d6f6a4ac6f1f2666fa2d4500ef4634fdfe0d947

test-cases: add missing compile log output

The new testing harness is not bound by previous limitations; it can now test compile log output as well.

7 files changed, 34 insertions(+), 1 deletions(-)

test/cases/compile_errors/compileLog_of_tagged_enum_doesnt_crash_the_compiler.zig+4
......@@ -15,3 +15,7 @@ pub export fn entry() void {
1515// target=native
1616//
1717// :6:5: error: found compile log statement
18//
19// Compile Log Output:
20// @as(tmp.Bar, .{ .X = 123 })
21// @as(tmp.Bar, [runtime value])
test/cases/compile_errors/compile_log.zig+9
......@@ -17,3 +17,12 @@ export fn baz() void {
1717//
1818// :5:5: error: found compile log statement
1919// :11:5: note: also here
20//
21// Compile Log Output:
22// @as(*const [5:0]u8, "begin")
23// @as(*const [1:0]u8, "a"), @as(i32, 12), @as(*const [1:0]u8, "b"), @as([]const u8, "hi")
24// @as(*const [3:0]u8, "end")
25// @as(comptime_int, 4)
26// @as(*const [5:0]u8, "begin")
27// @as(*const [1:0]u8, "a"), @as(i32, [runtime value]), @as(*const [1:0]u8, "b"), @as([]const u8, [runtime value])
28// @as(*const [3:0]u8, "end")
test/cases/compile_errors/compile_log_a_pointer_to_an_opaque_value.zig+4-1
......@@ -1,5 +1,5 @@
11export fn entry() void {
2 @compileLog(@ptrCast(*const anyopaque, &entry));
2 @compileLog(@ptrCast(*align(1) const anyopaque, &entry));
33}
44
55// error
......@@ -7,3 +7,6 @@ export fn entry() void {
77// target=native
88//
99// :2:5: error: found compile log statement
10//
11// Compile Log Output:
12// @as(*const anyopaque, (function 'entry'))
test/cases/compile_errors/compile_log_statement_inside_function_which_must_be_comptime_evaluated.zig+3
......@@ -12,3 +12,6 @@ export fn entry() void {
1212// target=native
1313//
1414// :2:5: error: found compile log statement
15//
16// Compile Log Output:
17// @as(*const [3:0]u8, "i32\x00")
test/cases/compile_errors/compile_log_statement_warning_deduplication_in_generic_fn.zig+5
......@@ -13,3 +13,8 @@ fn inner(comptime n: usize) void {
1313//
1414// :7:39: error: found compile log statement
1515// :7:39: note: also here
16//
17// Compile Log Output:
18// @as(*const [4:0]u8, "!@#$")
19// @as(*const [4:0]u8, "!@#$")
20// @as(*const [4:0]u8, "!@#$")
test/cases/compile_log.0.zig+5
......@@ -15,3 +15,8 @@ fn x() void {}
1515// error
1616//
1717// :6:23: error: expected type 'usize', found 'bool'
18//
19// Compile Log Output:
20// @as(bool, true), @as(comptime_int, 20), @as(u32, [runtime value]), @as(fn() void, (function 'x'))
21// @as(comptime_int, 1000)
22// @as(comptime_int, 1234)
test/cases/compile_log.1.zig+4
......@@ -14,3 +14,7 @@ fn x() void {}
1414//
1515// :9:5: error: found compile log statement
1616// :4:5: note: also here
17//
18// Compile Log Output:
19// @as(bool, true), @as(comptime_int, 20), @as(u32, [runtime value]), @as(fn() void, (function 'x'))
20// @as(comptime_int, 1000)