diff options
| author | pooryorick <com.digitalsmarties@pooryorick.com> | 2021-06-21 05:40:22 (GMT) |
|---|---|---|
| committer | pooryorick <com.digitalsmarties@pooryorick.com> | 2021-06-21 05:40:22 (GMT) |
| commit | 7357ee63c3c9387431017478d0f70dbd6c4bc21c (patch) | |
| tree | 36ebe3c9d65c5f5871bebc4554faf89a4d1e2887 | |
| parent | 70c2b0e817830a7baec1796e3dc095fba8b7f6f8 (diff) | |
| download | tcl-7357ee63c3c9387431017478d0f70dbd6c4bc21c.zip tcl-7357ee63c3c9387431017478d0f70dbd6c4bc21c.tar.gz tcl-7357ee63c3c9387431017478d0f70dbd6c4bc21c.tar.bz2 | |
test for issue [5106fddd4400e5b9b], failure to yieldto is not the same thing as
not calling yieldto in the first place
| -rw-r--r-- | tests/coroutine.test | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/tests/coroutine.test b/tests/coroutine.test index e155d09..437d9ad 100644 --- a/tests/coroutine.test +++ b/tests/coroutine.test @@ -757,9 +757,9 @@ test coroutine-7.12 {coro floor above street level #3008307} -body { test coroutine-7.13 { -issue f9800d52bd61f240 + issue f9800d52bd61f240 -vwait is not NRE-enabled, and yieldto cannot find the right splicing spot + vwait is not NRE-enabled, and yieldto cannot find the right splicing spot } -body { coroutine c0 apply [list {} { variable done @@ -789,6 +789,38 @@ vwait is not NRE-enabled, and yieldto cannot find the right splicing spot return $done } -result 1 + +test coroutine-7.14 { + issue 5106fddd4400e5b9 + + failure to yieldto is not the same thing as not calling yieldto in the + first place +} -body { + variable done + variable done1 + + coroutine c0 ::apply [list {} { + yield + variable done0 + after 0 [list [namespace which c1]] + vwait [namespace current]::done0 + } [namespace current]] + + coroutine c1 ::apply [list {} { + variable done0 + yield + yieldto try "yieldto [list [info coroutine]]" on error {} " + ::set [list [namespace current]]::done1 failure + ::set [list [namespace current]]::done0 failure + " + set done0 success + } [namespace current]] + after 1 [list [namespace which c0]] + vwait [namespace current]::done0 + return [list $done0 $done1] +} -result {failure failure} + + test coroutine-8.0.0 {coro inject executed} -body { coroutine demo apply {{} { foreach i {1 2} yield }} demo |
