summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-07-22 15:28:39 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-07-22 15:28:39 (GMT)
commit7fba80338f20600d84ce7685436e377329c4c970 (patch)
tree22bb3fc72039ecedc02f781fee4ef2e05dd2dd69
parent55bf49d15f4347284e30f07c67f8043b0669704f (diff)
downloadtcl-7fba80338f20600d84ce7685436e377329c4c970.zip
tcl-7fba80338f20600d84ce7685436e377329c4c970.tar.gz
tcl-7fba80338f20600d84ce7685436e377329c4c970.tar.bz2
Convert test-cases to do proper setup/cleanup
-rw-r--r--tests/io.test46
1 files changed, 29 insertions, 17 deletions
diff --git a/tests/io.test b/tests/io.test
index 1a30850..86e426c 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -6719,8 +6719,9 @@ test io-49.5 {testing crlf reading, leftover cr disgorgment} {
set l
} [list 7 a\rb\rc 7 {} 7 1]
-test io-50.1 {testing handler deletion} testchannelevent {
+test io-50.1 {testing handler deletion} -constraints testchannelevent -setup {
file delete $path(test1)
+} -body {
set f [open $path(test1) w]
close $f
set f [open $path(test1) r]
@@ -6732,11 +6733,13 @@ test io-50.1 {testing handler deletion} testchannelevent {
}
set z not_called
update
- close $f
set z
-} called
-test io-50.2 {testing handler deletion with multiple handlers} testchannelevent {
+} -cleanup {
+ close $f
+} -result called
+test io-50.2 {testing handler deletion with multiple handlers} -constraints testchannelevent -setup {
file delete $path(test1)
+} -body {
set f [open $path(test1) w]
close $f
set f [open $path(test1) r]
@@ -6749,12 +6752,14 @@ test io-50.2 {testing handler deletion with multiple handlers} testchannelevent
}
set z ""
update
- close $f
string compare [string tolower $z] \
[list [list called delhandler $f 0] [list called delhandler $f 1]]
-} 0
-test io-50.3 {testing handler deletion with multiple handlers} testchannelevent {
+} -cleanup {
+ close $f
+} -result 0
+test io-50.3 {testing handler deletion with multiple handlers} -constraints testchannelevent -setup {
file delete $path(test1)
+} -body {
set f [open $path(test1) w]
close $f
set f [open $path(test1) r]
@@ -6774,13 +6779,15 @@ test io-50.3 {testing handler deletion with multiple handlers} testchannelevent
}
set z ""
update
- close $f
string compare [string tolower $z] \
[list [list delhandler $f 0 called] \
[list delhandler $f 0 deleted myself]]
-} 0
-test io-50.4 {testing handler deletion vs reentrant calls} testchannelevent {
+} -cleanup {
+ close $f
+} -result 0
+test io-50.4 {testing handler deletion vs reentrant calls} -constraints testchannelevent -setup {
file delete $path(test1)
+} -body {
set f [open $path(test1) w]
close $f
set f [open $path(test1) r]
@@ -6800,11 +6807,13 @@ test io-50.4 {testing handler deletion vs reentrant calls} testchannelevent {
variable u toplevel
variable z ""
update
- close $f
set z
-} {{delrecursive calling recursive} {delrecursive deleting recursive}}
-test io-50.5 {testing handler deletion vs reentrant calls} testchannelevent {
+} -cleanup {
+ close $f
+} -result {{delrecursive calling recursive} {delrecursive deleting recursive}}
+test io-50.5 {testing handler deletion vs reentrant calls} -constraints testchannelevent -setup {
file delete $path(test1)
+} -body {
set f [open $path(test1) w]
close $f
set f [open $path(test1) r]
@@ -6834,10 +6843,12 @@ test io-50.5 {testing handler deletion vs reentrant calls} testchannelevent {
update
close $f
set z
-} [list {del calling recursive} {del deleted notcalled} \
+} -cleanup {
+} -result [list {del calling recursive} {del deleted notcalled} \
{del deleted myself} {del after update}]
-test io-50.6 {testing handler deletion vs reentrant calls} testchannelevent {
+test io-50.6 {testing handler deletion vs reentrant calls} -constraints testchannelevent -setup {
file delete $path(test1)
+} -body {
set f [open $path(test1) w]
close $f
set f [open $path(test1) r]
@@ -6873,9 +6884,10 @@ test io-50.6 {testing handler deletion vs reentrant calls} testchannelevent {
set z ""
set u toplevel
update
- close $f
set z
-} [list {first called} {first called not toplevel} \
+} -cleanup {
+ close $f
+} -result [list {first called} {first called not toplevel} \
{second called, first time} {second called, second time} \
{first after update}]