diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/cases/enum_with_members.zig | 4 | ||||
| -rw-r--r-- | test/cases/eval.zig | 12 | ||||
| -rw-r--r-- | test/run_tests.cpp | 22 |
3 files changed, 34 insertions, 4 deletions
diff --git a/test/cases/enum_with_members.zig b/test/cases/enum_with_members.zig index b338b9b014..5abb297674 100644 --- a/test/cases/enum_with_members.zig +++ b/test/cases/enum_with_members.zig @@ -8,8 +8,8 @@ const ET = enum { pub fn print(a: &const ET, buf: []u8) -> %usize { return switch (*a) { - ET.SINT => |x| { io.bufPrintInt(buf, x, 10, false) }, - ET.UINT => |x| { io.bufPrintInt(buf, x, 10, false) }, + ET.SINT => |x| { io.bufPrintInt(buf, x, 10, false, 0) }, + ET.UINT => |x| { io.bufPrintInt(buf, x, 10, false, 0) }, } } }; diff --git a/test/cases/eval.zig b/test/cases/eval.zig index 9f3b1d2fcd..027bb643b6 100644 --- a/test/cases/eval.zig +++ b/test/cases/eval.zig @@ -251,3 +251,15 @@ fn comptimeIterateOverFnPtrList() { assert(performFn('o', 0) == 1); assert(performFn('w', 99) == 99); } + +fn evalSetDebugSafetyAtCompileTime() { + @setFnTest(this); + + const result = comptime fnWithSetDebugSafety(); + assert(result == 1234); +} + +fn fnWithSetDebugSafety() -> i32{ + @setDebugSafety(this, true); + return 1234; +} diff --git a/test/run_tests.cpp b/test/run_tests.cpp index 01d16a2543..828f3469bf 100644 --- a/test/run_tests.cpp +++ b/test/run_tests.cpp @@ -1015,8 +1015,9 @@ const x = foo(); add_compile_fail_case("array concatenation with wrong type", R"SOURCE( const src = "aoeu"; -const a = src[0...] ++ "foo"; - )SOURCE", 1, ".tmp_source.zig:3:14: error: expected array or C string literal, found '[]u8'"); +const derp = usize(1234); +const a = derp ++ "foo"; + )SOURCE", 1, ".tmp_source.zig:4:11: error: expected array or C string literal, found 'usize'"); add_compile_fail_case("non compile time array concatenation", R"SOURCE( fn f(s: [10]u8) -> []u8 { @@ -1632,6 +1633,23 @@ const some_data: [100]u8 = { }; )SOURCE", 1, ".tmp_source.zig:3:32: error: alignment value must be power of 2"); + add_compile_fail_case("compile log", R"SOURCE( +fn foo() { + comptime bar(12, "hi"); +} +fn bar(a: i32, b: []const u8) { + @compileLog("begin"); + @compileLog("a", a, "b", b); + @compileLog("end"); +} + )SOURCE", 6, + ".tmp_source.zig:6:5: error: found compile log statement", + ".tmp_source.zig:3:17: note: called from here", + ".tmp_source.zig:7:5: error: found compile log statement", + ".tmp_source.zig:3:17: note: called from here", + ".tmp_source.zig:8:5: error: found compile log statement", + ".tmp_source.zig:3:17: note: called from here"); + } ////////////////////////////////////////////////////////////////////////////// |
