zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 14422e0312b3df271bfb60e8a6233afb128354fc (tree)
parent 6b2d06710c52c348aa01b62007a2e990b47eee72
Author: Andrew Kelley <superjoe30@gmail.com>
Date:   Mon, 19 Dec 2016 00:53:18 -0500

organize tests

Diffstat:
Dtest/cases3/disabled_export.zig | 8--------
Dtest/cases3/empty_fn_with_comments.zig | 6------
Mtest/cases3/generics.zig | 10++++++++++
Dtest/cases3/inlined_loop.zig | 16----------------
Mtest/cases3/misc.zig | 17+++++++++++++++++
Mtest/self_hosted3.zig | 3---
6 files changed, 27 insertions(+), 33 deletions(-)

diff --git a/test/cases3/disabled_export.zig b/test/cases3/disabled_export.zig @@ -1,8 +0,0 @@ -export fn disabledExternFn() { - @setFnVisible(this, false); -} - -fn callDisabledExternFn() { - @setFnTest(this); - disabledExternFn(); -} diff --git a/test/cases3/empty_fn_with_comments.zig b/test/cases3/empty_fn_with_comments.zig @@ -1,6 +0,0 @@ -// normal comment -/// this is a documentation comment -/// doc comment line 2 -fn emptyFunctionWithComments() { - @setFnTest(this); -} diff --git a/test/cases3/generics.zig b/test/cases3/generics.zig @@ -40,6 +40,16 @@ fn fnWithInlineArgs() { assert(sameButWithFloats(0.43, 0.49) == 0.49); } +fn inlinedLoop() { + @setFnTest(this); + + inline var i = 0; + inline var sum = 0; + inline while (i <= 5; i += 1) + sum += i; + assert(sum == 15); +} + // TODO const assert = @import("std").debug.assert; fn assert(ok: bool) { diff --git a/test/cases3/inlined_loop.zig b/test/cases3/inlined_loop.zig @@ -1,16 +0,0 @@ - -fn inlinedLoop() { - @setFnTest(this); - - inline var i = 0; - inline var sum = 0; - inline while (i <= 5; i += 1) - sum += i; - assert(sum == 15); -} - -// TODO const assert = @import("std").debug.assert; -fn assert(ok: bool) { - if (!ok) - @unreachable(); -} diff --git a/test/cases3/misc.zig b/test/cases3/misc.zig @@ -1,3 +1,20 @@ +// normal comment +/// this is a documentation comment +/// doc comment line 2 +fn emptyFunctionWithComments() { + @setFnTest(this); +} + +export fn disabledExternFn() { + @setFnVisible(this, false); +} + +fn callDisabledExternFn() { + @setFnTest(this); + + disabledExternFn(); +} + fn intTypeBuiltin() { @setFnTest(this); diff --git a/test/self_hosted3.zig b/test/self_hosted3.zig @@ -1,7 +1,4 @@ // TODO '_' identifier for unused variable bindings -const test_empty_fn_with_comments = @import("cases3/empty_fn_with_comments.zig"); -const test_disabled_export = @import("cases3/disabled_export.zig"); -const test_inlined_loop = @import("cases3/inlined_loop.zig"); const test_misc = @import("cases3/misc.zig"); const test_switch = @import("cases3/switch.zig"); const test_error = @import("cases3/error.zig");