diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-04-12 17:33:46 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-04-12 17:33:46 -0700 |
| commit | 3c27cb25279049cfdcde99d49045f5b8ec8981ba (patch) | |
| tree | 7a9b9ba96c7f18096a669b3daa450fcc30ce6175 /test/run_tests.cpp | |
| parent | 69109bc270c3167a3534dd32fc4f4def855e0be9 (diff) | |
| download | zig-3c27cb25279049cfdcde99d49045f5b8ec8981ba.tar.gz zig-3c27cb25279049cfdcde99d49045f5b8ec8981ba.zip | |
more eval tests and fix eval call analyze code
Diffstat (limited to 'test/run_tests.cpp')
| -rw-r--r-- | test/run_tests.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 5b3d68e72b..461ee4172c 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -1491,6 +1491,21 @@ fn foo(x: i32) -> i32 { ".tmp_source.zig:3:1: error: function evaluation caused division by zero", ".tmp_source.zig:2:14: note: called from here", ".tmp_source.zig:4:7: note: division by zero here"); + + add_compile_fail_case("branch on undefined value", R"SOURCE( +const x = if (undefined) true else false; + )SOURCE", 1, ".tmp_source.zig:2:15: error: branch on undefined value"); + + + add_compile_fail_case("endless loop in function evaluation", R"SOURCE( +const seventh_fib_number = fibbonaci(7); +fn fibbonaci(x: i32) -> i32 { + return fibbonaci(x - 1) + fibbonaci(x - 2); +} + )SOURCE", 3, + ".tmp_source.zig:3:1: error: function evaluation exceeded 1000 branches", + ".tmp_source.zig:2:37: note: called from here", + ".tmp_source.zig:4:40: note: quota exceeded here"); } ////////////////////////////////////////////////////////////////////////////// |
