| author | |
| committer | |
| log | f1f17dc1c744defa89f65b2dc642ca0c1b7c1e44 |
| tree | 0f6bb6aa65a369d1c634e457719c72ba15b5dc28 |
| parent | 023b597ab4a74adbbe658bd7476fa5d20b02a133 |
| parent | 654e30069d5886d558dfa5f513836e4bee034545 |
| signature | Signed by PGP key 4AEE18F83AFDEB23 |
Re-enable many previously failing tests and add test coverage21 files changed, 289 insertions(+), 62 deletions(-)
doc/langref.html.in-4| ... | @@ -6242,10 +6242,6 @@ test "implicit unsigned integer to signed integer" { | ... | @@ -6242,10 +6242,6 @@ test "implicit unsigned integer to signed integer" { |
| 6242 | } | 6242 | } |
| 6243 | 6243 | ||
| 6244 | test "float widening" { | 6244 | test "float widening" { |
| 6245 | // Note: there is an open issue preventing this from working on aarch64: | ||
| 6246 | // https://github.com/ziglang/zig/issues/3282 | ||
| 6247 | if (builtin.target.cpu.arch == .aarch64) return error.SkipZigTest; | ||
| 6248 | |||
| 6249 | var a: f16 = 12.34; | 6245 | var a: f16 = 12.34; |
| 6250 | var b: f32 = a; | 6246 | var b: f32 = a; |
| 6251 | var c: f64 = b; | 6247 | var c: f64 = b; |
lib/std/fmt/parse_float.zig-5| ... | @@ -70,11 +70,6 @@ test "fmt.parseFloat" { | ... | @@ -70,11 +70,6 @@ test "fmt.parseFloat" { |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | test "fmt.parseFloat nan and inf" { | 72 | test "fmt.parseFloat nan and inf" { |
| 73 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { | ||
| 74 | // https://github.com/ziglang/zig/issues/12027 | ||
| 75 | return error.SkipZigTest; | ||
| 76 | } | ||
| 77 | |||
| 78 | inline for ([_]type{ f16, f32, f64, f128 }) |T| { | 73 | inline for ([_]type{ f16, f32, f64, f128 }) |T| { |
| 79 | const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits); | 74 | const Z = std.meta.Int(.unsigned, @typeInfo(T).Float.bits); |
| 80 | 75 |
lib/std/math.zig-16| ... | @@ -523,10 +523,6 @@ pub fn shl(comptime T: type, a: T, shift_amt: anytype) T { | ... | @@ -523,10 +523,6 @@ pub fn shl(comptime T: type, a: T, shift_amt: anytype) T { |
| 523 | } | 523 | } |
| 524 | 524 | ||
| 525 | test "shl" { | 525 | test "shl" { |
| 526 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { | ||
| 527 | // https://github.com/ziglang/zig/issues/12012 | ||
| 528 | return error.SkipZigTest; | ||
| 529 | } | ||
| 530 | try testing.expect(shl(u8, 0b11111111, @as(usize, 3)) == 0b11111000); | 526 | try testing.expect(shl(u8, 0b11111111, @as(usize, 3)) == 0b11111000); |
| 531 | try testing.expect(shl(u8, 0b11111111, @as(usize, 8)) == 0); | 527 | try testing.expect(shl(u8, 0b11111111, @as(usize, 8)) == 0); |
| 532 | try testing.expect(shl(u8, 0b11111111, @as(usize, 9)) == 0); | 528 | try testing.expect(shl(u8, 0b11111111, @as(usize, 9)) == 0); |
| ... | @@ -567,10 +563,6 @@ pub fn shr(comptime T: type, a: T, shift_amt: anytype) T { | ... | @@ -567,10 +563,6 @@ pub fn shr(comptime T: type, a: T, shift_amt: anytype) T { |
| 567 | } | 563 | } |
| 568 | 564 | ||
| 569 | test "shr" { | 565 | test "shr" { |
| 570 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { | ||
| 571 | // https://github.com/ziglang/zig/issues/12012 | ||
| 572 | return error.SkipZigTest; | ||
| 573 | } | ||
| 574 | try testing.expect(shr(u8, 0b11111111, @as(usize, 3)) == 0b00011111); | 566 | try testing.expect(shr(u8, 0b11111111, @as(usize, 3)) == 0b00011111); |
| 575 | try testing.expect(shr(u8, 0b11111111, @as(usize, 8)) == 0); | 567 | try testing.expect(shr(u8, 0b11111111, @as(usize, 8)) == 0); |
| 576 | try testing.expect(shr(u8, 0b11111111, @as(usize, 9)) == 0); | 568 | try testing.expect(shr(u8, 0b11111111, @as(usize, 9)) == 0); |
| ... | @@ -612,10 +604,6 @@ pub fn rotr(comptime T: type, x: T, r: anytype) T { | ... | @@ -612,10 +604,6 @@ pub fn rotr(comptime T: type, x: T, r: anytype) T { |
| 612 | } | 604 | } |
| 613 | 605 | ||
| 614 | test "rotr" { | 606 | test "rotr" { |
| 615 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { | ||
| 616 | // https://github.com/ziglang/zig/issues/12012 | ||
| 617 | return error.SkipZigTest; | ||
| 618 | } | ||
| 619 | try testing.expect(rotr(u0, 0b0, @as(usize, 3)) == 0b0); | 607 | try testing.expect(rotr(u0, 0b0, @as(usize, 3)) == 0b0); |
| 620 | try testing.expect(rotr(u5, 0b00001, @as(usize, 0)) == 0b00001); | 608 | try testing.expect(rotr(u5, 0b00001, @as(usize, 0)) == 0b00001); |
| 621 | try testing.expect(rotr(u6, 0b000001, @as(usize, 7)) == 0b100000); | 609 | try testing.expect(rotr(u6, 0b000001, @as(usize, 7)) == 0b100000); |
| ... | @@ -656,10 +644,6 @@ pub fn rotl(comptime T: type, x: T, r: anytype) T { | ... | @@ -656,10 +644,6 @@ pub fn rotl(comptime T: type, x: T, r: anytype) T { |
| 656 | } | 644 | } |
| 657 | 645 | ||
| 658 | test "rotl" { | 646 | test "rotl" { |
| 659 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { | ||
| 660 | // https://github.com/ziglang/zig/issues/12012 | ||
| 661 | return error.SkipZigTest; | ||
| 662 | } | ||
| 663 | try testing.expect(rotl(u0, 0b0, @as(usize, 3)) == 0b0); | 647 | try testing.expect(rotl(u0, 0b0, @as(usize, 3)) == 0b0); |
| 664 | try testing.expect(rotl(u5, 0b00001, @as(usize, 0)) == 0b00001); | 648 | try testing.expect(rotl(u5, 0b00001, @as(usize, 0)) == 0b00001); |
| 665 | try testing.expect(rotl(u6, 0b000001, @as(usize, 7)) == 0b000010); | 649 | try testing.expect(rotl(u6, 0b000001, @as(usize, 7)) == 0b000010); |
lib/std/segmented_list.zig+1-4| ... | @@ -412,10 +412,7 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type | ... | @@ -412,10 +412,7 @@ pub fn SegmentedList(comptime T: type, comptime prealloc_item_count: usize) type |
| 412 | } | 412 | } |
| 413 | 413 | ||
| 414 | test "SegmentedList basic usage" { | 414 | test "SegmentedList basic usage" { |
| 415 | if (false) { | 415 | try testSegmentedList(0); |
| 416 | // https://github.com/ziglang/zig/issues/11787 | ||
| 417 | try testSegmentedList(0); | ||
| 418 | } | ||
| 419 | try testSegmentedList(1); | 416 | try testSegmentedList(1); |
| 420 | try testSegmentedList(2); | 417 | try testSegmentedList(2); |
| 421 | try testSegmentedList(4); | 418 | try testSegmentedList(4); |
lib/std/simd.zig-4| ... | @@ -191,10 +191,6 @@ pub fn extract( | ... | @@ -191,10 +191,6 @@ pub fn extract( |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | test "vector patterns" { | 193 | test "vector patterns" { |
| 194 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { | ||
| 195 | // https://github.com/ziglang/zig/issues/12012 | ||
| 196 | return error.SkipZigTest; | ||
| 197 | } | ||
| 198 | const base = @Vector(4, u32){ 10, 20, 30, 40 }; | 194 | const base = @Vector(4, u32){ 10, 20, 30, 40 }; |
| 199 | const other_base = @Vector(4, u32){ 55, 66, 77, 88 }; | 195 | const other_base = @Vector(4, u32){ 55, 66, 77, 88 }; |
| 200 | 196 |
test/behavior.zig+9| ... | @@ -43,7 +43,9 @@ test { | ... | @@ -43,7 +43,9 @@ test { |
| 43 | _ = @import("behavior/bugs/2346.zig"); | 43 | _ = @import("behavior/bugs/2346.zig"); |
| 44 | _ = @import("behavior/bugs/2557.zig"); | 44 | _ = @import("behavior/bugs/2557.zig"); |
| 45 | _ = @import("behavior/bugs/2578.zig"); | 45 | _ = @import("behavior/bugs/2578.zig"); |
| 46 | _ = @import("behavior/bugs/2622.zig"); | ||
| 46 | _ = @import("behavior/bugs/2692.zig"); | 47 | _ = @import("behavior/bugs/2692.zig"); |
| 48 | _ = @import("behavior/bugs/2727.zig"); | ||
| 47 | _ = @import("behavior/bugs/2889.zig"); | 49 | _ = @import("behavior/bugs/2889.zig"); |
| 48 | _ = @import("behavior/bugs/3007.zig"); | 50 | _ = @import("behavior/bugs/3007.zig"); |
| 49 | _ = @import("behavior/bugs/3046.zig"); | 51 | _ = @import("behavior/bugs/3046.zig"); |
| ... | @@ -62,16 +64,22 @@ test { | ... | @@ -62,16 +64,22 @@ test { |
| 62 | _ = @import("behavior/bugs/5413.zig"); | 64 | _ = @import("behavior/bugs/5413.zig"); |
| 63 | _ = @import("behavior/bugs/5474.zig"); | 65 | _ = @import("behavior/bugs/5474.zig"); |
| 64 | _ = @import("behavior/bugs/5487.zig"); | 66 | _ = @import("behavior/bugs/5487.zig"); |
| 67 | _ = @import("behavior/bugs/6047.zig"); | ||
| 65 | _ = @import("behavior/bugs/6456.zig"); | 68 | _ = @import("behavior/bugs/6456.zig"); |
| 66 | _ = @import("behavior/bugs/6781.zig"); | 69 | _ = @import("behavior/bugs/6781.zig"); |
| 67 | _ = @import("behavior/bugs/6850.zig"); | 70 | _ = @import("behavior/bugs/6850.zig"); |
| 71 | _ = @import("behavior/bugs/6905.zig"); | ||
| 72 | _ = @import("behavior/bugs/6947.zig"); | ||
| 68 | _ = @import("behavior/bugs/7003.zig"); | 73 | _ = @import("behavior/bugs/7003.zig"); |
| 69 | _ = @import("behavior/bugs/7047.zig"); | 74 | _ = @import("behavior/bugs/7047.zig"); |
| 70 | _ = @import("behavior/bugs/7187.zig"); | 75 | _ = @import("behavior/bugs/7187.zig"); |
| 76 | _ = @import("behavior/bugs/7325.zig"); | ||
| 77 | _ = @import("behavior/bugs/8646.zig"); | ||
| 71 | _ = @import("behavior/bugs/9584.zig"); | 78 | _ = @import("behavior/bugs/9584.zig"); |
| 72 | _ = @import("behavior/bugs/10138.zig"); | 79 | _ = @import("behavior/bugs/10138.zig"); |
| 73 | _ = @import("behavior/bugs/10147.zig"); | 80 | _ = @import("behavior/bugs/10147.zig"); |
| 74 | _ = @import("behavior/bugs/10970.zig"); | 81 | _ = @import("behavior/bugs/10970.zig"); |
| 82 | _ = @import("behavior/bugs/10684.zig"); | ||
| 75 | _ = @import("behavior/bugs/11046.zig"); | 83 | _ = @import("behavior/bugs/11046.zig"); |
| 76 | _ = @import("behavior/bugs/11100.zig"); | 84 | _ = @import("behavior/bugs/11100.zig"); |
| 77 | _ = @import("behavior/bugs/11139.zig"); | 85 | _ = @import("behavior/bugs/11139.zig"); |
| ... | @@ -81,6 +89,7 @@ test { | ... | @@ -81,6 +89,7 @@ test { |
| 81 | _ = @import("behavior/bugs/11179.zig"); | 89 | _ = @import("behavior/bugs/11179.zig"); |
| 82 | _ = @import("behavior/bugs/11181.zig"); | 90 | _ = @import("behavior/bugs/11181.zig"); |
| 83 | _ = @import("behavior/bugs/11213.zig"); | 91 | _ = @import("behavior/bugs/11213.zig"); |
| 92 | _ = @import("behavior/bugs/11787.zig"); | ||
| 84 | _ = @import("behavior/bugs/11816.zig"); | 93 | _ = @import("behavior/bugs/11816.zig"); |
| 85 | _ = @import("behavior/bugs/12003.zig"); | 94 | _ = @import("behavior/bugs/12003.zig"); |
| 86 | _ = @import("behavior/bugs/12025.zig"); | 95 | _ = @import("behavior/bugs/12025.zig"); |
test/behavior/atomics.zig-11| ... | @@ -151,11 +151,6 @@ test "cmpxchg on a global variable" { | ... | @@ -151,11 +151,6 @@ test "cmpxchg on a global variable" { |
| 151 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 151 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 152 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 152 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 153 | 153 | ||
| 154 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { | ||
| 155 | // https://github.com/ziglang/zig/issues/10627 | ||
| 156 | return error.SkipZigTest; | ||
| 157 | } | ||
| 158 | |||
| 159 | _ = @cmpxchgWeak(u32, &a_global_variable, 1234, 42, .Acquire, .Monotonic); | 154 | _ = @cmpxchgWeak(u32, &a_global_variable, 1234, 42, .Acquire, .Monotonic); |
| 160 | try expect(a_global_variable == 42); | 155 | try expect(a_global_variable == 42); |
| 161 | } | 156 | } |
| ... | @@ -218,12 +213,6 @@ test "atomicrmw with floats" { | ... | @@ -218,12 +213,6 @@ test "atomicrmw with floats" { |
| 218 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO | 213 | if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO |
| 219 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 214 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 220 | 215 | ||
| 221 | if ((builtin.zig_backend == .stage2_llvm or builtin.zig_backend == .stage2_c) and | ||
| 222 | builtin.cpu.arch == .aarch64) | ||
| 223 | { | ||
| 224 | // https://github.com/ziglang/zig/issues/10627 | ||
| 225 | return error.SkipZigTest; | ||
| 226 | } | ||
| 227 | try testAtomicRmwFloat(); | 216 | try testAtomicRmwFloat(); |
| 228 | comptime try testAtomicRmwFloat(); | 217 | comptime try testAtomicRmwFloat(); |
| 229 | } | 218 | } |
test/behavior/bugs/10684.zig created+19| ... | @@ -0,0 +1,19 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | const builtin = @import("builtin"); | ||
| 3 | const expectEqualStrings = std.testing.expectEqualStrings; | ||
| 4 | |||
| 5 | test "slicing slices" { | ||
| 6 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | ||
| 7 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | ||
| 8 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO | ||
| 9 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | ||
| 10 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | ||
| 11 | |||
| 12 | const foo = "1234"; | ||
| 13 | const bar = foo[0..4]; | ||
| 14 | try expectEqualStrings("1234", bar); | ||
| 15 | try expectEqualStrings("2", bar[1..2]); | ||
| 16 | try expectEqualStrings("3", bar[2..3]); | ||
| 17 | try expectEqualStrings("4", bar[3..4]); | ||
| 18 | try expectEqualStrings("34", bar[2..4]); | ||
| 19 | } | ||
test/behavior/bugs/11787.zig created+20| ... | @@ -0,0 +1,20 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | const builtin = @import("builtin"); | ||
| 3 | const testing = std.testing; | ||
| 4 | |||
| 5 | test "slicing zero length array field of struct" { | ||
| 6 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | ||
| 7 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | ||
| 8 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO | ||
| 9 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | ||
| 10 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | ||
| 11 | |||
| 12 | const S = struct { | ||
| 13 | a: [0]usize, | ||
| 14 | fn foo(self: *@This(), start: usize, end: usize) []usize { | ||
| 15 | return self.a[start..end]; | ||
| 16 | } | ||
| 17 | }; | ||
| 18 | var s: S = undefined; | ||
| 19 | try testing.expect(s.foo(0, 0).len == 0); | ||
| 20 | } | ||
test/behavior/bugs/2622.zig created+16| ... | @@ -0,0 +1,16 @@ | ||
| 1 | const builtin = @import("builtin"); | ||
| 2 | |||
| 3 | var buf: []u8 = undefined; | ||
| 4 | |||
| 5 | test "reslice of undefined global var slice" { | ||
| 6 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | ||
| 7 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | ||
| 8 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO | ||
| 9 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | ||
| 10 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | ||
| 11 | |||
| 12 | var mem: [100]u8 = [_]u8{0} ** 100; | ||
| 13 | buf = &mem; | ||
| 14 | const x = buf[0..1]; | ||
| 15 | try @import("std").testing.expect(x.len == 1 and x[0] == 0); | ||
| 16 | } | ||
test/behavior/bugs/2727.zig created+18| ... | @@ -0,0 +1,18 @@ | ||
| 1 | const builtin = @import("builtin"); | ||
| 2 | |||
| 3 | fn t() bool { | ||
| 4 | return true; | ||
| 5 | } | ||
| 6 | |||
| 7 | test { | ||
| 8 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | ||
| 9 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | ||
| 10 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO | ||
| 11 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | ||
| 12 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | ||
| 13 | |||
| 14 | comptime var i: usize = 0; | ||
| 15 | inline while (i < 2) : (i += 1) { | ||
| 16 | if (t()) {} else return; | ||
| 17 | } | ||
| 18 | } | ||
test/behavior/bugs/6047.zig created+20| ... | @@ -0,0 +1,20 @@ | ||
| 1 | const builtin = @import("builtin"); | ||
| 2 | |||
| 3 | fn getError() !void { | ||
| 4 | return error.Test; | ||
| 5 | } | ||
| 6 | |||
| 7 | fn getError2() !void { | ||
| 8 | var a: u8 = 'c'; | ||
| 9 | try if (a == 'a') getError() else if (a == 'b') getError() else getError(); | ||
| 10 | } | ||
| 11 | |||
| 12 | test "`try`ing an if/else expression" { | ||
| 13 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | ||
| 14 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | ||
| 15 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO | ||
| 16 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | ||
| 17 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | ||
| 18 | |||
| 19 | try @import("std").testing.expectError(error.Test, getError2()); | ||
| 20 | } | ||
test/behavior/bugs/6905.zig created+23| ... | @@ -0,0 +1,23 @@ | ||
| 1 | const expect = @import("std").testing.expect; | ||
| 2 | const builtin = @import("builtin"); | ||
| 3 | |||
| 4 | test "sentinel-terminated 0-length slices" { | ||
| 5 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | ||
| 6 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | ||
| 7 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO | ||
| 8 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | ||
| 9 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | ||
| 10 | |||
| 11 | var u32s: [4]u32 = [_]u32{ 0, 1, 2, 3 }; | ||
| 12 | |||
| 13 | var index: u8 = 2; | ||
| 14 | var slice = u32s[index..index :2]; | ||
| 15 | var array_ptr = u32s[2..2 :2]; | ||
| 16 | const comptime_known_array_value = u32s[2..2 :2].*; | ||
| 17 | var runtime_array_value = u32s[2..2 :2].*; | ||
| 18 | |||
| 19 | try expect(slice[0] == 2); | ||
| 20 | try expect(array_ptr[0] == 2); | ||
| 21 | try expect(comptime_known_array_value[0] == 2); | ||
| 22 | try expect(runtime_array_value[0] == 2); | ||
| 23 | } | ||
test/behavior/bugs/6947.zig created+16| ... | @@ -0,0 +1,16 @@ | ||
| 1 | const builtin = @import("builtin"); | ||
| 2 | |||
| 3 | fn destroy(ptr: *void) void { | ||
| 4 | _ = ptr; | ||
| 5 | } | ||
| 6 | |||
| 7 | test { | ||
| 8 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | ||
| 9 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | ||
| 10 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO | ||
| 11 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | ||
| 12 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | ||
| 13 | |||
| 14 | var slice: []void = undefined; | ||
| 15 | destroy(&slice[0]); | ||
| 16 | } | ||
test/behavior/bugs/7325.zig created+113| ... | @@ -0,0 +1,113 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | const builtin = @import("builtin"); | ||
| 3 | const testing = std.testing; | ||
| 4 | |||
| 5 | const string = "hello world"; | ||
| 6 | |||
| 7 | const TempRef = struct { | ||
| 8 | index: usize, | ||
| 9 | is_weak: bool, | ||
| 10 | }; | ||
| 11 | |||
| 12 | const BuiltinEnum = struct { | ||
| 13 | name: []const u8, | ||
| 14 | }; | ||
| 15 | |||
| 16 | const ParamType = union(enum) { | ||
| 17 | boolean, | ||
| 18 | buffer, | ||
| 19 | one_of: BuiltinEnum, | ||
| 20 | }; | ||
| 21 | |||
| 22 | const CallArg = struct { | ||
| 23 | value: Expression, | ||
| 24 | }; | ||
| 25 | |||
| 26 | const Expression = union(enum) { | ||
| 27 | literal_boolean: bool, | ||
| 28 | literal_enum_value: EnumLiteral, | ||
| 29 | }; | ||
| 30 | |||
| 31 | const EnumLiteral = struct { | ||
| 32 | label: []const u8, | ||
| 33 | }; | ||
| 34 | |||
| 35 | const ExpressionResult = union(enum) { | ||
| 36 | temp_buffer: TempRef, | ||
| 37 | literal_boolean: bool, | ||
| 38 | literal_enum_value: []const u8, | ||
| 39 | }; | ||
| 40 | |||
| 41 | fn commitCalleeParam(result: ExpressionResult, callee_param_type: ParamType) ExpressionResult { | ||
| 42 | switch (callee_param_type) { | ||
| 43 | .boolean => { | ||
| 44 | return result; | ||
| 45 | }, | ||
| 46 | .buffer => { | ||
| 47 | return ExpressionResult{ | ||
| 48 | .temp_buffer = .{ .index = 0, .is_weak = false }, | ||
| 49 | }; | ||
| 50 | }, | ||
| 51 | .one_of => { | ||
| 52 | return result; | ||
| 53 | }, | ||
| 54 | } | ||
| 55 | } | ||
| 56 | |||
| 57 | fn genExpression(expr: Expression) !ExpressionResult { | ||
| 58 | switch (expr) { | ||
| 59 | .literal_boolean => |value| { | ||
| 60 | return ExpressionResult{ | ||
| 61 | .literal_boolean = value, | ||
| 62 | }; | ||
| 63 | }, | ||
| 64 | .literal_enum_value => |v| { | ||
| 65 | try testing.expectEqualStrings(string, v.label); | ||
| 66 | const result: ExpressionResult = .{ | ||
| 67 | .literal_enum_value = v.label, | ||
| 68 | }; | ||
| 69 | switch (result) { | ||
| 70 | .literal_enum_value => |w| { | ||
| 71 | try testing.expectEqualStrings(string, w); | ||
| 72 | }, | ||
| 73 | else => {}, | ||
| 74 | } | ||
| 75 | return result; | ||
| 76 | }, | ||
| 77 | } | ||
| 78 | } | ||
| 79 | |||
| 80 | test { | ||
| 81 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | ||
| 82 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | ||
| 83 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO | ||
| 84 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | ||
| 85 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | ||
| 86 | |||
| 87 | var param: ParamType = .{ | ||
| 88 | .one_of = .{ .name = "name" }, | ||
| 89 | }; | ||
| 90 | var arg: CallArg = .{ | ||
| 91 | .value = .{ | ||
| 92 | .literal_enum_value = .{ | ||
| 93 | .label = string, | ||
| 94 | }, | ||
| 95 | }, | ||
| 96 | }; | ||
| 97 | |||
| 98 | const result = try genExpression(arg.value); | ||
| 99 | switch (result) { | ||
| 100 | .literal_enum_value => |w| { | ||
| 101 | try testing.expectEqualStrings(string, w); | ||
| 102 | }, | ||
| 103 | else => {}, | ||
| 104 | } | ||
| 105 | |||
| 106 | const derp = commitCalleeParam(result, param); | ||
| 107 | switch (derp) { | ||
| 108 | .literal_enum_value => |w| { | ||
| 109 | try testing.expectEqualStrings(string, w); | ||
| 110 | }, | ||
| 111 | else => {}, | ||
| 112 | } | ||
| 113 | } | ||
test/behavior/bugs/8646.zig created+18| ... | @@ -0,0 +1,18 @@ | ||
| 1 | const std = @import("std"); | ||
| 2 | const builtin = @import("builtin"); | ||
| 3 | |||
| 4 | const array = [_][]const []const u8{ | ||
| 5 | &.{"hello"}, | ||
| 6 | &.{ "world", "hello" }, | ||
| 7 | }; | ||
| 8 | |||
| 9 | test { | ||
| 10 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | ||
| 11 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | ||
| 12 | if (builtin.zig_backend == .stage2_x86) return error.SkipZigTest; // TODO | ||
| 13 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | ||
| 14 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | ||
| 15 | |||
| 16 | try std.testing.expect(array[0].len == 1); | ||
| 17 | try std.testing.expectEqualStrings("hello", array[0][0]); | ||
| 18 | } | ||
test/behavior/int128.zig+5| ... | @@ -53,6 +53,11 @@ test "int128" { | ... | @@ -53,6 +53,11 @@ test "int128" { |
| 53 | 53 | ||
| 54 | buff = -0x12341234123412341234123412341234; | 54 | buff = -0x12341234123412341234123412341234; |
| 55 | try expect(-buff == 0x12341234123412341234123412341234); | 55 | try expect(-buff == 0x12341234123412341234123412341234); |
| 56 | |||
| 57 | const a: i128 = -170141183460469231731687303715884105728; | ||
| 58 | const b: i128 = -0x8000_0000_0000_0000_0000_0000_0000_0000; | ||
| 59 | try expect(@divFloor(b, 1_000_000) == -170141183460469231731687303715885); | ||
| 60 | try expect(a == b); | ||
| 56 | } | 61 | } |
| 57 | 62 | ||
| 58 | test "truncate int128" { | 63 | test "truncate int128" { |
test/behavior/math.zig-6| ... | @@ -161,12 +161,6 @@ test "@ctz vectors" { | ... | @@ -161,12 +161,6 @@ test "@ctz vectors" { |
| 161 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 161 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 162 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 162 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 163 | 163 | ||
| 164 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { | ||
| 165 | // This regressed with LLVM 14: | ||
| 166 | // https://github.com/ziglang/zig/issues/12013 | ||
| 167 | return error.SkipZigTest; | ||
| 168 | } | ||
| 169 | |||
| 170 | try testCtzVectors(); | 164 | try testCtzVectors(); |
| 171 | comptime try testCtzVectors(); | 165 | comptime try testCtzVectors(); |
| 172 | } | 166 | } |
test/behavior/vector.zig-6| ... | @@ -174,12 +174,6 @@ test "tuple to vector" { | ... | @@ -174,12 +174,6 @@ test "tuple to vector" { |
| 174 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 174 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 175 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 175 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 176 | 176 | ||
| 177 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) { | ||
| 178 | // Regressed with LLVM 14: | ||
| 179 | // https://github.com/ziglang/zig/issues/12012 | ||
| 180 | return error.SkipZigTest; | ||
| 181 | } | ||
| 182 | |||
| 183 | const S = struct { | 177 | const S = struct { |
| 184 | fn doTheTest() !void { | 178 | fn doTheTest() !void { |
| 185 | const Vec3 = @Vector(3, i32); | 179 | const Vec3 = @Vector(3, i32); |
test/behavior/widening.zig-4| ... | @@ -60,10 +60,6 @@ test "float widening f16 to f128" { | ... | @@ -60,10 +60,6 @@ test "float widening f16 to f128" { |
| 60 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO | 60 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO |
| 61 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 61 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 62 | 62 | ||
| 63 | // TODO https://github.com/ziglang/zig/issues/3282 | ||
| 64 | if (builtin.cpu.arch == .aarch64) return error.SkipZigTest; | ||
| 65 | if (builtin.cpu.arch == .powerpc64le) return error.SkipZigTest; | ||
| 66 | |||
| 67 | var x: f16 = 12.34; | 63 | var x: f16 = 12.34; |
| 68 | var y: f128 = x; | 64 | var y: f128 = x; |
| 69 | try expect(x == y); | 65 | try expect(x == y); |
test/cases/compile_errors/invalid_store_to_comptime_field.zig+11-2| ... | @@ -41,7 +41,7 @@ pub export fn entry4() void { | ... | @@ -41,7 +41,7 @@ pub export fn entry4() void { |
| 41 | _ = U.foo(.{ .foo = 2, .bar = 2 }); | 41 | _ = U.foo(.{ .foo = 2, .bar = 2 }); |
| 42 | } | 42 | } |
| 43 | pub export fn entry5() void { | 43 | pub export fn entry5() void { |
| 44 | comptime var y = .{ 1, 2}; | 44 | comptime var y = .{ 1, 2 }; |
| 45 | y = .{ 3, 4 }; | 45 | y = .{ 3, 4 }; |
| 46 | } | 46 | } |
| 47 | // pub export fn entry5() void { | 47 | // pub export fn entry5() void { |
| ... | @@ -52,7 +52,15 @@ pub export fn entry5() void { | ... | @@ -52,7 +52,15 @@ pub export fn entry5() void { |
| 52 | // }; | 52 | // }; |
| 53 | // _ = S.foo(.{ -1234, 5679, x }); | 53 | // _ = S.foo(.{ -1234, 5679, x }); |
| 54 | // } | 54 | // } |
| 55 | 55 | pub export fn entry6() void { | |
| 56 | const State = struct { | ||
| 57 | comptime id: bool = true, | ||
| 58 | fn init(comptime id: bool) @This() { | ||
| 59 | return @This(){ .id = id }; | ||
| 60 | } | ||
| 61 | }; | ||
| 62 | _ = State.init(false); | ||
| 63 | } | ||
| 56 | 64 | ||
| 57 | // error | 65 | // error |
| 58 | // target=native | 66 | // target=native |
| ... | @@ -65,3 +73,4 @@ pub export fn entry5() void { | ... | @@ -65,3 +73,4 @@ pub export fn entry5() void { |
| 65 | // :25:29: note: default value set here | 73 | // :25:29: note: default value set here |
| 66 | // :41:16: error: value stored in comptime field does not match the default value of the field | 74 | // :41:16: error: value stored in comptime field does not match the default value of the field |
| 67 | // :45:12: error: value stored in comptime field does not match the default value of the field | 75 | // :45:12: error: value stored in comptime field does not match the default value of the field |
| 76 | // :59:35: error: value stored in comptime field does not match the default value of the field |