authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-01-11 18:23:19-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2017-01-11 18:23:19-05:00
logde9ecaf96470c9d2b9f165608a57ba03c9c0f17c
treecf2c59112ae4c93a4a1d8752fca2094d43b5c12d
parentfc53708dc0e0395e0360a4d62ed75ce66ad3c58e

fix some tests


1 files changed, 7 insertions(+), 6 deletions(-)

test/run_tests.cpp+7-6
...@@ -1452,34 +1452,35 @@ fn function_with_return_type_type() {...@@ -1452,34 +1452,35 @@ fn function_with_return_type_type() {
1452 ".tmp_source.zig:17:19: note: called from here");1452 ".tmp_source.zig:17:19: note: called from here");
14531453
1454 add_compile_fail_case("bogus method call on slice", R"SOURCE(1454 add_compile_fail_case("bogus method call on slice", R"SOURCE(
1455var self = "aoeu";
1455fn f(m: []const u8) {1456fn f(m: []const u8) {
1456 m.copy(u8, self.list.items[old_len...], m);1457 m.copy(u8, self[0...], m);
1457}1458}
1458 )SOURCE", 1, ".tmp_source.zig:3:6: error: no member named 'copy' in '[]const u8'");1459 )SOURCE", 1, ".tmp_source.zig:4:6: error: no member named 'copy' in '[]const u8'");
14591460
1460 add_compile_fail_case("wrong number of arguments for method fn call", R"SOURCE(1461 add_compile_fail_case("wrong number of arguments for method fn call", R"SOURCE(
1461const Foo = {1462const Foo = struct {
1462 fn method(self: &const Foo, a: i32) {}1463 fn method(self: &const Foo, a: i32) {}
1463};1464};
1464fn f(foo: &const Foo) {1465fn f(foo: &const Foo) {
14651466
1466 foo.method(1, 2);1467 foo.method(1, 2);
1467}1468}
1468 )SOURCE", 1, ".tmp_source.zig:7:15: error: expected 1 arguments, found 2");1469 )SOURCE", 1, ".tmp_source.zig:7:15: error: expected 2 arguments, found 3");
14691470
1470 add_compile_fail_case("assign through constant pointer", R"SOURCE(1471 add_compile_fail_case("assign through constant pointer", R"SOURCE(
1471fn f() {1472fn f() {
1472 var cstr = c"Hat";1473 var cstr = c"Hat";
1473 cstr[0] = 'W';1474 cstr[0] = 'W';
1474}1475}
1475 )SOURCE", 1, ".tmp_source.zig:4:7: error: cannot assign to constant");1476 )SOURCE", 1, ".tmp_source.zig:4:11: error: cannot assign to constant");
14761477
1477 add_compile_fail_case("assign through constant slice", R"SOURCE(1478 add_compile_fail_case("assign through constant slice", R"SOURCE(
1478pub fn f() {1479pub fn f() {
1479 var cstr: []const u8 = "Hat";1480 var cstr: []const u8 = "Hat";
1480 cstr[0] = 'W';1481 cstr[0] = 'W';
1481}1482}
1482 )SOURCE", 1, ".tmp_source.zig:4:7: error: cannot assign to constant");1483 )SOURCE", 1, ".tmp_source.zig:4:11: error: cannot assign to constant");
14831484
1484 add_compile_fail_case("main function with bogus args type", R"SOURCE(1485 add_compile_fail_case("main function with bogus args type", R"SOURCE(
1485pub fn main(args: [][]bogus) -> %void {}1486pub fn main(args: [][]bogus) -> %void {}