diff options
Diffstat (limited to 'test/cases/void.zig')
| -rw-r--r-- | test/cases/void.zig | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/cases/void.zig b/test/cases/void.zig index f4d72209e4..7121ac664b 100644 --- a/test/cases/void.zig +++ b/test/cases/void.zig @@ -8,7 +8,7 @@ const Foo = struct { test "compare void with void compile time known" { comptime { - const foo = Foo { + const foo = Foo{ .a = {}, .b = 1, .c = {}, @@ -16,3 +16,15 @@ test "compare void with void compile time known" { assert(foo.a == {}); } } + +test "iterate over a void slice" { + var j: usize = 0; + for (times(10)) |_, i| { + assert(i == j); + j += 1; + } +} + +fn times(n: usize) []const void { + return ([*]void)(undefined)[0..n]; +} |
