aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/tuple.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-02-28 10:09:23 +0200
committerAndrew Kelley <andrew@ziglang.org>2022-02-28 13:09:14 -0700
commitdfeffcfbf825c29d89ccec281ab95dd2383317ac (patch)
tree64b86ad830e83fea4b1acf27e5aef17e265f66f4 /test/behavior/tuple.zig
parent3a65fa269f476ecb9dafd8be77ee9f9c0c4ba996 (diff)
downloadzig-dfeffcfbf825c29d89ccec281ab95dd2383317ac.tar.gz
zig-dfeffcfbf825c29d89ccec281ab95dd2383317ac.zip
stage2: tuple mul/cat
Diffstat (limited to 'test/behavior/tuple.zig')
-rw-r--r--test/behavior/tuple.zig18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/behavior/tuple.zig b/test/behavior/tuple.zig
index 680de28b76..2f4b85d0bc 100644
--- a/test/behavior/tuple.zig
+++ b/test/behavior/tuple.zig
@@ -23,28 +23,30 @@ test "tuple concatenation" {
}
test "tuple multiplication" {
- if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
-
const S = struct {
fn doTheTest() !void {
{
const t = .{} ** 4;
- try expectEqual(0, @typeInfo(@TypeOf(t)).Struct.fields.len);
+ try expect(@typeInfo(@TypeOf(t)).Struct.fields.len == 0);
}
{
const t = .{'a'} ** 4;
- try expectEqual(4, @typeInfo(@TypeOf(t)).Struct.fields.len);
- inline for (t) |x| try expectEqual('a', x);
+ try expect(@typeInfo(@TypeOf(t)).Struct.fields.len == 4);
+ inline for (t) |x| try expect(x == 'a');
}
{
const t = .{ 1, 2, 3 } ** 4;
- try expectEqual(12, @typeInfo(@TypeOf(t)).Struct.fields.len);
- inline for (t) |x, i| try expectEqual(1 + i % 3, x);
+ try expect(@typeInfo(@TypeOf(t)).Struct.fields.len == 12);
+ inline for (t) |x, i| try expect(x == 1 + i % 3);
}
}
};
try S.doTheTest();
comptime try S.doTheTest();
+}
+
+test "tuple concatenation" {
+ if (builtin.zig_backend != .stage1) return error.SkipZigTest; // TODO
const T = struct {
fn consume_tuple(tuple: anytype, len: usize) !void {
@@ -86,8 +88,6 @@ 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);