aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/slice.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-02-03 20:23:46 -0500
committerGitHub <noreply@github.com>2022-02-03 20:23:46 -0500
commit71e0cca7a7957e2f024d2985318e478aa6fb1451 (patch)
tree8a85869adb92126d3fbaca52d4b0c0607ef3d7de /test/behavior/slice.zig
parent4ca9a8d192f4c800f10cdb3bd39c94922b6fb9b8 (diff)
parent588b88b98753f02061e562a9c15c2396bcd95dee (diff)
downloadzig-71e0cca7a7957e2f024d2985318e478aa6fb1451.tar.gz
zig-71e0cca7a7957e2f024d2985318e478aa6fb1451.zip
Merge pull request #10780 from Luukdegram/wasm-behavior-tests
stage2: Wasm - Account for stack alignment
Diffstat (limited to 'test/behavior/slice.zig')
-rw-r--r--test/behavior/slice.zig13
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);