Commit 0e830b1630

Andrew Kelley <andrew@ziglang.org>
2022-04-22 16:52:21
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.
1 parent c992b25
Changed files (2)
test
test/behavior/array.zig
@@ -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 },
test/behavior/fn.zig
@@ -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();
+}
+
+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
 
-        fn doThe2DTest() !void {
-            try consume2DVec(.{ .{ 9, 8 }, .{ 7, 6 } });
+    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" {