aboutsummaryrefslogtreecommitdiff
path: root/test/run_tests.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-01-22 22:02:07 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-01-22 22:02:07 -0700
commit523e3b86af44b97bcf68e3eb0956ef297421ee10 (patch)
tree61b3743aced3715ebc8f811cc3477fca45d0ad20 /test/run_tests.cpp
parent21fc5a6402c527675900397ea60f107730985f1c (diff)
downloadzig-523e3b86af44b97bcf68e3eb0956ef297421ee10.tar.gz
zig-523e3b86af44b97bcf68e3eb0956ef297421ee10.zip
support statically initialized array literal
Diffstat (limited to 'test/run_tests.cpp')
-rw-r--r--test/run_tests.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/test/run_tests.cpp b/test/run_tests.cpp
index 9a06deb2a9..d4ff895351 100644
--- a/test/run_tests.cpp
+++ b/test/run_tests.cpp
@@ -1244,6 +1244,20 @@ pub fn main(args: [][]u8) i32 => {
}
)SOURCE", "OK\n");
+ add_simple_case("statically initialized array literal", R"SOURCE(
+import "std.zig";
+const x = []u8{1,2,3,4};
+pub fn main(args: [][]u8) i32 => {
+ const y : [4]u8 = x;
+ if (y[3] != 4) {
+ print_str("BAD\n");
+ }
+
+ print_str("OK\n");
+ return 0;
+}
+ )SOURCE", "OK\n");
+
}
@@ -1498,12 +1512,14 @@ struct A {
z : i32,
}
fn f() => {
+ // we want the error on the '{' not the 'A' because
+ // the A could be a complicated expression
const a = A {
.z = 4,
.y = 2,
};
}
- )SOURCE", 1, ".tmp_source.zig:8:17: error: missing field: 'x'");
+ )SOURCE", 1, ".tmp_source.zig:10:17: error: missing field: 'x'");
add_compile_fail_case("invalid field in struct value expression", R"SOURCE(
struct A {