Skip to content

Commit b4d4a2d

Browse files
committed
#19: * Test stabilization awaitAnyOfWithErrors() - basic usage with mixed success and error
1 parent f3a123c commit b4d4a2d

File tree

2 files changed

+10
-33
lines changed

2 files changed

+10
-33
lines changed

run-tests.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
BASE_PATH="$(cd "$(dirname "$0")/tests" && pwd)"
44
RUN_TESTS_PATH="$(cd "$(dirname "$0")/../../" && pwd)/run-tests.php"
55
PHP_EXECUTABLE="$(cd "$(dirname "$0")/../../" && pwd)/sapi/cli/php"
6+
export VALGRIND_OPTS="--leak-check=full --track-origins=yes"
67

78
if [ -z "$1" ]; then
89
TEST_PATH="$BASE_PATH"
910
else
1011
TEST_PATH="$BASE_PATH/$1"
1112
fi
1213

13-
"$PHP_EXECUTABLE" "$RUN_TESTS_PATH" --show-diff -p "$PHP_EXECUTABLE" "$TEST_PATH"
14+
"$PHP_EXECUTABLE" "$RUN_TESTS_PATH" --show-diff -m -p "$PHP_EXECUTABLE" "$TEST_PATH"

tests/await/016-awaitAnyOfWithErrors_basic.phpt

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,41 +29,17 @@ $coroutines = [
2929
];
3030

3131
$result = awaitAnyOfWithErrors(2, $coroutines);
32-
var_dump($result);
32+
33+
$countOfResults = count($result[0]) >= 2 ? "OK" : "FALSE: ".count($result[0]);
34+
$countOfErrors = count($result[1]) == 1 ? "OK" : "FALSE: ".count($result[1]);
35+
36+
echo "Count of results: $countOfResults\n";
37+
echo "Count of errors: $countOfErrors\n";
3338

3439
echo "end\n";
3540
?>
3641
--EXPECTF--
3742
start
38-
array(2) {
39-
[0]=>
40-
array(2) {
41-
[2]=>
42-
string(5) "third"
43-
[3]=>
44-
string(6) "fourth"
45-
}
46-
[1]=>
47-
array(1) {
48-
[1]=>
49-
object(RuntimeException)#%d (7) {
50-
["message":protected]=>
51-
string(14) "test exception"
52-
["string":"Exception":private]=>
53-
string(0) ""
54-
["code":protected]=>
55-
int(0)
56-
["file":protected]=>
57-
string(%d) "%s"
58-
["line":protected]=>
59-
int(%d)
60-
["trace":"Exception":private]=>
61-
array(%d) {
62-
%a
63-
}
64-
["previous":"Exception":private]=>
65-
NULL
66-
}
67-
}
68-
}
43+
Count of results: OK
44+
Count of errors: OK
6945
end

0 commit comments

Comments
 (0)