aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2015-12-02 00:59:58 -0700
committerAndrew Kelley <superjoe30@gmail.com>2015-12-02 00:59:58 -0700
commite94681b9618eafbdd23d8b1416fc536fc81debbc (patch)
tree06569e4f9f2a60061b28bda2bfb349eaab59ec68 /test/run_tests.cpp
parent370de7386ce811b6381c3ffcf5dd8efd2810da2b (diff)
downloadzig-e94681b9618eafbdd23d8b1416fc536fc81debbc.tar.gz
zig-e94681b9618eafbdd23d8b1416fc536fc81debbc.zip
add test for undeclared identifier error
Diffstat (limited to 'test/run_tests.cpp')
-rw-r--r--test/run_tests.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
index d4460bbdc2..78f35db5a3 100644
--- a/test/run_tests.cpp
+++ b/test/run_tests.cpp
@@ -295,7 +295,16 @@ export executable "test";
add_compile_fail_case("bad import", R"SOURCE(
use "bogus-does-not-exist.zig";
- )SOURCE", 1, ".tmp_source.zig:2:1: error: unable to open \"./bogus-does-not-exist.zig\": file not found");
+ )SOURCE", 1, ".tmp_source.zig:2:1: error: unable to open './bogus-does-not-exist.zig': file not found");
+
+ add_compile_fail_case("undeclared identifier", R"SOURCE(
+fn a() {
+ b +
+ c
+}
+ )SOURCE", 2,
+ ".tmp_source.zig:3:5: error: use of undeclared identifier 'b'",
+ ".tmp_source.zig:4:5: error: use of undeclared identifier 'c'");
}
static void print_compiler_invokation(TestCase *test_case, Buf *zig_stderr) {