| ... | ... | @@ -9,6 +9,8 @@ const maxInt = std.math.maxInt; |
| 9 | 9 | top_level_field: i32, |
| 10 | 10 | |
| 11 | 11 | test "top level fields" { |
| 12 | if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 13 | |
| 12 | 14 | var instance = @This(){ |
| 13 | 15 | .top_level_field = 1234, |
| 14 | 16 | }; |
| ... | ... | @@ -29,6 +31,8 @@ const StructFoo = struct { |
| 29 | 31 | }; |
| 30 | 32 | |
| 31 | 33 | test "structs" { |
| 34 | if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 35 | |
| 32 | 36 | var foo: StructFoo = undefined; |
| 33 | 37 | @memset(@ptrCast([*]u8, &foo), 0, @sizeOf(StructFoo)); |
| 34 | 38 | foo.a += 1; |
| ... | ... | @@ -45,6 +49,8 @@ fn testMutation(foo: *StructFoo) void { |
| 45 | 49 | } |
| 46 | 50 | |
| 47 | 51 | test "struct byval assign" { |
| 52 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 53 | |
| 48 | 54 | var foo1: StructFoo = undefined; |
| 49 | 55 | var foo2: StructFoo = undefined; |
| 50 | 56 | |
| ... | ... | @@ -56,6 +62,8 @@ test "struct byval assign" { |
| 56 | 62 | } |
| 57 | 63 | |
| 58 | 64 | test "call struct static method" { |
| 65 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 66 | |
| 59 | 67 | const result = StructWithNoFields.add(3, 4); |
| 60 | 68 | try expect(result == 7); |
| 61 | 69 | } |
| ... | ... | @@ -85,6 +93,8 @@ const Val = struct { |
| 85 | 93 | }; |
| 86 | 94 | |
| 87 | 95 | test "fn call of struct field" { |
| 96 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 97 | |
| 88 | 98 | const Foo = struct { |
| 89 | 99 | ptr: fn () i32, |
| 90 | 100 | }; |
| ... | ... | @@ -114,12 +124,16 @@ const MemberFnTestFoo = struct { |
| 114 | 124 | }; |
| 115 | 125 | |
| 116 | 126 | test "call member function directly" { |
| 127 | if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 128 | |
| 117 | 129 | const instance = MemberFnTestFoo{ .x = 1234 }; |
| 118 | 130 | const result = MemberFnTestFoo.member(instance); |
| 119 | 131 | try expect(result == 1234); |
| 120 | 132 | } |
| 121 | 133 | |
| 122 | 134 | test "store member function in variable" { |
| 135 | if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 136 | |
| 123 | 137 | const instance = MemberFnTestFoo{ .x = 1234 }; |
| 124 | 138 | const memberFn = MemberFnTestFoo.member; |
| 125 | 139 | const result = memberFn(instance); |
| ... | ... | @@ -127,6 +141,8 @@ test "store member function in variable" { |
| 127 | 141 | } |
| 128 | 142 | |
| 129 | 143 | test "member functions" { |
| 144 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 145 | |
| 130 | 146 | const r = MemberFnRand{ .seed = 1234 }; |
| 131 | 147 | try expect(r.getSeed() == 1234); |
| 132 | 148 | } |
| ... | ... | @@ -138,6 +154,8 @@ const MemberFnRand = struct { |
| 138 | 154 | }; |
| 139 | 155 | |
| 140 | 156 | test "return struct byval from function" { |
| 157 | if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 158 | |
| 141 | 159 | const bar = makeBar2(1234, 5678); |
| 142 | 160 | try expect(bar.y == 5678); |
| 143 | 161 | } |
| ... | ... | @@ -153,6 +171,8 @@ fn makeBar2(x: i32, y: i32) Bar { |
| 153 | 171 | } |
| 154 | 172 | |
| 155 | 173 | test "call method with mutable reference to struct with no fields" { |
| 174 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 175 | |
| 156 | 176 | const S = struct { |
| 157 | 177 | fn doC(s: *const @This()) bool { |
| 158 | 178 | _ = s; |
| ... | ... | @@ -172,6 +192,8 @@ test "call method with mutable reference to struct with no fields" { |
| 172 | 192 | } |
| 173 | 193 | |
| 174 | 194 | test "usingnamespace within struct scope" { |
| 195 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 196 | |
| 175 | 197 | const S = struct { |
| 176 | 198 | usingnamespace struct { |
| 177 | 199 | pub fn inner() i32 { |
| ... | ... | @@ -183,6 +205,8 @@ test "usingnamespace within struct scope" { |
| 183 | 205 | } |
| 184 | 206 | |
| 185 | 207 | test "struct field init with catch" { |
| 208 | if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 209 | |
| 186 | 210 | const S = struct { |
| 187 | 211 | fn doTheTest() !void { |
| 188 | 212 | var x: anyerror!isize = 1; |