motiejus/zig

fork of https://codeberg.org/ziglang/zig
git clone https://git.jakstys.lt/motiejus/zig.git
Log | Tree | Refs | README | LICENSE

commit c8d0fb0b212f2c618321caeeac315c1792b06035 (tree)
parent 3c19f694d92c5a3d7f6e3a6d857252406df0d6e3
Author: Jakub Konka <kubkon@jakubkonka.com>
Date:   Thu, 28 Apr 2022 12:11:49 +0200

test: migrate stage2 independent compile errors to test manifest parser

Diffstat:
Msrc/test.zig | 6+++---
Mtest/compile_errors/stage2/constant_inside_comptime_function_has_compile_error.zig | 2+-
Mtest/compile_errors/stage2/duplicate-unused_labels.zig | 2+-
Mtest/compile_errors/stage2/embed_outside_package.zig | 2+-
Mtest/compile_errors/stage2/import_outside_package.zig | 2+-
Mtest/compile_errors/stage2/out_of_bounds_index.zig | 2+-
Mtest/compile_errors/stage2/slice_of_null_pointer.zig | 2+-
Mtest/compile_errors/stage2/struct_duplicate_field_name.zig | 2+-
Mtest/compile_errors/stage2/union_access_of_inactive_field.zig | 4++--
Mtest/compile_errors/stage2/union_duplicate_enum_field.zig | 4++--
Mtest/compile_errors/stage2/union_duplicate_field_definition.zig | 2+-
Mtest/compile_errors/stage2/union_enum_field_missing.zig | 2+-
Mtest/compile_errors/stage2/union_extra_field.zig | 2+-
Mtest/compile_errors/stage2/union_runtime_coercion_from_enum.zig | 2+-
14 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/test.zig b/src/test.zig @@ -42,12 +42,12 @@ test { defer compile_errors_dir.close(); { - var stage2_dir = try compile_errors_dir.openDir("stage2", .{ .iterate = true }); - defer stage2_dir.close(); + var dir = try compile_errors_dir.openDir("stage2", .{ .iterate = true }); + defer dir.close(); // TODO make this incremental once the bug is solved that it triggers // See: https://github.com/ziglang/zig/issues/11344 - ctx.addErrorCasesFromDir("stage2", stage2_dir, .stage2, .Obj, false, .independent); + ctx.addTestCasesFromDir(dir, .independent); } if (!skip_stage1) { diff --git a/test/compile_errors/stage2/constant_inside_comptime_function_has_compile_error.zig b/test/compile_errors/stage2/constant_inside_comptime_function_has_compile_error.zig @@ -14,7 +14,7 @@ export fn entry() void { _ = allocator; } -// constant inside comptime function has compile error +// error // // :4:5: error: unreachable code // :4:25: note: control flow is diverted here diff --git a/test/compile_errors/stage2/duplicate-unused_labels.zig b/test/compile_errors/stage2/duplicate-unused_labels.zig @@ -17,7 +17,7 @@ comptime { blk: for(@as([0]void, undefined)) |_| {} } -// duplicate/unused labels +// error // // :2:12: error: redefinition of label 'blk' // :2:5: note: previous definition here diff --git a/test/compile_errors/stage2/embed_outside_package.zig b/test/compile_errors/stage2/embed_outside_package.zig @@ -2,6 +2,6 @@ export fn a() usize { return @embedFile("/root/foo").len; } -// embed outside package +// error // //:2:23: error: embed of file outside package path: '/root/foo' diff --git a/test/compile_errors/stage2/import_outside_package.zig b/test/compile_errors/stage2/import_outside_package.zig @@ -2,6 +2,6 @@ export fn a() usize { return @import("../../above.zig").len; } -// import outside package +// error // // :2:20: error: import of file outside package path: '../../above.zig' diff --git a/test/compile_errors/stage2/out_of_bounds_index.zig b/test/compile_errors/stage2/out_of_bounds_index.zig @@ -20,7 +20,7 @@ comptime { _ = slice; } -// out of bounds indexing +// error // // :4:26: error: end index 6 out of bounds for slice of length 4 +1 (sentinel) // :9:22: error: end index 6 out of bounds for array of length 4 +1 (sentinel) diff --git a/test/compile_errors/stage2/slice_of_null_pointer.zig b/test/compile_errors/stage2/slice_of_null_pointer.zig @@ -5,6 +5,6 @@ comptime { _ = y; } -// slice of null C pointer +// error // // :4:14: error: slice of null pointer diff --git a/test/compile_errors/stage2/struct_duplicate_field_name.zig b/test/compile_errors/stage2/struct_duplicate_field_name.zig @@ -8,7 +8,7 @@ export fn entry() void { _ = s; } -// duplicate struct field name +// error // // :3:5: error: duplicate struct field: 'foo' // :2:5: note: other field here diff --git a/test/compile_errors/stage2/union_access_of_inactive_field.zig b/test/compile_errors/stage2/union_access_of_inactive_field.zig @@ -3,12 +3,12 @@ const U = union { b: u64, }; comptime { - var u: U = .{.a = {}}; + var u: U = .{ .a = {} }; const v = u.b; _ = v; } -// access of inactive union field +// error // // :7:16: error: access of union field 'b' while field 'a' is active // :1:11: note: union declared here diff --git a/test/compile_errors/stage2/union_duplicate_enum_field.zig b/test/compile_errors/stage2/union_duplicate_enum_field.zig @@ -1,4 +1,4 @@ -const E = enum {a, b}; +const E = enum { a, b }; const U = union(E) { a: u32, a: u32, @@ -9,7 +9,7 @@ export fn foo() void { _ = u; } -// union with enum and duplicate fields +// error // // :4:5: error: duplicate union field: 'a' // :3:5: note: other field here diff --git a/test/compile_errors/stage2/union_duplicate_field_definition.zig b/test/compile_errors/stage2/union_duplicate_field_definition.zig @@ -8,7 +8,7 @@ export fn entry() void { _ = u; } -// duplicate union field name +// error // // :3:5: error: duplicate union field: 'foo' // :2:5: note: other field here diff --git a/test/compile_errors/stage2/union_enum_field_missing.zig b/test/compile_errors/stage2/union_enum_field_missing.zig @@ -13,7 +13,7 @@ export fn entry() usize { return @sizeOf(U); } -// enum field missing in union +// error // // :7:1: error: enum field(s) missing in union // :4:5: note: field 'c' missing, declared here diff --git a/test/compile_errors/stage2/union_extra_field.zig b/test/compile_errors/stage2/union_extra_field.zig @@ -13,7 +13,7 @@ export fn entry() usize { return @sizeOf(U); } -// union extra field +// error // // :6:1: error: enum 'tmp.E' has no field named 'd' // :1:11: note: enum declared here diff --git a/test/compile_errors/stage2/union_runtime_coercion_from_enum.zig b/test/compile_errors/stage2/union_runtime_coercion_from_enum.zig @@ -14,7 +14,7 @@ export fn doTheTest() u64 { return u.b; } -// runtime coercion from enum to union +// error // // :13:19: error: runtime coercion from enum 'tmp.E' to union 'tmp.U' which has non-void fields // :6:5: note: field 'a' has type 'u32'