Fix WaitGroup tests
@@ -16,7 +16,7 @@ $wg = new WaitGroup();
// done without add is not allowed
Assert::throws(function () use ($wg) {
$wg->done();
-}, Error::class, 'WaitGroup counter can not be negative');
+}, Error::class, expectMessage: 'WaitGroup counter can not be negative');
$wg->add(2);
// normal done
Coroutine::run(function () use ($wg) {
@@ -30,12 +30,12 @@ Coroutine::run(function () use ($wg) {
// add on wait is not allowed
Assert::throws(function () use ($wg) {
$wg->add(1);
- }, Error::class, 'WaitGroup add called concurrently with wait');
+ }, Error::class, expectMessage: 'WaitGroup add called concurrently with wait');
// double wait is not allowed
Assert::throws(function () use ($wg) {
$wg->wait();
- }, Error::class, 'WaitGroup can not be reused before previous wait has returned');
+ }, Error::class, expectMessage: 'WaitGroup can not be reused before previous wait has returned');
});
// clear wg to avoid deadlock
$wg->done();
