| author | |
| committer | |
| log | 0b7347fd18eee7dd829cd9aaed3683123d84859b |
| tree | 622e786fb73083368eb287248bd742e2c6aba6d3 |
| parent | c349191b75811f8a21e26f8b175483449fae1638 |
7 files changed, 51 insertions(+), 8 deletions(-)
test/behavior.zig+7-7| ... | ... | @@ -31,18 +31,23 @@ test { |
| 31 | 31 | _ = @import("behavior/bugs/7250.zig"); |
| 32 | 32 | _ = @import("behavior/cast.zig"); |
| 33 | 33 | _ = @import("behavior/comptime_memory.zig"); |
| 34 | _ = @import("behavior/fn_delegation.zig"); | |
| 34 | 35 | _ = @import("behavior/fn_in_struct_in_comptime.zig"); |
| 35 | 36 | _ = @import("behavior/hasdecl.zig"); |
| 36 | 37 | _ = @import("behavior/hasfield.zig"); |
| 38 | _ = @import("behavior/ir_block_deps.zig"); | |
| 37 | 39 | _ = @import("behavior/namespace_depends_on_compile_var.zig"); |
| 38 | 40 | _ = @import("behavior/optional.zig"); |
| 39 | 41 | _ = @import("behavior/prefetch.zig"); |
| 40 | 42 | _ = @import("behavior/pub_enum.zig"); |
| 43 | _ = @import("behavior/reflection.zig"); | |
| 41 | 44 | _ = @import("behavior/slice.zig"); |
| 42 | 45 | _ = @import("behavior/slice_sentinel_comptime.zig"); |
| 43 | _ = @import("behavior/type.zig"); | |
| 44 | _ = @import("behavior/truncate.zig"); | |
| 45 | 46 | _ = @import("behavior/struct.zig"); |
| 47 | _ = @import("behavior/truncate.zig"); | |
| 48 | _ = @import("behavior/tuple.zig"); | |
| 49 | _ = @import("behavior/type.zig"); | |
| 50 | _ = @import("behavior/var_args.zig"); | |
| 46 | 51 | |
| 47 | 52 | if (builtin.zig_backend != .stage2_arm and builtin.zig_backend != .stage2_x86_64) { |
| 48 | 53 | // Tests that pass (partly) for stage1, llvm backend, C backend, wasm backend. |
| ... | ... | @@ -145,21 +150,16 @@ test { |
| 145 | 150 | _ = @import("behavior/const_slice_child.zig"); |
| 146 | 151 | _ = @import("behavior/export_self_referential_type_info.zig"); |
| 147 | 152 | _ = @import("behavior/field_parent_ptr.zig"); |
| 148 | _ = @import("behavior/fn_delegation.zig"); | |
| 149 | _ = @import("behavior/ir_block_deps.zig"); | |
| 150 | 153 | _ = @import("behavior/misc.zig"); |
| 151 | 154 | _ = @import("behavior/muladd.zig"); |
| 152 | _ = @import("behavior/reflection.zig"); | |
| 153 | 155 | _ = @import("behavior/select.zig"); |
| 154 | 156 | _ = @import("behavior/shuffle.zig"); |
| 155 | 157 | _ = @import("behavior/struct_contains_null_ptr_itself.zig"); |
| 156 | 158 | _ = @import("behavior/struct_contains_slice_of_itself.zig"); |
| 157 | 159 | _ = @import("behavior/switch_prong_err_enum.zig"); |
| 158 | 160 | _ = @import("behavior/switch_prong_implicit_cast.zig"); |
| 159 | _ = @import("behavior/tuple.zig"); | |
| 160 | 161 | _ = @import("behavior/typename.zig"); |
| 161 | 162 | _ = @import("behavior/union_with_members.zig"); |
| 162 | _ = @import("behavior/var_args.zig"); | |
| 163 | 163 | _ = @import("behavior/vector.zig"); |
| 164 | 164 | if (builtin.target.cpu.arch == .wasm32) { |
| 165 | 165 | _ = @import("behavior/wasm.zig"); |
test/behavior/fn_delegation.zig+3| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | const builtin = @import("builtin"); | |
| 1 | 2 | const expect = @import("std").testing.expect; |
| 2 | 3 | |
| 3 | 4 | const Foo = struct { |
| ... | ... | @@ -31,6 +32,8 @@ fn custom(comptime T: type, comptime num: u64) fn (T) u64 { |
| 31 | 32 | } |
| 32 | 33 | |
| 33 | 34 | test "fn delegation" { |
| 35 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 36 | ||
| 34 | 37 | const foo = Foo{}; |
| 35 | 38 | try expect(foo.one() == 11); |
| 36 | 39 | try expect(foo.two() == 12); |
test/behavior/ir_block_deps.zig+4| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | const builtin = @import("builtin"); | |
| 1 | 2 | const expect = @import("std").testing.expect; |
| 2 | 3 | |
| 3 | 4 | fn foo(id: u64) !i32 { |
| ... | ... | @@ -17,6 +18,9 @@ fn getErrInt() anyerror!i32 { |
| 17 | 18 | } |
| 18 | 19 | |
| 19 | 20 | test "ir block deps" { |
| 21 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 22 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 23 | ||
| 20 | 24 | try expect((foo(1) catch unreachable) == 0); |
| 21 | 25 | try expect((foo(2) catch unreachable) == 0); |
| 22 | 26 | } |
test/behavior/reflection.zig+6| ... | ... | @@ -1,9 +1,12 @@ |
| 1 | const builtin = @import("builtin"); | |
| 1 | 2 | const std = @import("std"); |
| 2 | 3 | const expect = std.testing.expect; |
| 3 | 4 | const mem = std.mem; |
| 4 | 5 | const reflection = @This(); |
| 5 | 6 | |
| 6 | 7 | test "reflection: function return type, var args, and param types" { |
| 8 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO | |
| 9 | ||
| 7 | 10 | comptime { |
| 8 | 11 | const info = @typeInfo(@TypeOf(dummy)).Fn; |
| 9 | 12 | try expect(info.return_type.? == i32); |
| ... | ... | @@ -25,6 +28,9 @@ fn dummy(a: bool, b: i32, c: f32) i32 { |
| 25 | 28 | } |
| 26 | 29 | |
| 27 | 30 | test "reflection: @field" { |
| 31 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 32 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | |
| 33 | ||
| 28 | 34 | var f = Foo{ |
| 29 | 35 | .one = 42, |
| 30 | 36 | .two = true, |
test/behavior/tuple.zig+11| ... | ... | @@ -1,9 +1,12 @@ |
| 1 | const builtin = @import("builtin"); | |
| 1 | 2 | const std = @import("std"); |
| 2 | 3 | const testing = std.testing; |
| 3 | 4 | const expect = testing.expect; |
| 4 | 5 | const expectEqual = testing.expectEqual; |
| 5 | 6 | |
| 6 | 7 | test "tuple concatenation" { |
| 8 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO | |
| 9 | ||
| 7 | 10 | const S = struct { |
| 8 | 11 | fn doTheTest() !void { |
| 9 | 12 | var a: i32 = 1; |
| ... | ... | @@ -20,6 +23,8 @@ test "tuple concatenation" { |
| 20 | 23 | } |
| 21 | 24 | |
| 22 | 25 | test "tuple multiplication" { |
| 26 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO | |
| 27 | ||
| 23 | 28 | const S = struct { |
| 24 | 29 | fn doTheTest() !void { |
| 25 | 30 | { |
| ... | ... | @@ -81,6 +86,8 @@ test "tuple multiplication" { |
| 81 | 86 | } |
| 82 | 87 | |
| 83 | 88 | test "pass tuple to comptime var parameter" { |
| 89 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO | |
| 90 | ||
| 84 | 91 | const S = struct { |
| 85 | 92 | fn Foo(comptime args: anytype) !void { |
| 86 | 93 | try expect(args[0] == 1); |
| ... | ... | @@ -95,6 +102,8 @@ test "pass tuple to comptime var parameter" { |
| 95 | 102 | } |
| 96 | 103 | |
| 97 | 104 | test "tuple initializer for var" { |
| 105 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO | |
| 106 | ||
| 98 | 107 | const S = struct { |
| 99 | 108 | fn doTheTest() void { |
| 100 | 109 | const Bytes = struct { |
| ... | ... | @@ -114,6 +123,8 @@ test "tuple initializer for var" { |
| 114 | 123 | } |
| 115 | 124 | |
| 116 | 125 | test "array-like initializer for tuple types" { |
| 126 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO | |
| 127 | ||
| 117 | 128 | const T = @Type(std.builtin.TypeInfo{ |
| 118 | 129 | .Struct = std.builtin.TypeInfo.Struct{ |
| 119 | 130 | .is_tuple = true, |
test/behavior/union.zig+1-1| ... | ... | @@ -362,7 +362,7 @@ pub const FooUnion = union(enum) { |
| 362 | 362 | var glbl_array: [2]FooUnion = undefined; |
| 363 | 363 | |
| 364 | 364 | test "initialize global array of union" { |
| 365 | if (@import("builtin").zig_backend == .stage2_wasm) return error.SkipZigTest; | |
| 365 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | |
| 366 | 366 | |
| 367 | 367 | glbl_array[1] = FooUnion{ .U1 = 2 }; |
| 368 | 368 | glbl_array[0] = FooUnion{ .U0 = 1 }; |
test/behavior/var_args.zig+19| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | const builtin = @import("builtin"); | |
| 1 | 2 | const expect = @import("std").testing.expect; |
| 2 | 3 | |
| 3 | 4 | fn add(args: anytype) i32 { |
| ... | ... | @@ -12,6 +13,8 @@ fn add(args: anytype) i32 { |
| 12 | 13 | } |
| 13 | 14 | |
| 14 | 15 | test "add arbitrary args" { |
| 16 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO | |
| 17 | ||
| 15 | 18 | try expect(add(.{ @as(i32, 1), @as(i32, 2), @as(i32, 3), @as(i32, 4) }) == 10); |
| 16 | 19 | try expect(add(.{@as(i32, 1234)}) == 1234); |
| 17 | 20 | try expect(add(.{}) == 0); |
| ... | ... | @@ -22,10 +25,16 @@ fn readFirstVarArg(args: anytype) void { |
| 22 | 25 | } |
| 23 | 26 | |
| 24 | 27 | test "send void arg to var args" { |
| 28 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 29 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | |
| 30 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 31 | ||
| 25 | 32 | readFirstVarArg(.{{}}); |
| 26 | 33 | } |
| 27 | 34 | |
| 28 | 35 | test "pass args directly" { |
| 36 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO | |
| 37 | ||
| 29 | 38 | try expect(addSomeStuff(.{ @as(i32, 1), @as(i32, 2), @as(i32, 3), @as(i32, 4) }) == 10); |
| 30 | 39 | try expect(addSomeStuff(.{@as(i32, 1234)}) == 1234); |
| 31 | 40 | try expect(addSomeStuff(.{}) == 0); |
| ... | ... | @@ -36,6 +45,8 @@ fn addSomeStuff(args: anytype) i32 { |
| 36 | 45 | } |
| 37 | 46 | |
| 38 | 47 | test "runtime parameter before var args" { |
| 48 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO | |
| 49 | ||
| 39 | 50 | try expect((try extraFn(10, .{})) == 0); |
| 40 | 51 | try expect((try extraFn(10, .{false})) == 1); |
| 41 | 52 | try expect((try extraFn(10, .{ false, true })) == 2); |
| ... | ... | @@ -73,11 +84,19 @@ fn foo2(args: anytype) bool { |
| 73 | 84 | } |
| 74 | 85 | |
| 75 | 86 | test "array of var args functions" { |
| 87 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 88 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | |
| 89 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 90 | ||
| 76 | 91 | try expect(foos[0](.{})); |
| 77 | 92 | try expect(!foos[1](.{})); |
| 78 | 93 | } |
| 79 | 94 | |
| 80 | 95 | test "pass zero length array to var args param" { |
| 96 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | |
| 97 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | |
| 98 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | |
| 99 | ||
| 81 | 100 | doNothingWithFirstArg(.{""}); |
| 82 | 101 | } |
| 83 | 102 |