diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-02-05 17:15:19 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-02-05 17:15:19 -0700 |
| commit | 4339d555626197f4b8c9598b602f098b76488c2d (patch) | |
| tree | 2773f3dbace6d3603f7fddaddee8f2683b645d37 /test/run_tests.cpp | |
| parent | 4208435f662030abf24929c90a4bb8c7fb0d2908 (diff) | |
| download | zig-4339d555626197f4b8c9598b602f098b76488c2d.tar.gz zig-4339d555626197f4b8c9598b602f098b76488c2d.zip | |
update for loop syntax
it matches more closely the %% binary operator syntax
See #51
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index f0c3a77871..7c70528d3b 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -1120,20 +1120,20 @@ import "std.zig"; pub fn main(args: [][]u8) -> %void { const array = []u8 {9, 8, 7, 6}; - for (item, array) { + for (array) |item| { %%stdout.print_u64(item); %%stdout.printf("\n"); } - for (item, array, index) { + for (array) |item, index| { %%stdout.print_i64(index); %%stdout.printf("\n"); } const unknown_size: []u8 = array; - for (item, unknown_size) { + for (unknown_size) |item| { %%stdout.print_u64(item); %%stdout.printf("\n"); } - for (item, unknown_size, index) { + for (unknown_size) |item, index| { %%stdout.print_i64(index); %%stdout.printf("\n"); } @@ -1145,7 +1145,7 @@ import "std.zig"; pub fn main(args: [][]u8) -> %void { const fns = []@typeof(fn1) { fn1, fn2, fn3, fn4, }; - for (f, fns) { + for (fns) |f| { %%stdout.print_u64(f()); %%stdout.printf("\n"); } @@ -1434,7 +1434,7 @@ export fn main(args: c_int, argv: &&u8) -> c_int { qsort((&c_void)(array.ptr), c_ulong(array.len), @sizeof(i32), compare_fn); - for (item, array, i) { + for (array) |item, i| { if (item != i) { abort(); } |
