Commit 0b7347fd18

Andrew Kelley <andrew@ziglang.org>
2022-02-13 05:35:29
move more behavior tests to the "passing" section
1 parent c349191
test/behavior/fn_delegation.zig
@@ -1,3 +1,4 @@
+const builtin = @import("builtin");
 const expect = @import("std").testing.expect;
 
 const Foo = struct {
@@ -31,6 +32,8 @@ fn custom(comptime T: type, comptime num: u64) fn (T) u64 {
 }
 
 test "fn delegation" {
+    if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
+
     const foo = Foo{};
     try expect(foo.one() == 11);
     try expect(foo.two() == 12);
test/behavior/ir_block_deps.zig
@@ -1,3 +1,4 @@
+const builtin = @import("builtin");
 const expect = @import("std").testing.expect;
 
 fn foo(id: u64) !i32 {
@@ -17,6 +18,9 @@ fn getErrInt() anyerror!i32 {
 }
 
 test "ir block deps" {
+    if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
+    if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
+
     try expect((foo(1) catch unreachable) == 0);
     try expect((foo(2) catch unreachable) == 0);
 }
test/behavior/reflection.zig
@@ -1,9 +1,12 @@
+const builtin = @import("builtin");
 const std = @import("std");
 const expect = std.testing.expect;
 const mem = std.mem;
 const reflection = @This();
 
 test "reflection: function return type, var args, and param types" {
+    if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
+
     comptime {
         const info = @typeInfo(@TypeOf(dummy)).Fn;
         try expect(info.return_type.? == i32);
@@ -25,6 +28,9 @@ fn dummy(a: bool, b: i32, c: f32) i32 {
 }
 
 test "reflection: @field" {
+    if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
+    if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO
+
     var f = Foo{
         .one = 42,
         .two = true,
test/behavior/tuple.zig
@@ -1,9 +1,12 @@
+const builtin = @import("builtin");
 const std = @import("std");
 const testing = std.testing;
 const expect = testing.expect;
 const expectEqual = testing.expectEqual;
 
 test "tuple concatenation" {
+    if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
+
     const S = struct {
         fn doTheTest() !void {
             var a: i32 = 1;
@@ -20,6 +23,8 @@ test "tuple concatenation" {
 }
 
 test "tuple multiplication" {
+    if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
+
     const S = struct {
         fn doTheTest() !void {
             {
@@ -81,6 +86,8 @@ test "tuple multiplication" {
 }
 
 test "pass tuple to comptime var parameter" {
+    if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
+
     const S = struct {
         fn Foo(comptime args: anytype) !void {
             try expect(args[0] == 1);
@@ -95,6 +102,8 @@ test "pass tuple to comptime var parameter" {
 }
 
 test "tuple initializer for var" {
+    if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
+
     const S = struct {
         fn doTheTest() void {
             const Bytes = struct {
@@ -114,6 +123,8 @@ test "tuple initializer for var" {
 }
 
 test "array-like initializer for tuple types" {
+    if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
+
     const T = @Type(std.builtin.TypeInfo{
         .Struct = std.builtin.TypeInfo.Struct{
             .is_tuple = true,
test/behavior/union.zig
@@ -362,7 +362,7 @@ pub const FooUnion = union(enum) {
 var glbl_array: [2]FooUnion = undefined;
 
 test "initialize global array of union" {
-    if (@import("builtin").zig_backend == .stage2_wasm) return error.SkipZigTest;
+    if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest;
 
     glbl_array[1] = FooUnion{ .U1 = 2 };
     glbl_array[0] = FooUnion{ .U0 = 1 };
test/behavior/var_args.zig
@@ -1,3 +1,4 @@
+const builtin = @import("builtin");
 const expect = @import("std").testing.expect;
 
 fn add(args: anytype) i32 {
@@ -12,6 +13,8 @@ fn add(args: anytype) i32 {
 }
 
 test "add arbitrary args" {
+    if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
+
     try expect(add(.{ @as(i32, 1), @as(i32, 2), @as(i32, 3), @as(i32, 4) }) == 10);
     try expect(add(.{@as(i32, 1234)}) == 1234);
     try expect(add(.{}) == 0);
@@ -22,10 +25,16 @@ fn readFirstVarArg(args: anytype) void {
 }
 
 test "send void arg to var args" {
+    if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
+    if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
+    if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
+
     readFirstVarArg(.{{}});
 }
 
 test "pass args directly" {
+    if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
+
     try expect(addSomeStuff(.{ @as(i32, 1), @as(i32, 2), @as(i32, 3), @as(i32, 4) }) == 10);
     try expect(addSomeStuff(.{@as(i32, 1234)}) == 1234);
     try expect(addSomeStuff(.{}) == 0);
@@ -36,6 +45,8 @@ fn addSomeStuff(args: anytype) i32 {
 }
 
 test "runtime parameter before var args" {
+    if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
+
     try expect((try extraFn(10, .{})) == 0);
     try expect((try extraFn(10, .{false})) == 1);
     try expect((try extraFn(10, .{ false, true })) == 2);
@@ -73,11 +84,19 @@ fn foo2(args: anytype) bool {
 }
 
 test "array of var args functions" {
+    if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
+    if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
+    if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
+
     try expect(foos[0](.{}));
     try expect(!foos[1](.{}));
 }
 
 test "pass zero length array to var args param" {
+    if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
+    if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO
+    if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
+
     doNothingWithFirstArg(.{""});
 }
 
test/behavior.zig
@@ -31,18 +31,23 @@ test {
     _ = @import("behavior/bugs/7250.zig");
     _ = @import("behavior/cast.zig");
     _ = @import("behavior/comptime_memory.zig");
+    _ = @import("behavior/fn_delegation.zig");
     _ = @import("behavior/fn_in_struct_in_comptime.zig");
     _ = @import("behavior/hasdecl.zig");
     _ = @import("behavior/hasfield.zig");
+    _ = @import("behavior/ir_block_deps.zig");
     _ = @import("behavior/namespace_depends_on_compile_var.zig");
     _ = @import("behavior/optional.zig");
     _ = @import("behavior/prefetch.zig");
     _ = @import("behavior/pub_enum.zig");
+    _ = @import("behavior/reflection.zig");
     _ = @import("behavior/slice.zig");
     _ = @import("behavior/slice_sentinel_comptime.zig");
-    _ = @import("behavior/type.zig");
-    _ = @import("behavior/truncate.zig");
     _ = @import("behavior/struct.zig");
+    _ = @import("behavior/truncate.zig");
+    _ = @import("behavior/tuple.zig");
+    _ = @import("behavior/type.zig");
+    _ = @import("behavior/var_args.zig");
 
     if (builtin.zig_backend != .stage2_arm and builtin.zig_backend != .stage2_x86_64) {
         // Tests that pass (partly) for stage1, llvm backend, C backend, wasm backend.
@@ -145,21 +150,16 @@ test {
                     _ = @import("behavior/const_slice_child.zig");
                     _ = @import("behavior/export_self_referential_type_info.zig");
                     _ = @import("behavior/field_parent_ptr.zig");
-                    _ = @import("behavior/fn_delegation.zig");
-                    _ = @import("behavior/ir_block_deps.zig");
                     _ = @import("behavior/misc.zig");
                     _ = @import("behavior/muladd.zig");
-                    _ = @import("behavior/reflection.zig");
                     _ = @import("behavior/select.zig");
                     _ = @import("behavior/shuffle.zig");
                     _ = @import("behavior/struct_contains_null_ptr_itself.zig");
                     _ = @import("behavior/struct_contains_slice_of_itself.zig");
                     _ = @import("behavior/switch_prong_err_enum.zig");
                     _ = @import("behavior/switch_prong_implicit_cast.zig");
-                    _ = @import("behavior/tuple.zig");
                     _ = @import("behavior/typename.zig");
                     _ = @import("behavior/union_with_members.zig");
-                    _ = @import("behavior/var_args.zig");
                     _ = @import("behavior/vector.zig");
                     if (builtin.target.cpu.arch == .wasm32) {
                         _ = @import("behavior/wasm.zig");