| ... | @@ -15,6 +15,8 @@ test "empty function with comments" { | ... | @@ -15,6 +15,8 @@ test "empty function with comments" { |
| 15 | } | 15 | } |
| 16 | | 16 | |
| 17 | test "truncate" { | 17 | test "truncate" { |
| | 18 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 19 | |
| 18 | try expect(testTruncate(0x10fd) == 0xfd); | 20 | try expect(testTruncate(0x10fd) == 0xfd); |
| 19 | comptime try expect(testTruncate(0x10fd) == 0xfd); | 21 | comptime try expect(testTruncate(0x10fd) == 0xfd); |
| 20 | } | 22 | } |
| ... | @@ -23,6 +25,9 @@ fn testTruncate(x: u32) u8 { | ... | @@ -23,6 +25,9 @@ fn testTruncate(x: u32) u8 { |
| 23 | } | 25 | } |
| 24 | | 26 | |
| 25 | test "truncate to non-power-of-two integers" { | 27 | test "truncate to non-power-of-two integers" { |
| | 28 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 29 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 30 | |
| 26 | try testTrunc(u32, u1, 0b10101, 0b1); | 31 | try testTrunc(u32, u1, 0b10101, 0b1); |
| 27 | try testTrunc(u32, u1, 0b10110, 0b0); | 32 | try testTrunc(u32, u1, 0b10110, 0b0); |
| 28 | try testTrunc(u32, u2, 0b10101, 0b01); | 33 | try testTrunc(u32, u2, 0b10101, 0b01); |
| ... | @@ -108,14 +113,23 @@ fn first4KeysOfHomeRow() []const u8 { | ... | @@ -108,14 +113,23 @@ fn first4KeysOfHomeRow() []const u8 { |
| 108 | } | 113 | } |
| 109 | | 114 | |
| 110 | test "return string from function" { | 115 | test "return string from function" { |
| | 116 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 117 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 118 | |
| 111 | try expect(mem.eql(u8, first4KeysOfHomeRow(), "aoeu")); | 119 | try expect(mem.eql(u8, first4KeysOfHomeRow(), "aoeu")); |
| 112 | } | 120 | } |
| 113 | | 121 | |
| 114 | test "hex escape" { | 122 | test "hex escape" { |
| | 123 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 124 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 125 | |
| 115 | try expect(mem.eql(u8, "\x68\x65\x6c\x6c\x6f", "hello")); | 126 | try expect(mem.eql(u8, "\x68\x65\x6c\x6c\x6f", "hello")); |
| 116 | } | 127 | } |
| 117 | | 128 | |
| 118 | test "multiline string" { | 129 | test "multiline string" { |
| | 130 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 131 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 132 | |
| 119 | const s1 = | 133 | const s1 = |
| 120 | \\one | 134 | \\one |
| 121 | \\two) | 135 | \\two) |
| ... | @@ -126,6 +140,9 @@ test "multiline string" { | ... | @@ -126,6 +140,9 @@ test "multiline string" { |
| 126 | } | 140 | } |
| 127 | | 141 | |
| 128 | test "multiline string comments at start" { | 142 | test "multiline string comments at start" { |
| | 143 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 144 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 145 | |
| 129 | const s1 = | 146 | const s1 = |
| 130 | //\\one | 147 | //\\one |
| 131 | \\two) | 148 | \\two) |
| ... | @@ -136,6 +153,9 @@ test "multiline string comments at start" { | ... | @@ -136,6 +153,9 @@ test "multiline string comments at start" { |
| 136 | } | 153 | } |
| 137 | | 154 | |
| 138 | test "multiline string comments at end" { | 155 | test "multiline string comments at end" { |
| | 156 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 157 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 158 | |
| 139 | const s1 = | 159 | const s1 = |
| 140 | \\one | 160 | \\one |
| 141 | \\two) | 161 | \\two) |
| ... | @@ -146,6 +166,9 @@ test "multiline string comments at end" { | ... | @@ -146,6 +166,9 @@ test "multiline string comments at end" { |
| 146 | } | 166 | } |
| 147 | | 167 | |
| 148 | test "multiline string comments in middle" { | 168 | test "multiline string comments in middle" { |
| | 169 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 170 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 171 | |
| 149 | const s1 = | 172 | const s1 = |
| 150 | \\one | 173 | \\one |
| 151 | //\\two) | 174 | //\\two) |
| ... | @@ -156,6 +179,9 @@ test "multiline string comments in middle" { | ... | @@ -156,6 +179,9 @@ test "multiline string comments in middle" { |
| 156 | } | 179 | } |
| 157 | | 180 | |
| 158 | test "multiline string comments at multiple places" { | 181 | test "multiline string comments at multiple places" { |
| | 182 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 183 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 184 | |
| 159 | const s1 = | 185 | const s1 = |
| 160 | \\one | 186 | \\one |
| 161 | //\\two | 187 | //\\two |
| ... | @@ -172,6 +198,9 @@ test "string concatenation" { | ... | @@ -172,6 +198,9 @@ test "string concatenation" { |
| 172 | } | 198 | } |
| 173 | | 199 | |
| 174 | test "array mult operator" { | 200 | test "array mult operator" { |
| | 201 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 202 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 203 | |
| 175 | try expect(mem.eql(u8, "ab" ** 5, "ababababab")); | 204 | try expect(mem.eql(u8, "ab" ** 5, "ababababab")); |
| 176 | } | 205 | } |
| 177 | | 206 | |
| ... | @@ -195,6 +224,9 @@ test "compile time global reinterpret" { | ... | @@ -195,6 +224,9 @@ test "compile time global reinterpret" { |
| 195 | } | 224 | } |
| 196 | | 225 | |
| 197 | test "cast undefined" { | 226 | test "cast undefined" { |
| | 227 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 228 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 229 | |
| 198 | const array: [100]u8 = undefined; | 230 | const array: [100]u8 = undefined; |
| 199 | const slice = @as([]const u8, &array); | 231 | const slice = @as([]const u8, &array); |
| 200 | testCastUndefined(slice); | 232 | testCastUndefined(slice); |
| ... | @@ -204,6 +236,8 @@ fn testCastUndefined(x: []const u8) void { | ... | @@ -204,6 +236,8 @@ fn testCastUndefined(x: []const u8) void { |
| 204 | } | 236 | } |
| 205 | | 237 | |
| 206 | test "implicit cast after unreachable" { | 238 | test "implicit cast after unreachable" { |
| | 239 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 240 | |
| 207 | try expect(outer() == 1234); | 241 | try expect(outer() == 1234); |
| 208 | } | 242 | } |
| 209 | fn inner() i32 { | 243 | fn inner() i32 { |
| ... | @@ -259,6 +293,9 @@ fn fB() []const u8 { | ... | @@ -259,6 +293,9 @@ fn fB() []const u8 { |
| 259 | } | 293 | } |
| 260 | | 294 | |
| 261 | test "call function pointer in struct" { | 295 | test "call function pointer in struct" { |
| | 296 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 297 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 298 | |
| 262 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; | 299 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; |
| 263 | | 300 | |
| 264 | try expect(mem.eql(u8, f3(true), "a")); | 301 | try expect(mem.eql(u8, f3(true), "a")); |
| ... | @@ -282,6 +319,8 @@ const FnPtrWrapper = struct { | ... | @@ -282,6 +319,8 @@ const FnPtrWrapper = struct { |
| 282 | }; | 319 | }; |
| 283 | | 320 | |
| 284 | test "const ptr from var variable" { | 321 | test "const ptr from var variable" { |
| | 322 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 323 | |
| 285 | var x: u64 = undefined; | 324 | var x: u64 = undefined; |
| 286 | var y: u64 = undefined; | 325 | var y: u64 = undefined; |
| 287 | | 326 | |
| ... | @@ -296,6 +335,8 @@ fn copy(src: *const u64, dst: *u64) void { | ... | @@ -296,6 +335,8 @@ fn copy(src: *const u64, dst: *u64) void { |
| 296 | } | 335 | } |
| 297 | | 336 | |
| 298 | test "call result of if else expression" { | 337 | test "call result of if else expression" { |
| | 338 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 339 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 299 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 340 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 300 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 341 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 301 | | 342 | |
| ... | @@ -307,6 +348,8 @@ fn f2(x: bool) []const u8 { | ... | @@ -307,6 +348,8 @@ fn f2(x: bool) []const u8 { |
| 307 | } | 348 | } |
| 308 | | 349 | |
| 309 | test "memcpy and memset intrinsics" { | 350 | test "memcpy and memset intrinsics" { |
| | 351 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 352 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 310 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 353 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 311 | | 354 | |
| 312 | try testMemcpyMemset(); | 355 | try testMemcpyMemset(); |
| ... | @@ -327,6 +370,8 @@ fn testMemcpyMemset() !void { | ... | @@ -327,6 +370,8 @@ fn testMemcpyMemset() !void { |
| 327 | } | 370 | } |
| 328 | | 371 | |
| 329 | test "variable is allowed to be a pointer to an opaque type" { | 372 | test "variable is allowed to be a pointer to an opaque type" { |
| | 373 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 374 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 330 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 375 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 331 | | 376 | |
| 332 | var x: i32 = 1234; | 377 | var x: i32 = 1234; |
| ... | @@ -338,6 +383,9 @@ fn hereIsAnOpaqueType(ptr: *OpaqueA) *OpaqueA { | ... | @@ -338,6 +383,9 @@ fn hereIsAnOpaqueType(ptr: *OpaqueA) *OpaqueA { |
| 338 | } | 383 | } |
| 339 | | 384 | |
| 340 | test "take address of parameter" { | 385 | test "take address of parameter" { |
| | 386 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 387 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 388 | |
| 341 | try testTakeAddressOfParameter(12.34); | 389 | try testTakeAddressOfParameter(12.34); |
| 342 | } | 390 | } |
| 343 | fn testTakeAddressOfParameter(f: f32) !void { | 391 | fn testTakeAddressOfParameter(f: f32) !void { |
| ... | @@ -360,6 +408,9 @@ fn testPointerToVoidReturnType2() *const void { | ... | @@ -360,6 +408,9 @@ fn testPointerToVoidReturnType2() *const void { |
| 360 | } | 408 | } |
| 361 | | 409 | |
| 362 | test "array 2D const double ptr" { | 410 | test "array 2D const double ptr" { |
| | 411 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 412 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 413 | |
| 363 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 414 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 364 | | 415 | |
| 365 | const rect_2d_vertexes = [_][1]f32{ | 416 | const rect_2d_vertexes = [_][1]f32{ |
| ... | @@ -376,6 +427,9 @@ fn testArray2DConstDoublePtr(ptr: *const f32) !void { | ... | @@ -376,6 +427,9 @@ fn testArray2DConstDoublePtr(ptr: *const f32) !void { |
| 376 | } | 427 | } |
| 377 | | 428 | |
| 378 | test "double implicit cast in same expression" { | 429 | test "double implicit cast in same expression" { |
| | 430 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 431 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 432 | |
| 379 | var x = @as(i32, @as(u16, nine())); | 433 | var x = @as(i32, @as(u16, nine())); |
| 380 | try expect(x == 9); | 434 | try expect(x == 9); |
| 381 | } | 435 | } |
| ... | @@ -384,6 +438,8 @@ fn nine() u8 { | ... | @@ -384,6 +438,8 @@ fn nine() u8 { |
| 384 | } | 438 | } |
| 385 | | 439 | |
| 386 | test "struct inside function" { | 440 | test "struct inside function" { |
| | 441 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 442 | |
| 387 | try testStructInFn(); | 443 | try testStructInFn(); |
| 388 | comptime try testStructInFn(); | 444 | comptime try testStructInFn(); |
| 389 | } | 445 | } |
| ... | @@ -411,6 +467,8 @@ fn getNull() ?*i32 { | ... | @@ -411,6 +467,8 @@ fn getNull() ?*i32 { |
| 411 | } | 467 | } |
| 412 | | 468 | |
| 413 | test "global variable assignment with optional unwrapping with var initialized to undefined" { | 469 | test "global variable assignment with optional unwrapping with var initialized to undefined" { |
| | 470 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 471 | |
| 414 | const S = struct { | 472 | const S = struct { |
| 415 | var data: i32 = 1234; | 473 | var data: i32 = 1234; |
| 416 | fn foo() ?*i32 { | 474 | fn foo() ?*i32 { |
| ... | @@ -426,6 +484,9 @@ test "global variable assignment with optional unwrapping with var initialized t | ... | @@ -426,6 +484,9 @@ test "global variable assignment with optional unwrapping with var initialized t |
| 426 | var global_foo: *i32 = undefined; | 484 | var global_foo: *i32 = undefined; |
| 427 | | 485 | |
| 428 | test "peer result location with typed parent, runtime condition, comptime prongs" { | 486 | test "peer result location with typed parent, runtime condition, comptime prongs" { |
| | 487 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 488 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 489 | |
| 429 | const S = struct { | 490 | const S = struct { |
| 430 | fn doTheTest(arg: i32) i32 { | 491 | fn doTheTest(arg: i32) i32 { |
| 431 | const st = Structy{ | 492 | const st = Structy{ |
| ... | @@ -523,6 +584,9 @@ test "self reference through fn ptr field" { | ... | @@ -523,6 +584,9 @@ test "self reference through fn ptr field" { |
| 523 | } | 584 | } |
| 524 | | 585 | |
| 525 | test "global variable initialized to global variable array element" { | 586 | test "global variable initialized to global variable array element" { |
| | 587 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 588 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 589 | |
| 526 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | 590 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; |
| 527 | | 591 | |
| 528 | try expect(global_ptr == &gdt[0]); | 592 | try expect(global_ptr == &gdt[0]); |
| ... | @@ -537,6 +601,8 @@ var gdt = [_]GDTEntry{ | ... | @@ -537,6 +601,8 @@ var gdt = [_]GDTEntry{ |
| 537 | var global_ptr = &gdt[0]; | 601 | var global_ptr = &gdt[0]; |
| 538 | | 602 | |
| 539 | test "global constant is loaded with a runtime-known index" { | 603 | test "global constant is loaded with a runtime-known index" { |
| | 604 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 605 | |
| 540 | const S = struct { | 606 | const S = struct { |
| 541 | fn doTheTest() !void { | 607 | fn doTheTest() !void { |
| 542 | var index: usize = 1; | 608 | var index: usize = 1; |
| ... | @@ -552,6 +618,9 @@ test "global constant is loaded with a runtime-known index" { | ... | @@ -552,6 +618,9 @@ test "global constant is loaded with a runtime-known index" { |
| 552 | } | 618 | } |
| 553 | | 619 | |
| 554 | test "multiline string literal is null terminated" { | 620 | test "multiline string literal is null terminated" { |
| | 621 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 622 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 623 | |
| 555 | const s1 = | 624 | const s1 = |
| 556 | \\one | 625 | \\one |
| 557 | \\two) | 626 | \\two) |
| ... | @@ -582,6 +651,9 @@ test "explicit cast optional pointers" { | ... | @@ -582,6 +651,9 @@ test "explicit cast optional pointers" { |
| 582 | } | 651 | } |
| 583 | | 652 | |
| 584 | test "pointer comparison" { | 653 | test "pointer comparison" { |
| | 654 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 655 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 656 | |
| 585 | const a = @as([]const u8, "a"); | 657 | const a = @as([]const u8, "a"); |
| 586 | const b = &a; | 658 | const b = &a; |
| 587 | try expect(ptrEql(b, b)); | 659 | try expect(ptrEql(b, b)); |
| ... | @@ -591,6 +663,9 @@ fn ptrEql(a: *const []const u8, b: *const []const u8) bool { | ... | @@ -591,6 +663,9 @@ fn ptrEql(a: *const []const u8, b: *const []const u8) bool { |
| 591 | } | 663 | } |
| 592 | | 664 | |
| 593 | test "string concatenation" { | 665 | test "string concatenation" { |
| | 666 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 667 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| | 668 | |
| 594 | const a = "OK" ++ " IT " ++ "WORKED"; | 669 | const a = "OK" ++ " IT " ++ "WORKED"; |
| 595 | const b = "OK IT WORKED"; | 670 | const b = "OK IT WORKED"; |
| 596 | | 671 | |
| ... | @@ -610,6 +685,8 @@ test "string concatenation" { | ... | @@ -610,6 +685,8 @@ test "string concatenation" { |
| 610 | } | 685 | } |
| 611 | | 686 | |
| 612 | test "thread local variable" { | 687 | test "thread local variable" { |
| | 688 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 689 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 613 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO | 690 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO |
| 614 | | 691 | |
| 615 | const S = struct { | 692 | const S = struct { |
| ... | @@ -634,6 +711,8 @@ fn maybe(x: bool) anyerror!?u32 { | ... | @@ -634,6 +711,8 @@ fn maybe(x: bool) anyerror!?u32 { |
| 634 | } | 711 | } |
| 635 | | 712 | |
| 636 | test "pointer to thread local array" { | 713 | test "pointer to thread local array" { |
| | 714 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| | 715 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 637 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO | 716 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO |
| 638 | | 717 | |
| 639 | const s = "Hello world"; | 718 | const s = "Hello world"; |