aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-10-28 12:04:46 -0400
committerAndrew Kelley <superjoe30@gmail.com>2016-10-28 12:04:46 -0400
commite3857a361c528d23d1a9f727619c379bea1a3563 (patch)
treec29a21d4e3ca1c80ec759a753df1a9d13d82f5ee /test/run_tests.cpp
parentc982077156d362eec8844d2323b1d3b0bd7b2ce3 (diff)
downloadzig-e3857a361c528d23d1a9f727619c379bea1a3563.tar.gz
zig-e3857a361c528d23d1a9f727619c379bea1a3563.zip
more test coverage
Diffstat (limited to 'test/run_tests.cpp')
-rw-r--r--test/run_tests.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
index 564381cd1a..dde3b68f21 100644
--- a/test/run_tests.cpp
+++ b/test/run_tests.cpp
@@ -1467,6 +1467,18 @@ fn function_with_return_type_type() {
".tmp_source.zig:4:5: note: unable to evaluate this expression at compile time",
".tmp_source.zig:3:32: note: required to be compile-time function because of return type 'type'");
+ add_compile_fail_case("non pure function required to be pure", R"SOURCE(
+var a: i32 = 0;
+
+fn foo() {
+ @setFnStaticEval(this, true);
+ a = 1;
+}
+ )SOURCE", 3,
+ ".tmp_source.zig:4:1: error: failed to evaluate function at compile time",
+ ".tmp_source.zig:6:5: note: unable to evaluate this expression at compile time",
+ ".tmp_source.zig:5:5: note: required to be compile-time function here");
+
add_compile_fail_case("bogus method call on slice", R"SOURCE(
fn f(m: []const u8) {
m.copy(u8, self.list.items[old_len...], m);