4 // coroutine hook tests
6 suite_setup: function () {},
7 suite_teardown: function () {},
9 define_coroutine_hook("test_hook");
11 teardown: function () {
12 test_hook = undefined;
14 test_synchronous_coroutine_hook: function () {
16 function inc_a () { a += 1; }
17 add_hook("test_hook", inc_a);
18 co_call(test_hook.run());
21 test_asynchronous_coroutine_hook: function () {
27 cont = yield CONTINUATION;
28 str += (yield SUSPEND);
31 function () str += "b");
32 co_call(test_hook.run());
34 assert_equals(str, "acb");