diff options
| author | Luuk de Gram <luuk@degram.dev> | 2022-02-03 22:25:46 +0100 |
|---|---|---|
| committer | Luuk de Gram <luuk@degram.dev> | 2022-02-03 22:31:29 +0100 |
| commit | 588b88b98753f02061e562a9c15c2396bcd95dee (patch) | |
| tree | 2d7a80c842558608392926cf1ddd244fcdf2cd6c /test/behavior/slice.zig | |
| parent | e35414bf5c356798f201be85303101f59220326c (diff) | |
| download | zig-588b88b98753f02061e562a9c15c2396bcd95dee.tar.gz zig-588b88b98753f02061e562a9c15c2396bcd95dee.zip | |
Move passing behavior tests
Singular tests (such as in the bug ones) are moved to top level with exclusions for non-passing backends.
The big behavior tests such as array_llvm and slice are moved to the inner scope with the C backend disabled.
They all pass for the wasm backend now
Diffstat (limited to 'test/behavior/slice.zig')
| -rw-r--r-- | test/behavior/slice.zig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/behavior/slice.zig b/test/behavior/slice.zig index 01ae10ee4e..0b01139800 100644 --- a/test/behavior/slice.zig +++ b/test/behavior/slice.zig @@ -27,6 +27,7 @@ comptime { } test "slicing" { + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO var array: [20]i32 = undefined; array[5] = 1234; @@ -43,6 +44,7 @@ test "slicing" { } test "const slice" { + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO comptime { const a = "1234567890"; try expect(a.len == 10); @@ -53,6 +55,7 @@ test "const slice" { } test "comptime slice of undefined pointer of length 0" { + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO const slice1 = @as([*]i32, undefined)[0..0]; try expect(slice1.len == 0); const slice2 = @as([*]i32, undefined)[100..100]; @@ -60,6 +63,7 @@ test "comptime slice of undefined pointer of length 0" { } test "implicitly cast array of size 0 to slice" { + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO var msg = [_]u8{}; try assertLenIsZero(&msg); } @@ -69,6 +73,7 @@ fn assertLenIsZero(msg: []const u8) !void { } test "access len index of sentinel-terminated slice" { + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO const S = struct { fn doTheTest() !void { var slice: [:0]const u8 = "hello"; @@ -82,6 +87,7 @@ test "access len index of sentinel-terminated slice" { } test "comptime slice of slice preserves comptime var" { + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO comptime { var buff: [10]u8 = undefined; buff[0..][0..][0] = 1; @@ -90,6 +96,7 @@ test "comptime slice of slice preserves comptime var" { } test "slice of type" { + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO comptime { var types_array = [_]type{ i32, f64, type }; for (types_array) |T, i| { @@ -112,6 +119,7 @@ test "slice of type" { } test "generic malloc free" { + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO const a = memAlloc(u8, 10) catch unreachable; memFree(u8, a); } @@ -124,6 +132,7 @@ fn memFree(comptime T: type, memory: []T) void { } test "slice of hardcoded address to pointer" { + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO const S = struct { fn doTheTest() !void { const pointer = @intToPtr([*]u8, 0x04)[0..2]; @@ -138,6 +147,7 @@ test "slice of hardcoded address to pointer" { } test "comptime slice of pointer preserves comptime var" { + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO comptime { var buff: [10]u8 = undefined; var a = @ptrCast([*]u8, &buff); @@ -147,6 +157,7 @@ test "comptime slice of pointer preserves comptime var" { } test "comptime pointer cast array and then slice" { + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO const array = [_]u8{ 1, 2, 3, 4, 5, 6, 7, 8 }; const ptrA: [*]const u8 = @ptrCast([*]const u8, &array); @@ -160,6 +171,7 @@ test "comptime pointer cast array and then slice" { } test "slicing zero length array" { + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO const s1 = ""[0..]; const s2 = ([_]u32{})[0..]; try expect(s1.len == 0); @@ -171,6 +183,7 @@ test "slicing zero length array" { const x = @intToPtr([*]i32, 0x1000)[0..0x500]; const y = x[0x100..]; test "compile time slice of pointer to hard coded address" { + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO if (builtin.zig_backend == .stage1) return error.SkipZigTest; try expect(@ptrToInt(x) == 0x1000); |
