authorgravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-04-28 12:11:49+02:00
committergravatar for kubkon@jakubkonka.comJakub Konka <kubkon@jakubkonka.com> 2022-04-28 18:35:01+02:00
logc8d0fb0b212f2c618321caeeac315c1792b06035
tree20acc69efe574781e49a79566b9a081763449299
parent3c19f694d92c5a3d7f6e3a6d857252406df0d6e3

test: migrate stage2 independent compile errors to test manifest parser


14 files changed, 18 insertions(+), 18 deletions(-)

src/test.zig+3-3
...@@ -42,12 +42,12 @@ test {...@@ -42,12 +42,12 @@ test {
42 defer compile_errors_dir.close();42 defer compile_errors_dir.close();
4343
44 {44 {
45 var stage2_dir = try compile_errors_dir.openDir("stage2", .{ .iterate = true });45 var dir = try compile_errors_dir.openDir("stage2", .{ .iterate = true });
46 defer stage2_dir.close();46 defer dir.close();
4747
48 // TODO make this incremental once the bug is solved that it triggers48 // TODO make this incremental once the bug is solved that it triggers
49 // See: https://github.com/ziglang/zig/issues/1134449 // See: https://github.com/ziglang/zig/issues/11344
50 ctx.addErrorCasesFromDir("stage2", stage2_dir, .stage2, .Obj, false, .independent);50 ctx.addTestCasesFromDir(dir, .independent);
51 }51 }
5252
53 if (!skip_stage1) {53 if (!skip_stage1) {
test/compile_errors/stage2/constant_inside_comptime_function_has_compile_error.zig+1-1
...@@ -14,7 +14,7 @@ export fn entry() void {...@@ -14,7 +14,7 @@ export fn entry() void {
14 _ = allocator;14 _ = allocator;
15}15}
1616
17// constant inside comptime function has compile error17// error
18//18//
19// :4:5: error: unreachable code19// :4:5: error: unreachable code
20// :4:25: note: control flow is diverted here20// :4:25: note: control flow is diverted here
test/compile_errors/stage2/duplicate-unused_labels.zig+1-1
...@@ -17,7 +17,7 @@ comptime {...@@ -17,7 +17,7 @@ comptime {
17 blk: for(@as([0]void, undefined)) |_| {}17 blk: for(@as([0]void, undefined)) |_| {}
18}18}
1919
20// duplicate/unused labels20// error
21//21//
22// :2:12: error: redefinition of label 'blk'22// :2:12: error: redefinition of label 'blk'
23// :2:5: note: previous definition here23// :2:5: note: previous definition here
test/compile_errors/stage2/embed_outside_package.zig+1-1
...@@ -2,6 +2,6 @@ export fn a() usize {...@@ -2,6 +2,6 @@ export fn a() usize {
2 return @embedFile("/root/foo").len;2 return @embedFile("/root/foo").len;
3}3}
44
5// embed outside package5// error
6//6//
7//:2:23: error: embed of file outside package path: '/root/foo'7//:2:23: error: embed of file outside package path: '/root/foo'
test/compile_errors/stage2/import_outside_package.zig+1-1
...@@ -2,6 +2,6 @@ export fn a() usize {...@@ -2,6 +2,6 @@ export fn a() usize {
2 return @import("../../above.zig").len;2 return @import("../../above.zig").len;
3}3}
44
5// import outside package5// error
6//6//
7// :2:20: error: import of file outside package path: '../../above.zig'7// :2:20: error: import of file outside package path: '../../above.zig'
test/compile_errors/stage2/out_of_bounds_index.zig+1-1
...@@ -20,7 +20,7 @@ comptime {...@@ -20,7 +20,7 @@ comptime {
20 _ = slice;20 _ = slice;
21}21}
2222
23// out of bounds indexing23// error
24//24//
25// :4:26: error: end index 6 out of bounds for slice of length 4 +1 (sentinel)25// :4:26: error: end index 6 out of bounds for slice of length 4 +1 (sentinel)
26// :9:22: error: end index 6 out of bounds for array of length 4 +1 (sentinel)26// :9:22: error: end index 6 out of bounds for array of length 4 +1 (sentinel)
test/compile_errors/stage2/slice_of_null_pointer.zig+1-1
...@@ -5,6 +5,6 @@ comptime {...@@ -5,6 +5,6 @@ comptime {
5 _ = y;5 _ = y;
6}6}
77
8// slice of null C pointer8// error
9//9//
10// :4:14: error: slice of null pointer10// :4:14: error: slice of null pointer
test/compile_errors/stage2/struct_duplicate_field_name.zig+1-1
...@@ -8,7 +8,7 @@ export fn entry() void {...@@ -8,7 +8,7 @@ export fn entry() void {
8 _ = s;8 _ = s;
9}9}
1010
11// duplicate struct field name11// error
12//12//
13// :3:5: error: duplicate struct field: 'foo'13// :3:5: error: duplicate struct field: 'foo'
14// :2:5: note: other field here14// :2:5: note: other field here
test/compile_errors/stage2/union_access_of_inactive_field.zig+2-2
...@@ -3,12 +3,12 @@ const U = union {...@@ -3,12 +3,12 @@ const U = union {
3 b: u64,3 b: u64,
4};4};
5comptime {5comptime {
6 var u: U = .{.a = {}};6 var u: U = .{ .a = {} };
7 const v = u.b;7 const v = u.b;
8 _ = v;8 _ = v;
9}9}
1010
11// access of inactive union field11// error
12//12//
13// :7:16: error: access of union field 'b' while field 'a' is active13// :7:16: error: access of union field 'b' while field 'a' is active
14// :1:11: note: union declared here14// :1:11: note: union declared here
test/compile_errors/stage2/union_duplicate_enum_field.zig+2-2
...@@ -1,4 +1,4 @@...@@ -1,4 +1,4 @@
1const E = enum {a, b};1const E = enum { a, b };
2const U = union(E) {2const U = union(E) {
3 a: u32,3 a: u32,
4 a: u32,4 a: u32,
...@@ -9,7 +9,7 @@ export fn foo() void {...@@ -9,7 +9,7 @@ export fn foo() void {
9 _ = u;9 _ = u;
10}10}
1111
12// union with enum and duplicate fields12// error
13//13//
14// :4:5: error: duplicate union field: 'a'14// :4:5: error: duplicate union field: 'a'
15// :3:5: note: other field here15// :3:5: note: other field here
test/compile_errors/stage2/union_duplicate_field_definition.zig+1-1
...@@ -8,7 +8,7 @@ export fn entry() void {...@@ -8,7 +8,7 @@ export fn entry() void {
8 _ = u;8 _ = u;
9}9}
1010
11// duplicate union field name11// error
12//12//
13// :3:5: error: duplicate union field: 'foo'13// :3:5: error: duplicate union field: 'foo'
14// :2:5: note: other field here14// :2:5: note: other field here
test/compile_errors/stage2/union_enum_field_missing.zig+1-1
...@@ -13,7 +13,7 @@ export fn entry() usize {...@@ -13,7 +13,7 @@ export fn entry() usize {
13 return @sizeOf(U);13 return @sizeOf(U);
14}14}
1515
16// enum field missing in union16// error
17//17//
18// :7:1: error: enum field(s) missing in union18// :7:1: error: enum field(s) missing in union
19// :4:5: note: field 'c' missing, declared here19// :4:5: note: field 'c' missing, declared here
test/compile_errors/stage2/union_extra_field.zig+1-1
...@@ -13,7 +13,7 @@ export fn entry() usize {...@@ -13,7 +13,7 @@ export fn entry() usize {
13 return @sizeOf(U);13 return @sizeOf(U);
14}14}
1515
16// union extra field16// error
17//17//
18// :6:1: error: enum 'tmp.E' has no field named 'd'18// :6:1: error: enum 'tmp.E' has no field named 'd'
19// :1:11: note: enum declared here19// :1:11: note: enum declared here
test/compile_errors/stage2/union_runtime_coercion_from_enum.zig+1-1
...@@ -14,7 +14,7 @@ export fn doTheTest() u64 {...@@ -14,7 +14,7 @@ export fn doTheTest() u64 {
14 return u.b;14 return u.b;
15}15}
1616
17// runtime coercion from enum to union17// error
18//18//
19// :13:19: error: runtime coercion from enum 'tmp.E' to union 'tmp.U' which has non-void fields19// :13:19: error: runtime coercion from enum 'tmp.E' to union 'tmp.U' which has non-void fields
20// :6:5: note: field 'a' has type 'u32'20// :6:5: note: field 'a' has type 'u32'