| ... | @@ -130,3 +130,16 @@ fn early_seq(c: u8) void { | ... | @@ -130,3 +130,16 @@ fn early_seq(c: u8) void { |
| 130 | early_points[early_seq_index] = c; | 130 | early_points[early_seq_index] = c; |
| 131 | early_seq_index += 1; | 131 | early_seq_index += 1; |
| 132 | } | 132 | } |
| | 133 | |
| | 134 | test "coro allocation failure" { |
| | 135 | var failing_allocator = std.debug.FailingAllocator.init(std.debug.global_allocator, 0); |
| | 136 | if (async(&failing_allocator.allocator) asyncFuncThatNeverGetsRun()) { |
| | 137 | @panic("expected allocation failure"); |
| | 138 | } else |err| switch (err) { |
| | 139 | error.OutOfMemory => {}, |
| | 140 | } |
| | 141 | } |
| | 142 | |
| | 143 | async fn asyncFuncThatNeverGetsRun() void { |
| | 144 | @panic("coro frame allocation should fail"); |
| | 145 | } |