diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-08-02 14:15:31 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-08-02 14:15:31 -0400 |
| commit | 895f262a55b9951647efef4528c17cf64d6b7c07 (patch) | |
| tree | 14ec51f41d29214e550317f283aa8dcdbf223b9d /test | |
| parent | 44fd3045ce85abb3e10dc0ad70d195b7d8044c43 (diff) | |
| download | zig-895f262a55b9951647efef4528c17cf64d6b7c07.tar.gz zig-895f262a55b9951647efef4528c17cf64d6b7c07.zip | |
pull request fixups
* clean up parser code
* fix stage2 parse and render code
* remove redundant test
* make stage1 compile tests leaner
Diffstat (limited to 'test')
| -rw-r--r-- | test/cases/coroutines.zig | 16 | ||||
| -rw-r--r-- | test/compile_errors.zig | 51 |
2 files changed, 21 insertions, 46 deletions
diff --git a/test/cases/coroutines.zig b/test/cases/coroutines.zig index a955eeac37..bd6b6abf6f 100644 --- a/test/cases/coroutines.zig +++ b/test/cases/coroutines.zig @@ -256,19 +256,3 @@ async fn testBreakFromSuspend(my_result: *i32) void { suspend; my_result.* += 1; } - -test "suspend resume @handle()" { - var buf: [500]u8 = undefined; - var a = &std.heap.FixedBufferAllocator.init(buf[0..]).allocator; - var my_result: i32 = 1; - const p = try async<a> testBreakFromSuspend(&my_result); - std.debug.assert(my_result == 2); -} -async fn testSuspendResumeAtHandle() void { - suspend { - resume @handle(); - } - my_result.* += 1; - suspend; - my_result.* += 1; -}
\ No newline at end of file diff --git a/test/compile_errors.zig b/test/compile_errors.zig index f4b289f70d..948d212e58 100644 --- a/test/compile_errors.zig +++ b/test/compile_errors.zig @@ -2,6 +2,27 @@ const tests = @import("tests.zig"); pub fn addCases(cases: *tests.CompileErrorContext) void { cases.add( + "@handle() called outside of function definition", + \\var handle_undef: promise = undefined; + \\var handle_dummy: promise = @handle(); + \\export fn entry() bool { + \\ return handle_undef == handle_dummy; + \\} + , + ".tmp_source.zig:2:29: error: @handle() called outside of function definition", + ); + + cases.add( + "@handle() in non-async function", + \\export fn entry() bool { + \\ var handle_undef: promise = undefined; + \\ return handle_undef == @handle(); + \\} + , + ".tmp_source.zig:3:28: error: @handle() in non-async function", + ); + + cases.add( "while loop body expression ignored", \\fn returns() usize { \\ return 2; @@ -4738,34 +4759,4 @@ pub fn addCases(cases: *tests.CompileErrorContext) void { , ".tmp_source.zig:3:36: error: @ArgType could not resolve the type of arg 0 because 'fn(var)var' is generic", ); - - cases.add( - "@handle() called outside of function definition", - \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn { - \\ @import("std").os.exit(126); - \\} - \\ - \\var handle_undef: promise = undefined; - \\var handle_dummy: promise = @handle(); - \\ - \\pub fn main() void { - \\ if (handle_undef == handle_dummy) return 0; - \\} - , - ".tmp_source.zig:6:29: error: @handle() called outside of function definition", - ); - - cases.add( - "@handle() in non-async function", - \\pub fn panic(message: []const u8, stack_trace: ?*@import("builtin").StackTrace) noreturn { - \\ @import("std").os.exit(126); - \\} - \\ - \\pub fn main() void { - \\ var handle_undef: promise = undefined; - \\ if (handle_undef == @handle()) return 0; - \\} - , - ".tmp_source.zig:7:25: error: @handle() in non-async function", - ); } |
