Skip to content

Commit a0958c1

Browse files
committed
#9: * fix spawn tests
1 parent fc258cb commit a0958c1

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

scope.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ METHOD(spawn)
229229
}
230230

231231
if (UNEXPECTED(ZEND_ASYNC_SCOPE_IS_CLOSED(&scope_object->scope->scope))) {
232-
async_throw_error("Cannot spawn coroutine in a closed scope");
232+
async_throw_error("Cannot spawn a coroutine in a closed scope");
233233
RETURN_THROWS();
234234
}
235235

tests/spawn/017-spawn_closed_scope_error.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ try {
2020
return "test";
2121
});
2222
echo "ERROR: Should have thrown exception\n";
23-
} catch (Error $e) {
23+
} catch (Async\AsyncException $e) {
2424
echo "Caught expected error: " . $e->getMessage() . "\n";
2525
} catch (Throwable $e) {
2626
echo "Caught exception: " . get_class($e) . ": " . $e->getMessage() . "\n";
@@ -40,7 +40,7 @@ try {
4040
return "test2";
4141
});
4242
echo "ERROR: Should have thrown exception\n";
43-
} catch (Error $e) {
43+
} catch (Async\AsyncException $e) {
4444
echo "Caught expected error for safely disposed: " . $e->getMessage() . "\n";
4545
} catch (Throwable $e) {
4646
echo "Caught exception: " . get_class($e) . ": " . $e->getMessage() . "\n";

tests/spawn/019-spawn_scope_provider_null.phpt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ spawnWith() - scope provider returns null (valid case)
44
<?php
55

66
use function Async\spawnWith;
7+
use function Async\await;
78

89
echo "start\n";
910

@@ -19,7 +20,8 @@ try {
1920
$coroutine = spawnWith(new NullScopeProvider(), function() {
2021
return "success";
2122
});
22-
echo "Null provider result: " . $coroutine->getResult() . "\n";
23+
24+
echo "Null provider result: " . await($coroutine) . "\n";
2325
} catch (Throwable $e) {
2426
echo "Unexpected exception: " . get_class($e) . ": " . $e->getMessage() . "\n";
2527
}

0 commit comments

Comments
 (0)