add passing for loop test: two counters

This commit is contained in:
Andrew Kelley
2023-02-18 10:30:48 -07:00
parent f2a6a1756b
commit b6a5e52dec

View File

@@ -261,3 +261,16 @@ test "count over fixed range" {
try expect(sum == 15);
}
test "two counters" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
var sum: usize = 0;
for (0..10, 10..20) |i, j| {
sum += 1;
try expect(i + 10 == j);
}
try expect(sum == 10);
}