summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2017-04-04 11:13:36 (GMT)
committersebres <sebres@users.sourceforge.net>2017-04-04 11:13:36 (GMT)
commita61a0e3df9df21ead49108d82842a48617cb0c09 (patch)
treee66a97c3efde500285a7899640d135a918b8612e /tests
parent3637b82062f2363b7f70d0edca031396b2939efb (diff)
downloadtcl-a61a0e3df9df21ead49108d82842a48617cb0c09.zip
tcl-a61a0e3df9df21ead49108d82842a48617cb0c09.tar.gz
tcl-a61a0e3df9df21ead49108d82842a48617cb0c09.tar.bz2
bug fix for [42202ba1e5ff566e0f9abb9f890e460fbc6c1c5c]: segfault by coro injectfix_42202ba1e5ff566e
rewritten callback for ::tcl::unsupported::inject, without leave the interpreter in unusable state (inaccurate environment exchange by adding eval callback), test covered now.
Diffstat (limited to 'tests')
-rw-r--r--tests/coroutine.test39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/coroutine.test b/tests/coroutine.test
index 205da67..fd68567 100644
--- a/tests/coroutine.test
+++ b/tests/coroutine.test
@@ -741,6 +741,45 @@ test coroutine-7.12 {coro floor above street level #3008307} -body {
list
} -result {}
+test coroutine-8.0.0 {coro inject executed} -body {
+ coroutine demo apply {{} { foreach i {1 2} yield }}
+ demo
+ set ::result none
+ tcl::unsupported::inject demo set ::result inject-executed
+ demo
+ set ::result
+} -result {inject-executed}
+test coroutine-8.0.1 {coro inject after error} -body {
+ coroutine demo apply {{} { foreach i {1 2} yield; error test }}
+ demo
+ set ::result none
+ tcl::unsupported::inject demo set ::result inject-executed
+ lappend ::result [catch {demo} err] $err
+} -result {inject-executed 1 test}
+test coroutine-8.1.1 {coro inject, ticket 42202ba1e5ff566e} -body {
+ interp create slave
+ slave eval {
+ coroutine demo apply {{} { while {1} yield }}
+ demo
+ tcl::unsupported::inject demo set ::result inject-executed
+ }
+ interp delete slave
+} -result {}
+test coroutine-8.1.2 {coro inject with result, ticket 42202ba1e5ff566e} -body {
+ interp create slave
+ slave eval {
+ coroutine demo apply {{} { while {1} yield }}
+ demo
+ tcl::unsupported::inject demo set ::result inject-executed
+ }
+ slave eval demo
+ set result [slave eval {set ::result}]
+
+ interp delete slave
+ set result
+} -result {inject-executed}
+
+
# cleanup
unset lambda