aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/struct.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2022-02-01 21:55:34 +0100
committerJakub Konka <kubkon@jakubkonka.com>2022-02-02 10:48:21 +0100
commit521bd2e94a3b32382b2d1de1e6185149032b49db (patch)
tree8e7983f584d73ba60757b72283a0cb58cd3881d6 /test/behavior/struct.zig
parent0cccd8a88762dde3995702020dd3c39771cf8fd4 (diff)
downloadzig-521bd2e94a3b32382b2d1de1e6185149032b49db.tar.gz
zig-521bd2e94a3b32382b2d1de1e6185149032b49db.zip
x86_64: pass more behaviour tests
Diffstat (limited to 'test/behavior/struct.zig')
-rw-r--r--test/behavior/struct.zig24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/behavior/struct.zig b/test/behavior/struct.zig
index 7ff67e1c90..e25f862e41 100644
--- a/test/behavior/struct.zig
+++ b/test/behavior/struct.zig
@@ -9,6 +9,8 @@ const maxInt = std.math.maxInt;
top_level_field: i32,
test "top level fields" {
+ if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
var instance = @This(){
.top_level_field = 1234,
};
@@ -29,6 +31,8 @@ const StructFoo = struct {
};
test "structs" {
+ if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
var foo: StructFoo = undefined;
@memset(@ptrCast([*]u8, &foo), 0, @sizeOf(StructFoo));
foo.a += 1;
@@ -45,6 +49,8 @@ fn testMutation(foo: *StructFoo) void {
}
test "struct byval assign" {
+ if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
var foo1: StructFoo = undefined;
var foo2: StructFoo = undefined;
@@ -56,6 +62,8 @@ test "struct byval assign" {
}
test "call struct static method" {
+ if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
const result = StructWithNoFields.add(3, 4);
try expect(result == 7);
}
@@ -85,6 +93,8 @@ const Val = struct {
};
test "fn call of struct field" {
+ if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
const Foo = struct {
ptr: fn () i32,
};
@@ -114,12 +124,16 @@ const MemberFnTestFoo = struct {
};
test "call member function directly" {
+ if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
const instance = MemberFnTestFoo{ .x = 1234 };
const result = MemberFnTestFoo.member(instance);
try expect(result == 1234);
}
test "store member function in variable" {
+ if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
const instance = MemberFnTestFoo{ .x = 1234 };
const memberFn = MemberFnTestFoo.member;
const result = memberFn(instance);
@@ -127,6 +141,8 @@ test "store member function in variable" {
}
test "member functions" {
+ if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
const r = MemberFnRand{ .seed = 1234 };
try expect(r.getSeed() == 1234);
}
@@ -138,6 +154,8 @@ const MemberFnRand = struct {
};
test "return struct byval from function" {
+ if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
const bar = makeBar2(1234, 5678);
try expect(bar.y == 5678);
}
@@ -153,6 +171,8 @@ fn makeBar2(x: i32, y: i32) Bar {
}
test "call method with mutable reference to struct with no fields" {
+ if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
const S = struct {
fn doC(s: *const @This()) bool {
_ = s;
@@ -172,6 +192,8 @@ test "call method with mutable reference to struct with no fields" {
}
test "usingnamespace within struct scope" {
+ if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
const S = struct {
usingnamespace struct {
pub fn inner() i32 {
@@ -183,6 +205,8 @@ test "usingnamespace within struct scope" {
}
test "struct field init with catch" {
+ if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
+
const S = struct {
fn doTheTest() !void {
var x: anyerror!isize = 1;