clean up behavior tests

Split big test into the two separate things it is testing.
Add missing checks to the test which revealed the test is not actually
passing yet for the C backend.
This commit is contained in:
Andrew Kelley 2022-04-22 07:52:21 -07:00
parent c992b25908
commit 0e830b1630
2 changed files with 24 additions and 12 deletions

View File

@ -163,9 +163,9 @@ test "nested arrays of strings" {
}
test "nested arrays of integers" {
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
const array_of_numbers = [_][2]u8{
[2]u8{ 1, 2 },

View File

@ -349,9 +349,9 @@ fn numberLiteralArg(a: anytype) !void {
}
test "function call with anon list literal" {
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
const S = struct {
fn doTheTest() !void {
@ -363,19 +363,31 @@ test "function call with anon list literal" {
try expect(vec[1] == 8);
try expect(vec[2] == 7);
}
};
try S.doTheTest();
comptime try S.doTheTest();
}
fn doThe2DTest() !void {
try consume2DVec(.{ .{ 9, 8 }, .{ 7, 6 } });
test "function call with anon list literal - 2D" {
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
const S = struct {
fn doTheTest() !void {
try consumeVec(.{ .{ 9, 8 }, .{ 7, 6 } });
}
fn consume2DVec(vec: [2][2]f32) !void {
_ = vec;
fn consumeVec(vec: [2][2]f32) !void {
try expect(vec[0][0] == 9);
try expect(vec[0][1] == 8);
try expect(vec[1][0] == 7);
try expect(vec[1][1] == 6);
}
};
try S.doTheTest();
comptime try S.doTheTest();
try S.doThe2DTest();
comptime try S.doThe2DTest();
}
test "ability to give comptime types and non comptime types to same parameter" {