aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-03-01 17:59:56 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-03-01 17:59:56 -0700
commitf72c36cd37a383ca7ca9e09cb6a665dfe2c73365 (patch)
tree3d00619cc5388f62dab00f0abbd2bf968fbb8b18 /test/run_tests.cpp
parent5df091fea98e91536f95e3b4bd5bcb0881f06989 (diff)
downloadzig-f72c36cd37a383ca7ca9e09cb6a665dfe2c73365.tar.gz
zig-f72c36cd37a383ca7ca9e09cb6a665dfe2c73365.zip
fix detection of @import and @c_import inside fn body
Diffstat (limited to 'test/run_tests.cpp')
-rw-r--r--test/run_tests.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
index 34d4e46792..92622b7027 100644
--- a/test/run_tests.cpp
+++ b/test/run_tests.cpp
@@ -1764,6 +1764,12 @@ fn f(n: Number) -> i32 {
}
}
)SOURCE", 1, ".tmp_source.zig:9:5: error: enumeration value 'Four' not handled in switch");
+
+ add_compile_fail_case("import inside function body", R"SOURCE(
+fn f() {
+ const std = @import("std");
+}
+ )SOURCE", 1, ".tmp_source.zig:3:17: error: @import invalid inside function bodies");
}
//////////////////////////////////////////////////////////////////////////////