more test coverage

This commit is contained in:
Andrew Kelley 2016-10-28 12:04:46 -04:00
parent c982077156
commit e3857a361c

View File

@ -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);