From de9ecaf96470c9d2b9f165608a57ba03c9c0f17c Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Wed, 11 Jan 2017 18:23:19 -0500 Subject: [PATCH] fix some tests --- test/run_tests.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 8edcb11230..5972da4c94 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -1452,34 +1452,35 @@ fn function_with_return_type_type() { ".tmp_source.zig:17:19: note: called from here"); add_compile_fail_case("bogus method call on slice", R"SOURCE( +var self = "aoeu"; fn f(m: []const u8) { - m.copy(u8, self.list.items[old_len...], m); + m.copy(u8, self[0...], m); } - )SOURCE", 1, ".tmp_source.zig:3:6: error: no member named 'copy' in '[]const u8'"); + )SOURCE", 1, ".tmp_source.zig:4:6: error: no member named 'copy' in '[]const u8'"); add_compile_fail_case("wrong number of arguments for method fn call", R"SOURCE( -const Foo = { +const Foo = struct { fn method(self: &const Foo, a: i32) {} }; fn f(foo: &const Foo) { foo.method(1, 2); } - )SOURCE", 1, ".tmp_source.zig:7:15: error: expected 1 arguments, found 2"); + )SOURCE", 1, ".tmp_source.zig:7:15: error: expected 2 arguments, found 3"); add_compile_fail_case("assign through constant pointer", R"SOURCE( fn f() { var cstr = c"Hat"; cstr[0] = 'W'; } - )SOURCE", 1, ".tmp_source.zig:4:7: error: cannot assign to constant"); + )SOURCE", 1, ".tmp_source.zig:4:11: error: cannot assign to constant"); add_compile_fail_case("assign through constant slice", R"SOURCE( pub fn f() { var cstr: []const u8 = "Hat"; cstr[0] = 'W'; } - )SOURCE", 1, ".tmp_source.zig:4:7: error: cannot assign to constant"); + )SOURCE", 1, ".tmp_source.zig:4:11: error: cannot assign to constant"); add_compile_fail_case("main function with bogus args type", R"SOURCE( pub fn main(args: [][]bogus) -> %void {}