diff options
| author | Josh Wolfe <thejoshwolfe@gmail.com> | 2015-12-03 14:33:13 -0700 |
|---|---|---|
| committer | Josh Wolfe <thejoshwolfe@gmail.com> | 2015-12-03 14:33:13 -0700 |
| commit | 174e58a05f94eaee6e04e858d916d28d3f5be3b7 (patch) | |
| tree | e1874cec31c6f8aeafc1d4025485d1562b59a3f6 /test/run_tests.cpp | |
| parent | f4b9b03f5426a1e0804714f4d58c09e6c4d0c689 (diff) | |
| download | zig-174e58a05f94eaee6e04e858d916d28d3f5be3b7.tar.gz zig-174e58a05f94eaee6e04e858d916d28d3f5be3b7.zip | |
test for void parameters
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 3f5dd6d69c..6d32322ede 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -311,6 +311,26 @@ export fn _start() -> unreachable { exit(0); } )SOURCE", "OK 1\nOK 2\n"); + + add_simple_case("void parameters", R"SOURCE( +#link("c") +extern { + fn puts(s: *const u8) -> i32; + fn exit(code: i32) -> unreachable; +} + +export fn _start() -> unreachable { + void_fun(1, void, 2); + exit(0); +} + +fn void_fun(a : i32, b : void, c : i32) { + let v = b; + let vv : void = if (a == 1) {v} else {}; + if (a + c == 3) { puts("OK"); } + return vv; +} + )SOURCE", "OK\n"); } static void add_compile_failure_test_cases(void) { |
