From 7f88d78bb7392a859ec1e0bb54168a99d54c6cae Mon Sep 17 00:00:00 2001 From: twosee Date: Sat, 24 Nov 2018 16:03:03 +0800 Subject: [PATCH] Fix through sort. --- .../swoole_coroutine/list_and_backtrace.phpt | 120 +++++++++--------- 1 file changed, 61 insertions(+), 59 deletions(-) diff --git a/tests/swoole_coroutine/list_and_backtrace.phpt b/tests/swoole_coroutine/list_and_backtrace.phpt index 26f2cebc3e5..408c1941a25 100644 --- a/tests/swoole_coroutine/list_and_backtrace.phpt +++ b/tests/swoole_coroutine/list_and_backtrace.phpt @@ -11,6 +11,8 @@ go(function () { $main = go(function () { $coros = Co::listCoroutines(); Co::yield(); + $coros = iterator_to_array($coros); + sort($coros); foreach ($coros as $cid) { var_dump($cid); var_dump(Co::getBackTrace($cid)); @@ -36,79 +38,75 @@ go(function () { swoole_event_wait(); ?> --EXPECTF-- -int(9) +int(1) array(1) { [0]=> - array(6) { + array(4) { ["file"]=> string(%d) "%s" ["line"]=> - int(25) + int(31) ["function"]=> - string(6) "resume" - ["class"]=> - string(16) "Swoole\Coroutine" - ["type"]=> - string(2) "::" + string(2) "go" ["args"]=> array(1) { [0]=> - int(4) + object(Closure)#2 (0) { + } } } } -int(8) +int(2) array(1) { [0]=> - array(6) { + array(4) { ["file"]=> string(%d) "%s" ["line"]=> - int(22) + int(30) ["function"]=> - string(11) "getaddrinfo" - ["class"]=> - string(16) "Swoole\Coroutine" - ["type"]=> - string(2) "::" + string(2) "go" ["args"]=> array(1) { [0]=> - string(9) "localhost" + object(Closure)#3 (0) { + } } } } -int(7) +int(3) array(1) { [0]=> - array(6) { + array(4) { ["file"]=> string(%d) "%s" ["line"]=> - int(19) + int(29) ["function"]=> - string(8) "readFile" - ["class"]=> - string(16) "Swoole\Coroutine" - ["type"]=> - string(2) "::" + string(2) "go" ["args"]=> array(1) { [0]=> - string(%d) "%s" + object(Closure)#6 (1) { + ["static"]=> + array(1) { + ["main"]=> + int(4) + } + } } } } -int(6) +int(4) array(1) { [0]=> array(6) { ["file"]=> string(%d) "%s" ["line"]=> - int(16) + int(13) ["function"]=> - string(5) "sleep" + string(12) "getBackTrace" ["class"]=> string(16) "Swoole\Coroutine" ["type"]=> @@ -116,7 +114,7 @@ array(1) { ["args"]=> array(1) { [0]=> - float(0.001) + int(4) } } } @@ -127,7 +125,7 @@ array(1) { ["file"]=> string(%d) "%s" ["line"]=> - int(26) + int(28) ["function"]=> string(2) "go" ["args"]=> @@ -143,16 +141,16 @@ array(1) { } } } -int(4) +int(6) array(1) { [0]=> array(6) { ["file"]=> string(%d) "%s" ["line"]=> - int(11) + int(18) ["function"]=> - string(12) "getBackTrace" + string(5) "sleep" ["class"]=> string(16) "Swoole\Coroutine" ["type"]=> @@ -160,66 +158,70 @@ array(1) { ["args"]=> array(1) { [0]=> - int(4) + float(0.001) } } } -int(3) +int(7) array(1) { [0]=> - array(4) { + array(6) { ["file"]=> string(%d) "%s" ["line"]=> - int(27) + int(21) ["function"]=> - string(2) "go" + string(8) "readFile" + ["class"]=> + string(16) "Swoole\Coroutine" + ["type"]=> + string(2) "::" ["args"]=> array(1) { [0]=> - object(Closure)#6 (1) { - ["static"]=> - array(1) { - ["main"]=> - int(4) - } - } + string(%d) "%s" } } } -int(2) +int(8) array(1) { [0]=> - array(4) { + array(6) { ["file"]=> string(%d) "%s" ["line"]=> - int(28) + int(24) ["function"]=> - string(2) "go" + string(11) "getaddrinfo" + ["class"]=> + string(16) "Swoole\Coroutine" + ["type"]=> + string(2) "::" ["args"]=> array(1) { [0]=> - object(Closure)#3 (0) { - } + string(9) "localhost" } } } -int(1) +int(9) array(1) { [0]=> - array(4) { + array(6) { ["file"]=> string(%d) "%s" ["line"]=> - int(29) + int(27) ["function"]=> - string(2) "go" + string(6) "resume" + ["class"]=> + string(16) "Swoole\Coroutine" + ["type"]=> + string(2) "::" ["args"]=> array(1) { [0]=> - object(Closure)#2 (0) { - } + int(4) } } }