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 {...@@ -15,3 +15,7 @@ pub export fn entry() void {
15// target=native15// target=native
16//16//
17// :6:5: error: found compile log statement17// :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 {...@@ -17,3 +17,12 @@ export fn baz() void {
17//17//
18// :5:5: error: found compile log statement18// :5:5: error: found compile log statement
19// :11:5: note: also here19// :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 @@...@@ -1,5 +1,5 @@
1export fn entry() void {1export fn entry() void {
2 @compileLog(@ptrCast(*const anyopaque, &entry));2 @compileLog(@ptrCast(*align(1) const anyopaque, &entry));
3}3}
44
5// error5// error
...@@ -7,3 +7,6 @@ export fn entry() void {...@@ -7,3 +7,6 @@ export fn entry() void {
7// target=native7// target=native
8//8//
9// :2:5: error: found compile log statement9// :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 {...@@ -12,3 +12,6 @@ export fn entry() void {
12// target=native12// target=native
13//13//
14// :2:5: error: found compile log statement14// :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 {...@@ -13,3 +13,8 @@ fn inner(comptime n: usize) void {
13//13//
14// :7:39: error: found compile log statement14// :7:39: error: found compile log statement
15// :7:39: note: also here15// :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 {}...@@ -15,3 +15,8 @@ fn x() void {}
15// error15// error
16//16//
17// :6:23: error: expected type 'usize', found 'bool'17// :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 {}...@@ -14,3 +14,7 @@ fn x() void {}
14//14//
15// :9:5: error: found compile log statement15// :9:5: error: found compile log statement
16// :4:5: note: also here16// :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)