diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-02-12 21:35:29 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-02-12 21:35:29 -0700 |
| commit | 0b7347fd18eee7dd829cd9aaed3683123d84859b (patch) | |
| tree | 622e786fb73083368eb287248bd742e2c6aba6d3 /test/behavior | |
| parent | c349191b75811f8a21e26f8b175483449fae1638 (diff) | |
| download | zig-0b7347fd18eee7dd829cd9aaed3683123d84859b.tar.gz zig-0b7347fd18eee7dd829cd9aaed3683123d84859b.zip | |
move more behavior tests to the "passing" section
Diffstat (limited to 'test/behavior')
| -rw-r--r-- | test/behavior/fn_delegation.zig | 3 | ||||
| -rw-r--r-- | test/behavior/ir_block_deps.zig | 4 | ||||
| -rw-r--r-- | test/behavior/reflection.zig | 6 | ||||
| -rw-r--r-- | test/behavior/tuple.zig | 11 | ||||
| -rw-r--r-- | test/behavior/union.zig | 2 | ||||
| -rw-r--r-- | test/behavior/var_args.zig | 19 |
6 files changed, 44 insertions, 1 deletions
diff --git a/test/behavior/fn_delegation.zig b/test/behavior/fn_delegation.zig index 72a72c0bdd..25ec3dea1b 100644 --- a/test/behavior/fn_delegation.zig +++ b/test/behavior/fn_delegation.zig @@ -1,3 +1,4 @@ +const builtin = @import("builtin"); const expect = @import("std").testing.expect; const Foo = struct { @@ -31,6 +32,8 @@ fn custom(comptime T: type, comptime num: u64) fn (T) u64 { } test "fn delegation" { + if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO + const foo = Foo{}; try expect(foo.one() == 11); try expect(foo.two() == 12); diff --git a/test/behavior/ir_block_deps.zig b/test/behavior/ir_block_deps.zig index 09c1532bff..cbc5cc2419 100644 --- a/test/behavior/ir_block_deps.zig +++ b/test/behavior/ir_block_deps.zig @@ -1,3 +1,4 @@ +const builtin = @import("builtin"); const expect = @import("std").testing.expect; fn foo(id: u64) !i32 { @@ -17,6 +18,9 @@ fn getErrInt() anyerror!i32 { } test "ir block deps" { + if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO + try expect((foo(1) catch unreachable) == 0); try expect((foo(2) catch unreachable) == 0); } diff --git a/test/behavior/reflection.zig b/test/behavior/reflection.zig index 18ee9d5c8b..96c81fe0d0 100644 --- a/test/behavior/reflection.zig +++ b/test/behavior/reflection.zig @@ -1,9 +1,12 @@ +const builtin = @import("builtin"); const std = @import("std"); const expect = std.testing.expect; const mem = std.mem; const reflection = @This(); test "reflection: function return type, var args, and param types" { + if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + comptime { const info = @typeInfo(@TypeOf(dummy)).Fn; try expect(info.return_type.? == i32); @@ -25,6 +28,9 @@ fn dummy(a: bool, b: i32, c: f32) i32 { } test "reflection: @field" { + if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO + var f = Foo{ .one = 42, .two = true, diff --git a/test/behavior/tuple.zig b/test/behavior/tuple.zig index 632e5be013..680de28b76 100644 --- a/test/behavior/tuple.zig +++ b/test/behavior/tuple.zig @@ -1,9 +1,12 @@ +const builtin = @import("builtin"); const std = @import("std"); const testing = std.testing; const expect = testing.expect; const expectEqual = testing.expectEqual; test "tuple concatenation" { + if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + const S = struct { fn doTheTest() !void { var a: i32 = 1; @@ -20,6 +23,8 @@ test "tuple concatenation" { } test "tuple multiplication" { + if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + const S = struct { fn doTheTest() !void { { @@ -81,6 +86,8 @@ test "tuple multiplication" { } test "pass tuple to comptime var parameter" { + if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + const S = struct { fn Foo(comptime args: anytype) !void { try expect(args[0] == 1); @@ -95,6 +102,8 @@ test "pass tuple to comptime var parameter" { } test "tuple initializer for var" { + if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + const S = struct { fn doTheTest() void { const Bytes = struct { @@ -114,6 +123,8 @@ test "tuple initializer for var" { } test "array-like initializer for tuple types" { + if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + const T = @Type(std.builtin.TypeInfo{ .Struct = std.builtin.TypeInfo.Struct{ .is_tuple = true, diff --git a/test/behavior/union.zig b/test/behavior/union.zig index cdd63df44e..1cd5b05eb1 100644 --- a/test/behavior/union.zig +++ b/test/behavior/union.zig @@ -362,7 +362,7 @@ pub const FooUnion = union(enum) { var glbl_array: [2]FooUnion = undefined; test "initialize global array of union" { - if (@import("builtin").zig_backend == .stage2_wasm) return error.SkipZigTest; + if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; glbl_array[1] = FooUnion{ .U1 = 2 }; glbl_array[0] = FooUnion{ .U0 = 1 }; diff --git a/test/behavior/var_args.zig b/test/behavior/var_args.zig index 40770e1334..63b8c35e1b 100644 --- a/test/behavior/var_args.zig +++ b/test/behavior/var_args.zig @@ -1,3 +1,4 @@ +const builtin = @import("builtin"); const expect = @import("std").testing.expect; fn add(args: anytype) i32 { @@ -12,6 +13,8 @@ fn add(args: anytype) i32 { } test "add arbitrary args" { + if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + try expect(add(.{ @as(i32, 1), @as(i32, 2), @as(i32, 3), @as(i32, 4) }) == 10); try expect(add(.{@as(i32, 1234)}) == 1234); try expect(add(.{}) == 0); @@ -22,10 +25,16 @@ fn readFirstVarArg(args: anytype) void { } test "send void arg to var args" { + if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO + readFirstVarArg(.{{}}); } test "pass args directly" { + if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + try expect(addSomeStuff(.{ @as(i32, 1), @as(i32, 2), @as(i32, 3), @as(i32, 4) }) == 10); try expect(addSomeStuff(.{@as(i32, 1234)}) == 1234); try expect(addSomeStuff(.{}) == 0); @@ -36,6 +45,8 @@ fn addSomeStuff(args: anytype) i32 { } test "runtime parameter before var args" { + if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO + try expect((try extraFn(10, .{})) == 0); try expect((try extraFn(10, .{false})) == 1); try expect((try extraFn(10, .{ false, true })) == 2); @@ -73,11 +84,19 @@ fn foo2(args: anytype) bool { } test "array of var args functions" { + if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO + try expect(foos[0](.{})); try expect(!foos[1](.{})); } test "pass zero length array to var args param" { + if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO + doNothingWithFirstArg(.{""}); } |
