aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/run_tests.cpp')
-rw-r--r--test/run_tests.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
index 71158e9327..cc93e188e3 100644
--- a/test/run_tests.cpp
+++ b/test/run_tests.cpp
@@ -936,7 +936,27 @@ pub fn main(argc: isize, argv: &&u8, env: &&u8) -> i32 {
}
)SOURCE", "OK\n");
+
+ add_simple_case("else if expression", R"SOURCE(
+use "std.zig";
+pub fn main(argc: isize, argv: &&u8, env: &&u8) -> i32 {
+ if (f(1) == 1) {
+ print_str("OK\n");
+ }
+ return 0;
}
+fn f(c: u8) -> u8 {
+ if (c == 0) {
+ 0
+ } else if (c == 1) {
+ 1
+ } else {
+ 2
+ }
+}
+ )SOURCE", "OK\n");
+}
+
////////////////////////////////////////////////////////////////////////////////////