diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-02-23 16:10:17 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-02-23 16:10:17 -0500 |
| commit | ecf56d85efa227acf1bd9cab9ad2d5af05f7efe5 (patch) | |
| tree | d83ccefd98555c33d492273cb20f86fe78965416 /test/behavior | |
| parent | 88d1258e08e668e620d5f8f4681315e555acbcd2 (diff) | |
| parent | ab4d693cfc82465c42021ba6f18c65fdd5f969e6 (diff) | |
| download | zig-ecf56d85efa227acf1bd9cab9ad2d5af05f7efe5.tar.gz zig-ecf56d85efa227acf1bd9cab9ad2d5af05f7efe5.zip | |
Merge pull request #10969 from Vexu/stage2
stage2: fn typeinfo params
Diffstat (limited to 'test/behavior')
| -rw-r--r-- | test/behavior/src.zig | 25 | ||||
| -rw-r--r-- | test/behavior/type_info.zig | 5 |
2 files changed, 16 insertions, 14 deletions
diff --git a/test/behavior/src.zig b/test/behavior/src.zig index bb0a0971b4..b0e4f2ba70 100644 --- a/test/behavior/src.zig +++ b/test/behavior/src.zig @@ -1,21 +1,20 @@ -const std = @import("std"); -const builtin = @import("builtin"); -const expect = std.testing.expect; - -test "@src" { - // TODO why is this failing on stage1? - return error.SkipZigTest; - - // try doTheTest(); -} - fn doTheTest() !void { - const src = @src(); + const src = @src(); // do not move - try expect(src.line == 9); + try expect(src.line == 2); try expect(src.column == 17); try expect(std.mem.endsWith(u8, src.fn_name, "doTheTest")); try expect(std.mem.endsWith(u8, src.file, "src.zig")); try expect(src.fn_name[src.fn_name.len] == 0); try expect(src.file[src.file.len] == 0); } + +const std = @import("std"); +const builtin = @import("builtin"); +const expect = std.testing.expect; + +test "@src" { + if (builtin.zig_backend != .stage1) return error.SkipZigTest; + + try doTheTest(); +} diff --git a/test/behavior/type_info.zig b/test/behavior/type_info.zig index a3582719fd..8ba627e686 100644 --- a/test/behavior/type_info.zig +++ b/test/behavior/type_info.zig @@ -323,7 +323,9 @@ fn testOpaque() !void { } test "type info: function type info" { - if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; + if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // wasm doesn't support align attributes on functions if (builtin.target.cpu.arch == .wasm32 or builtin.target.cpu.arch == .wasm64) return error.SkipZigTest; @@ -343,6 +345,7 @@ fn testFunction() !void { const fn_aligned_info = @typeInfo(@TypeOf(fooAligned)); try expect(fn_aligned_info.Fn.alignment == 4); + if (builtin.zig_backend != .stage1) return; // no bound fn in stage2 const test_instance: TestPackedStruct = undefined; const bound_fn_info = @typeInfo(@TypeOf(test_instance.foo)); try expect(bound_fn_info == .BoundFn); |
