aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-11-03 14:13:57 -0400
committerAndrew Kelley <superjoe30@gmail.com>2016-11-03 14:13:57 -0400
commitc8333d0cc9a2941ea35f1202073dabd9058beebc (patch)
tree4af6d5e7611cfb3b1f24626a5c8618bde7550f78 /test
parent1a0111d4c36578b64d8532724afd9be9ca61d3d1 (diff)
downloadzig-c8333d0cc9a2941ea35f1202073dabd9058beebc.tar.gz
zig-c8333d0cc9a2941ea35f1202073dabd9058beebc.zip
add concept of inline for, inline while, inline var
Diffstat (limited to 'test')
-rw-r--r--test/self_hosted2.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/self_hosted2.zig b/test/self_hosted2.zig
new file mode 100644
index 0000000000..ba1171b57b
--- /dev/null
+++ b/test/self_hosted2.zig
@@ -0,0 +1,13 @@
+fn add(a: i32, b: i32) -> i32 {
+ a + b
+}
+
+fn assert(ok: bool) {
+ if (!ok) @unreachable();
+}
+
+fn testAdd() {
+ @setFnTest(this, true);
+
+ assert(add(2, 3) == 5);
+}