diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-01-02 00:06:06 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-01-02 00:06:06 -0700 |
| commit | 9a8851515b8aeac1adcea38094a45e3260e7522c (patch) | |
| tree | dc1671648ae9ce7ab065ca36e012c4625c2880b0 /test/run_tests.cpp | |
| parent | b3ac5c16ecc8dd9da661dcb9d15a6c36a8e4167b (diff) | |
| download | zig-9a8851515b8aeac1adcea38094a45e3260e7522c.tar.gz zig-9a8851515b8aeac1adcea38094a45e3260e7522c.zip | |
basic maybe type working
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index aada4354b3..5c3e5f5257 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -674,6 +674,24 @@ export fn main(argc : isize, argv : &&u8, env : &&u8) -> i32 { return 0; } )SOURCE", "loop\nloop\nloop\nloop\n"); + + add_simple_case("maybe type", R"SOURCE( +use "std.zig"; +export fn main(argc : isize, argv : &&u8, env : &&u8) -> i32 { + const x : ?bool = true; + + if (const y ?= x) { + if (y) { + print_str("x is true\n"); + } else { + print_str("x is false\n"); + } + } else { + print_str("x is none\n"); + } + return 0; +} + )SOURCE", "x is true\n"); } //////////////////////////////////////////////////////////////////////////////////// |
