aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-05-07 10:05:59 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-05-07 10:05:59 -0700
commit8c79438f6b76f1ad4b4941cdb46ae1e7aa12ce14 (patch)
tree266e5cc959092bfc6e0567916f37cd34fbd0f712 /test/run_tests.cpp
parentd5d5fd928c79df6e4060c7ad84068fcee28c2391 (diff)
downloadzig-8c79438f6b76f1ad4b4941cdb46ae1e7aa12ce14.tar.gz
zig-8c79438f6b76f1ad4b4941cdb46ae1e7aa12ce14.zip
better array concatenation semantics
closes #87
Diffstat (limited to 'test/run_tests.cpp')
-rw-r--r--test/run_tests.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
index 130b99fd65..0fc63ee81f 100644
--- a/test/run_tests.cpp
+++ b/test/run_tests.cpp
@@ -999,11 +999,17 @@ extern fn foo() -> i32;
const x = foo();
)SOURCE", 1, ".tmp_source.zig:3:11: error: global variable initializer requires constant expression");
- add_compile_fail_case("non compile time string concatenation", R"SOURCE(
+ add_compile_fail_case("array concatenation with wrong type", R"SOURCE(
fn f(s: []u8) -> []u8 {
s ++ "foo"
}
- )SOURCE", 1, ".tmp_source.zig:3:5: error: string concatenation requires constant expression");
+ )SOURCE", 1, ".tmp_source.zig:3:5: error: expected array or C string literal, got '[]u8'");
+
+ add_compile_fail_case("non compile time array concatenation", R"SOURCE(
+fn f(s: [10]u8) -> []u8 {
+ s ++ "foo"
+}
+ )SOURCE", 1, ".tmp_source.zig:3:5: error: array concatenation requires constant expression");
add_compile_fail_case("c_import with bogus include", R"SOURCE(
const c = @c_import(@c_include("bogus.h"));