diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-01-07 03:23:38 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-01-07 03:23:38 -0700 |
| commit | a3c97081ca37a6f78732c9a5f2244cef5a11cb07 (patch) | |
| tree | aec69a113eacaa084039364b65ef803d695e0dd5 /test/run_tests.cpp | |
| parent | 9b9fd5ad23e37d1e2b37b05b168abcfd53f4629d (diff) | |
| download | zig-a3c97081ca37a6f78732c9a5f2244cef5a11cb07.tar.gz zig-a3c97081ca37a6f78732c9a5f2244cef5a11cb07.zip | |
add ?? maybe unwrapping binary operator
add null literal
fix number literal / maybe interactions
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index c41832e47d..1038983d2e 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -710,7 +710,7 @@ pub fn main(argc : isize, argv : &&u8, env : &&u8) -> i32 { add_simple_case("maybe type", R"SOURCE( use "std.zig"; -pub fn main(argc : isize, argv : &&u8, env : &&u8) -> i32 { +pub fn main(argc: isize, argv: &&u8, env: &&u8) -> i32 { const x : ?bool = true; if (const y ?= x) { @@ -722,6 +722,23 @@ pub fn main(argc : isize, argv : &&u8, env : &&u8) -> i32 { } else { print_str("x is none\n"); } + + const next_x : ?i32 = null; + + const z = next_x ?? 1234; + + if (z != 1234) { + print_str("BAD\n"); + } + + const final_x : ?i32 = 13; + + const num = final_x ?? unreachable; + + if (num != 13) { + print_str("BAD\n"); + } + return 0; } )SOURCE", "x is true\n"); |
