summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-10-14 06:08:50 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-10-14 06:08:50 (GMT)
commitcfc633e793bcf3f8419aac8b7084c13b2f8dbaa4 (patch)
tree58b484a653058cac3bd24fba45dcc1578ac093c5 /tests
parenta09671a0a00f2d3e4abf4747a072da94b0320459 (diff)
parentf70e1f98b3e5235a48e0fbea21515ed7e277e6cd (diff)
downloadtcl-cfc633e793bcf3f8419aac8b7084c13b2f8dbaa4.zip
tcl-cfc633e793bcf3f8419aac8b7084c13b2f8dbaa4.tar.gz
tcl-cfc633e793bcf3f8419aac8b7084c13b2f8dbaa4.tar.bz2
Merge 8.7
Diffstat (limited to 'tests')
-rw-r--r--tests/aaa_exit.test4
-rw-r--r--tests/all.tcl2
-rw-r--r--tests/append.test4
-rw-r--r--tests/appendComp.test10
-rw-r--r--tests/apply.test4
-rw-r--r--tests/assocd.test6
-rw-r--r--tests/async.test4
-rw-r--r--tests/auto-files.zipbin0 -> 4447 bytes
-rw-r--r--tests/auto0/auto1/file1.tcl3
-rw-r--r--tests/auto0/auto1/package1.tcl5
-rw-r--r--tests/auto0/auto1/pkgIndex.tcl11
-rw-r--r--tests/auto0/auto1/tclIndex9
-rw-r--r--tests/auto0/auto2/file2.tcl3
-rw-r--r--tests/auto0/auto2/package2.tcl5
-rw-r--r--tests/auto0/auto2/pkgIndex.tcl11
-rw-r--r--tests/auto0/auto2/tclIndex9
-rw-r--r--tests/auto0/modules/mod1/test1-1.0.tm5
-rw-r--r--tests/auto0/modules/mod2/test2-2.0.tm5
-rw-r--r--tests/auto0/modules/test0-0.5.tm5
-rw-r--r--tests/autoMkindex.test26
-rw-r--r--tests/basic.test12
-rw-r--r--tests/binary.test4
-rw-r--r--tests/case.test4
-rw-r--r--tests/chan.test6
-rw-r--r--tests/chanio.test263
-rw-r--r--tests/clock.test81
-rw-r--r--tests/cmdAH.test6
-rw-r--r--tests/cmdIL.test5
-rw-r--r--tests/cmdInfo.test6
-rw-r--r--tests/cmdMZ.test6
-rw-r--r--tests/compExpr-old.test5
-rw-r--r--tests/compExpr.test8
-rw-r--r--tests/compile.test7
-rw-r--r--tests/concat.test2
-rw-r--r--tests/config.test4
-rw-r--r--tests/coroutine.test20
-rw-r--r--tests/dcall.test6
-rw-r--r--tests/dict.test2
-rw-r--r--tests/dstring.test2
-rw-r--r--tests/encoding.test8
-rw-r--r--tests/env.test8
-rw-r--r--tests/error.test4
-rw-r--r--tests/eval.test2
-rw-r--r--tests/event.test8
-rw-r--r--tests/exec.test6
-rw-r--r--tests/execute.test106
-rw-r--r--tests/expr-old.test6
-rw-r--r--tests/expr.test4
-rw-r--r--tests/fCmd.test2
-rw-r--r--tests/fileName.test9
-rw-r--r--tests/fileSystem.test7
-rw-r--r--tests/fileSystemEncoding.test7
-rw-r--r--tests/for-old.test4
-rw-r--r--tests/for.test4
-rw-r--r--tests/foreach.test4
-rw-r--r--tests/format.test4
-rw-r--r--tests/get.test10
-rw-r--r--tests/history.test2
-rw-r--r--tests/http.test11
-rw-r--r--tests/http11.test252
-rw-r--r--tests/httpPipeline.test8
-rw-r--r--tests/httpTest.tcl12
-rw-r--r--tests/httpcookie.test6
-rw-r--r--tests/httpd11.tcl15
-rw-r--r--tests/if-old.test4
-rw-r--r--tests/if.test4
-rw-r--r--tests/incr-old.test4
-rw-r--r--tests/incr.test2
-rw-r--r--tests/indexObj.test4
-rw-r--r--tests/info.test22
-rw-r--r--tests/init.test12
-rw-r--r--tests/interp.test504
-rw-r--r--tests/io.test329
-rw-r--r--tests/ioCmd.test12
-rw-r--r--tests/ioTrans.test28
-rw-r--r--tests/iogt.test6
-rw-r--r--tests/join.test4
-rw-r--r--tests/lindex.test12
-rw-r--r--tests/link.test2
-rw-r--r--tests/linsert.test4
-rw-r--r--tests/list.test4
-rw-r--r--tests/listObj.test4
-rw-r--r--tests/llength.test4
-rw-r--r--tests/lmap.test2
-rw-r--r--tests/load.test6
-rw-r--r--tests/lpop.test4
-rw-r--r--tests/lrange.test4
-rw-r--r--tests/lrepeat.test4
-rw-r--r--tests/lreplace.test4
-rw-r--r--tests/lsearch.test2
-rw-r--r--tests/lset.test4
-rw-r--r--tests/lsetComp.test4
-rw-r--r--tests/macOSXFCmd.test4
-rw-r--r--tests/macOSXLoad.test4
-rw-r--r--tests/main.test6
-rw-r--r--tests/mathop.test4
-rw-r--r--tests/misc.test4
-rw-r--r--tests/msgcat.test7
-rw-r--r--tests/namespace-old.test2
-rw-r--r--tests/namespace.test107
-rw-r--r--tests/notify.test4
-rw-r--r--tests/nre.test4
-rw-r--r--tests/obj.test6
-rw-r--r--tests/oo.test158
-rw-r--r--tests/ooNext2.test12
-rw-r--r--tests/ooUtil.test6
-rw-r--r--tests/opt.test6
-rw-r--r--tests/package.test12
-rw-r--r--tests/parse.test24
-rw-r--r--tests/parseExpr.test6
-rw-r--r--tests/parseOld.test6
-rw-r--r--tests/pid.test4
-rw-r--r--tests/pkgMkIndex.test28
-rw-r--r--tests/platform.test2
-rw-r--r--tests/proc-old.test4
-rw-r--r--tests/proc.test8
-rw-r--r--tests/process.test4
-rw-r--r--tests/pwd.test4
-rw-r--r--tests/reg.test7
-rw-r--r--tests/regexp.test13
-rw-r--r--tests/regexpComp.test4
-rw-r--r--tests/registry.test4
-rw-r--r--tests/rename.test4
-rw-r--r--tests/resolver.test6
-rw-r--r--tests/result.test6
-rw-r--r--tests/safe-stock.test248
-rw-r--r--tests/safe-zipfs.test729
-rw-r--r--tests/safe.test952
-rw-r--r--tests/scan.test12
-rw-r--r--tests/security.test2
-rw-r--r--tests/set-old.test4
-rw-r--r--tests/set.test4
-rw-r--r--tests/socket.test43
-rw-r--r--tests/split.test4
-rw-r--r--tests/stack.test6
-rw-r--r--tests/string.test27
-rw-r--r--tests/stringObj.test8
-rw-r--r--tests/subst.test18
-rw-r--r--tests/switch.test2
-rw-r--r--tests/tailcall.test4
-rw-r--r--tests/tcltest.test170
-rw-r--r--tests/tcltests.tcl2
-rw-r--r--tests/thread.test10
-rw-r--r--tests/timer.test16
-rw-r--r--tests/tm.test3
-rw-r--r--tests/trace.test16
-rw-r--r--tests/unixFCmd.test4
-rw-r--r--tests/unixFile.test4
-rw-r--r--tests/unixForkEvent.test6
-rw-r--r--tests/unixInit.test6
-rw-r--r--tests/unixNotfy.test4
-rw-r--r--tests/unknown.test6
-rw-r--r--tests/unload.test8
-rw-r--r--tests/uplevel.test21
-rw-r--r--tests/upvar.test4
-rw-r--r--tests/utf.test4
-rw-r--r--tests/util.test19
-rw-r--r--tests/var.test8
-rw-r--r--tests/while-old.test4
-rw-r--r--tests/while.test2
-rw-r--r--tests/winConsole.test4
-rw-r--r--tests/winDde.test187
-rw-r--r--tests/winFCmd.test6
-rw-r--r--tests/winFile.test7
-rw-r--r--tests/winNotify.test4
-rw-r--r--tests/winPipe.test6
-rw-r--r--tests/winTime.test4
-rw-r--r--tests/zipfs.test2
-rw-r--r--tests/zlib.test86
169 files changed, 3891 insertions, 1363 deletions
diff --git a/tests/aaa_exit.test b/tests/aaa_exit.test
index 3ba5167..d4d2a7c 100644
--- a/tests/aaa_exit.test
+++ b/tests/aaa_exit.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/all.tcl b/tests/all.tcl
index 52c8763..c72334a 100644
--- a/tests/all.tcl
+++ b/tests/all.tcl
@@ -1,7 +1,7 @@
# all.tcl --
#
# This file contains a top-level script to run all of the Tcl
-# tests. Execute it by invoking "source all.test" when running tcltest
+# tests. Execute it by invoking "source all.tcl" when running tcltest
# in this directory.
#
# Copyright (c) 1998-1999 by Scriptics Corporation.
diff --git a/tests/append.test b/tests/append.test
index 8fa4e61..ef4a194 100644
--- a/tests/append.test
+++ b/tests/append.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
unset -nocomplain x
diff --git a/tests/appendComp.test b/tests/appendComp.test
index bbf5f9c..66941a9 100644
--- a/tests/appendComp.test
+++ b/tests/appendComp.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
catch {unset x}
@@ -359,9 +359,9 @@ test appendComp-7.9 {append var does not trigger read trace} -setup {
} -result {0}
test appendComp-8.1 {defer error to runtime} -setup {
- interp create slave
+ interp create child
} -body {
- slave eval {
+ child eval {
proc foo {} {
proc append args {}
append
@@ -369,7 +369,7 @@ test appendComp-8.1 {defer error to runtime} -setup {
foo
}
} -cleanup {
- interp delete slave
+ interp delete child
} -result {}
# New tests for bug 3057639 to show off the more consistent behaviour of
diff --git a/tests/apply.test b/tests/apply.test
index 597cd97..227d3c1 100644
--- a/tests/apply.test
+++ b/tests/apply.test
@@ -12,8 +12,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2.2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/assocd.test b/tests/assocd.test
index edf55c4..7d89daa 100644
--- a/tests/assocd.test
+++ b/tests/assocd.test
@@ -11,8 +11,10 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
-namespace import ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
diff --git a/tests/async.test b/tests/async.test
index df13f83..ad058a0 100644
--- a/tests/async.test
+++ b/tests/async.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/auto-files.zip b/tests/auto-files.zip
new file mode 100644
index 0000000..b8bdf88
--- /dev/null
+++ b/tests/auto-files.zip
Binary files differ
diff --git a/tests/auto0/auto1/file1.tcl b/tests/auto0/auto1/file1.tcl
new file mode 100644
index 0000000..bd8b92b
--- /dev/null
+++ b/tests/auto0/auto1/file1.tcl
@@ -0,0 +1,3 @@
+proc report1 {args} {
+ return ok1
+}
diff --git a/tests/auto0/auto1/package1.tcl b/tests/auto0/auto1/package1.tcl
new file mode 100644
index 0000000..32d7c56
--- /dev/null
+++ b/tests/auto0/auto1/package1.tcl
@@ -0,0 +1,5 @@
+proc HeresPackage1 {args} {
+ return OK1
+}
+
+package provide SafeTestPackage1 1.2.3
diff --git a/tests/auto0/auto1/pkgIndex.tcl b/tests/auto0/auto1/pkgIndex.tcl
new file mode 100644
index 0000000..babb6d5
--- /dev/null
+++ b/tests/auto0/auto1/pkgIndex.tcl
@@ -0,0 +1,11 @@
+# Tcl package index file, version 1.1
+# This file is generated by the "pkg_mkIndex" command
+# and sourced either when an application starts up or
+# by a "package unknown" script. It invokes the
+# "package ifneeded" command to set up package-related
+# information so that packages will be loaded automatically
+# in response to "package require" commands. When this
+# script is sourced, the variable $dir must contain the
+# full path name of this file's directory.
+
+package ifneeded SafeTestPackage1 1.2.3 [list source [file join $dir package1.tcl]]
diff --git a/tests/auto0/auto1/tclIndex b/tests/auto0/auto1/tclIndex
new file mode 100644
index 0000000..bbfa6d4
--- /dev/null
+++ b/tests/auto0/auto1/tclIndex
@@ -0,0 +1,9 @@
+# Tcl autoload index file, version 2.0
+# This file is generated by the "auto_mkindex" command
+# and sourced to set up indexing information for one or
+# more commands. Typically each line is a command that
+# sets an element in the auto_index array, where the
+# element name is the name of a command and the value is
+# a script that loads the command.
+
+set auto_index(report1) [list source [file join $dir file1.tcl]]
diff --git a/tests/auto0/auto2/file2.tcl b/tests/auto0/auto2/file2.tcl
new file mode 100644
index 0000000..5bc622f
--- /dev/null
+++ b/tests/auto0/auto2/file2.tcl
@@ -0,0 +1,3 @@
+proc report2 {args} {
+ return ok2
+}
diff --git a/tests/auto0/auto2/package2.tcl b/tests/auto0/auto2/package2.tcl
new file mode 100644
index 0000000..61774df
--- /dev/null
+++ b/tests/auto0/auto2/package2.tcl
@@ -0,0 +1,5 @@
+proc HeresPackage2 {args} {
+ return OK2
+}
+
+package provide SafeTestPackage2 2.3.4
diff --git a/tests/auto0/auto2/pkgIndex.tcl b/tests/auto0/auto2/pkgIndex.tcl
new file mode 100644
index 0000000..1022691
--- /dev/null
+++ b/tests/auto0/auto2/pkgIndex.tcl
@@ -0,0 +1,11 @@
+# Tcl package index file, version 1.1
+# This file is generated by the "pkg_mkIndex" command
+# and sourced either when an application starts up or
+# by a "package unknown" script. It invokes the
+# "package ifneeded" command to set up package-related
+# information so that packages will be loaded automatically
+# in response to "package require" commands. When this
+# script is sourced, the variable $dir must contain the
+# full path name of this file's directory.
+
+package ifneeded SafeTestPackage2 2.3.4 [list source [file join $dir package2.tcl]]
diff --git a/tests/auto0/auto2/tclIndex b/tests/auto0/auto2/tclIndex
new file mode 100644
index 0000000..9cd2a74
--- /dev/null
+++ b/tests/auto0/auto2/tclIndex
@@ -0,0 +1,9 @@
+# Tcl autoload index file, version 2.0
+# This file is generated by the "auto_mkindex" command
+# and sourced to set up indexing information for one or
+# more commands. Typically each line is a command that
+# sets an element in the auto_index array, where the
+# element name is the name of a command and the value is
+# a script that loads the command.
+
+set auto_index(report2) [list source [file join $dir file2.tcl]]
diff --git a/tests/auto0/modules/mod1/test1-1.0.tm b/tests/auto0/modules/mod1/test1-1.0.tm
new file mode 100644
index 0000000..927fa6f
--- /dev/null
+++ b/tests/auto0/modules/mod1/test1-1.0.tm
@@ -0,0 +1,5 @@
+namespace eval mod1::test1 {}
+
+proc mod1::test1::try1 args {
+ return res1
+}
diff --git a/tests/auto0/modules/mod2/test2-2.0.tm b/tests/auto0/modules/mod2/test2-2.0.tm
new file mode 100644
index 0000000..b5cd45b
--- /dev/null
+++ b/tests/auto0/modules/mod2/test2-2.0.tm
@@ -0,0 +1,5 @@
+namespace eval mod2::test2 {}
+
+proc mod2::test2::try2 args {
+ return res2
+}
diff --git a/tests/auto0/modules/test0-0.5.tm b/tests/auto0/modules/test0-0.5.tm
new file mode 100644
index 0000000..19f3613
--- /dev/null
+++ b/tests/auto0/modules/test0-0.5.tm
@@ -0,0 +1,5 @@
+namespace eval test0 {}
+
+proc test0::try0 args {
+ return res0
+}
diff --git a/tests/autoMkindex.test b/tests/autoMkindex.test
index b42d50d..8662888 100644
--- a/tests/autoMkindex.test
+++ b/tests/autoMkindex.test
@@ -10,7 +10,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -146,10 +146,10 @@ test autoMkindex-1.3 {examine tclIndex} -setup {
test autoMkindex-2.1 {commands on the autoload path can be imported} -setup {
file delete tclIndex
- interp create slave
+ interp create child
} -body {
auto_mkindex . autoMkindex.tcl
- slave eval {
+ child eval {
namespace eval blt {}
set auto_path [linsert $auto_path 0 .]
set info [list [catch {namespace import buried::*} result] $result]
@@ -159,22 +159,22 @@ test autoMkindex-2.1 {commands on the autoload path can be imported} -setup {
return $info
}
} -cleanup {
- interp delete slave
+ interp delete child
} -result "0 {} pub_one ::buried::pub_one pub_two ::buried::pub_two"
# Test auto_mkindex hooks
-# Slave hook executes interesting code in the interp used to watch code.
-test autoMkindex-3.1 {slaveHook} -setup {
+# Child hook executes interesting code in the interp used to watch code.
+test autoMkindex-3.1 {childHook} -setup {
file delete tclIndex
} -body {
- auto_mkindex_parser::slavehook {
+ auto_mkindex_parser::childhook {
_%@namespace eval ::blt {
proc foo {} {}
_%@namespace export foo
}
}
- auto_mkindex_parser::slavehook { _%@namespace import -force ::blt::* }
+ auto_mkindex_parser::childhook { _%@namespace import -force ::blt::* }
auto_mkindex . autoMkindex.tcl
file exists tclIndex
} -cleanup {
@@ -335,14 +335,14 @@ test autoMkindex-5.2 {correctly locate auto loaded procs with []} -setup {
proc {[magic mojo proc]} {} {}
} [file join pkg magicchar2.tcl]
set result {}
- interp create slave
+ interp create child
} -body {
auto_mkindex . pkg/magicchar2.tcl
- # Make a slave interp to test the autoloading
- slave eval {lappend auto_path [pwd]}
- slave eval {catch {{[magic mojo proc]}}}
+ # Make a child interp to test the autoloading
+ child eval {lappend auto_path [pwd]}
+ child eval {catch {{[magic mojo proc]}}}
} -cleanup {
- interp delete slave
+ interp delete child
removeFile [file join pkg magicchar2.tcl]
removeDirectory pkg
} -result 0
diff --git a/tests/basic.test b/tests/basic.test
index 428fd93..38ea11e 100644
--- a/tests/basic.test
+++ b/tests/basic.test
@@ -15,8 +15,10 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
-namespace import ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
@@ -999,13 +1001,13 @@ test basic-49.2 {Tcl_EvalEx: verify TCL_EVAL_GLOBAL operation} testevalex {
} {global}
test basic-50.1 {[586e71dce4] EvalObjv level #0 exception handling} -setup {
- interp create slave
- interp alias {} foo slave return
+ interp create child
+ interp alias {} foo child return
} -body {
list [catch foo m] $m
} -cleanup {
unset -nocomplain m
- interp delete slave
+ interp delete child
} -result {0 {}}
# Clean up after expand tests
diff --git a/tests/binary.test b/tests/binary.test
index b06afe0..cf3195f 100644
--- a/tests/binary.test
+++ b/tests/binary.test
@@ -10,8 +10,8 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
testConstraint bigEndian [expr {$tcl_platform(byteOrder) eq "bigEndian"}]
diff --git a/tests/case.test b/tests/case.test
index d7558a9..87cb2c8 100644
--- a/tests/case.test
+++ b/tests/case.test
@@ -16,8 +16,8 @@ if {![llength [info commands case]]} {
return
}
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/chan.test b/tests/chan.test
index 6808453..5d05935 100644
--- a/tests/chan.test
+++ b/tests/chan.test
@@ -7,8 +7,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -173,7 +173,7 @@ test chan-16.9 {chan command: pending input subcommand} -setup {
lappend ::chan-16.9-data $r $l $e $b $i
- if {$r != -1 || $e || $l || !$b || $i > 128} {
+ if {$r >= 0 || $e || $l || !$b || $i > 128} {
set data [read $sock $i]
lappend ::chan-16.9-data [string range $data 0 2]
lappend ::chan-16.9-data [string range $data end-2 end]
diff --git a/tests/chanio.test b/tests/chanio.test
index c7c07ce..daacdd0 100644
--- a/tests/chanio.test
+++ b/tests/chanio.test
@@ -13,13 +13,17 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-# TODO: This test is likely worthless. Confirm and remove
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
}
namespace eval ::tcl::test::io {
- namespace import ::tcltest::*
+
+ if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+ }
variable umaskValue
variable path
@@ -39,11 +43,12 @@ namespace eval ::tcl::test::io {
testConstraint testbytestring [llength [info commands testbytestring]]
testConstraint testchannel [llength [info commands testchannel]]
- testConstraint openpipe 1
testConstraint testfevent [llength [info commands testfevent]]
testConstraint testchannelevent [llength [info commands testchannelevent]]
testConstraint testmainthread [llength [info commands testmainthread]]
+ testConstraint testservicemode [llength [info commands testservicemode]]
testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}]
+ testConstraint notOSX [expr {$::tcl_platform(os) ne "Darwin"}]
# You need a *very* special environment to do some tests. In particular,
# many file systems do not support large-files...
@@ -448,7 +453,7 @@ test chan-io-6.6 {Tcl_GetsObj: loop test} -body {
} -cleanup {
chan close $f
} -result [list 256 $a]
-test chan-io-6.7 {Tcl_GetsObj: error in input} -constraints {stdio openpipe} -body {
+test chan-io-6.7 {Tcl_GetsObj: error in input} -constraints stdio -body {
# if (FilterInputBytes(chanPtr, &gs) != 0)
set f [openpipe w+ $path(cat)]
chan puts -nonewline $f "hi\nwould"
@@ -709,7 +714,7 @@ test chan-io-6.30 {Tcl_GetsObj: crlf mode: buffer exhausted} -constraints {testc
} -result [list 15 "123456789012345" 15]
test chan-io-6.31 {Tcl_GetsObj: crlf mode: buffer exhausted, blocked} -setup {
set x ""
-} -constraints {stdio testchannel openpipe fileevent} -body {
+} -constraints {stdio testchannel fileevent} -body {
# (FilterInputBytes() != 0)
set f [openpipe w+ $path(cat)]
chan configure $f -translation {crlf lf} -buffering none
@@ -849,7 +854,7 @@ test chan-io-6.42 {Tcl_GetsObj: auto mode: several chars} -setup {
} -result {4 abcd 4 efgh 4 ijkl 4 mnop -1 {}}
test chan-io-6.43 {Tcl_GetsObj: input saw cr} -setup {
set x ""
-} -constraints {stdio testchannel openpipe fileevent} -body {
+} -constraints {stdio testchannel fileevent} -body {
# if (chanPtr->flags & INPUT_SAW_CR)
set f [openpipe w+ $path(cat)]
chan configure $f -translation {auto lf} -buffering none
@@ -867,7 +872,7 @@ test chan-io-6.43 {Tcl_GetsObj: input saw cr} -setup {
} -result {bbbbbbbbbbbbbbb 15 123456789abcdef 1 4 abcd 0 3 efg}
test chan-io-6.44 {Tcl_GetsObj: input saw cr, not followed by cr} -setup {
set x ""
-} -constraints {stdio testchannel openpipe fileevent} -body {
+} -constraints {stdio testchannel fileevent} -body {
# not (*eol == '\n')
set f [openpipe w+ $path(cat)]
chan configure $f -translation {auto lf} -buffering none
@@ -885,7 +890,7 @@ test chan-io-6.44 {Tcl_GetsObj: input saw cr, not followed by cr} -setup {
} -result {bbbbbbbbbbbbbbb 15 123456789abcdef 1 4 abcd 0 3 efg}
test chan-io-6.45 {Tcl_GetsObj: input saw cr, skip right number of bytes} -setup {
set x ""
-} -constraints {stdio testchannel openpipe fileevent} -body {
+} -constraints {stdio testchannel fileevent} -body {
# Tcl_ExternalToUtf()
set f [openpipe w+ $path(cat)]
chan configure $f -translation {auto lf} -buffering none
@@ -903,7 +908,7 @@ test chan-io-6.45 {Tcl_GetsObj: input saw cr, skip right number of bytes} -setup
} -result {15 123456789abcdef 1 4 abcd 0}
test chan-io-6.46 {Tcl_GetsObj: input saw cr, followed by just \n should give eof} -setup {
set x ""
-} -constraints {stdio testchannel openpipe fileevent} -body {
+} -constraints {stdio testchannel fileevent} -body {
# memmove()
set f [openpipe w+ $path(cat)]
chan configure $f -translation {auto lf} -buffering none
@@ -1021,7 +1026,7 @@ test chan-io-6.55 {Tcl_GetsObj: overconverted} -body {
test chan-io-6.56 {Tcl_GetsObj: incomplete lines should disable file events} -setup {
update
variable x {}
-} -constraints {stdio openpipe fileevent} -body {
+} -constraints {stdio fileevent} -body {
set f [openpipe w+ $path(cat)]
chan configure $f -buffering none
chan puts -nonewline $f "foobar"
@@ -1088,7 +1093,7 @@ test chan-io-7.3 {FilterInputBytes: split up character at EOF} -setup {
} -result [list 15 "1234567890123\uff10\uff11" 18 0 1 -1 ""]
test chan-io-7.4 {FilterInputBytes: recover from split up character} -setup {
variable x ""
-} -constraints {stdio openpipe fileevent} -body {
+} -constraints {stdio fileevent} -body {
set f [openpipe w+ $path(cat)]
chan configure $f -encoding binary -buffering none
chan puts -nonewline $f "1234567890123\x82\x4f\x82\x50\x82"
@@ -1122,7 +1127,7 @@ test chan-io-8.1 {PeekAhead: only go to device if no more cached data} -constrai
} -result 7
test chan-io-8.2 {PeekAhead: only go to device if no more cached data} -setup {
variable x {}
-} -constraints {stdio testchannel openpipe fileevent} -body {
+} -constraints {stdio testchannel fileevent} -body {
# not (bufPtr->nextPtr == NULL)
set f [openpipe w+ $path(cat)]
chan configure $f -translation lf -encoding ascii -buffering none
@@ -1139,7 +1144,7 @@ test chan-io-8.2 {PeekAhead: only go to device if no more cached data} -setup {
} -cleanup {
chan close $f
} -result {-1 {} 42 15 123456789012345 25}
-test chan-io-8.3 {PeekAhead: no cached data available} -constraints {stdio testchannel openpipe fileevent} -body {
+test chan-io-8.3 {PeekAhead: no cached data available} -constraints {stdio testchannel fileevent} -body {
# (bytesLeft == 0)
set f [openpipe w+ $path(cat)]
chan configure $f -translation {auto binary}
@@ -1168,7 +1173,7 @@ test chan-io-8.4 {PeekAhead: cached data available in this buffer} -body {
chan close $f
} -result $a
unset a
-test chan-io-8.5 {PeekAhead: don't peek if last read was short} -constraints {stdio testchannel openpipe fileevent} -body {
+test chan-io-8.5 {PeekAhead: don't peek if last read was short} -constraints {stdio testchannel fileevent} -body {
# (bufPtr->nextAdded < bufPtr->length)
set f [openpipe w+ $path(cat)]
chan configure $f -translation {auto binary}
@@ -1179,7 +1184,7 @@ test chan-io-8.5 {PeekAhead: don't peek if last read was short} -constraints {st
} -cleanup {
chan close $f
} -result {15 abcdefghijklmno 1}
-test chan-io-8.6 {PeekAhead: change to non-blocking mode} -constraints {stdio testchannel openpipe fileevent} -body {
+test chan-io-8.6 {PeekAhead: change to non-blocking mode} -constraints {stdio testchannel fileevent} -body {
# ((chanPtr->flags & CHANNEL_NONBLOCKING) == 0)
set f [openpipe w+ $path(cat)]
chan configure $f -translation {auto binary} -buffersize 16
@@ -1192,7 +1197,7 @@ test chan-io-8.6 {PeekAhead: change to non-blocking mode} -constraints {stdio te
} -result {15 abcdefghijklmno 1}
test chan-io-8.7 {PeekAhead: cleanup} -setup {
set x ""
-} -constraints {stdio testchannel openpipe fileevent} -body {
+} -constraints {stdio testchannel fileevent} -body {
# Make sure bytes are removed from buffer.
set f [openpipe w+ $path(cat)]
chan configure $f -translation {auto binary} -buffering none
@@ -1343,7 +1348,7 @@ test chan-io-12.3 {ReadChars: allocate more space} -body {
} -result {abcdefghijklmnopqrstuvwxyz}
test chan-io-12.4 {ReadChars: split-up char} -setup {
variable x {}
-} -constraints {stdio testchannel openpipe fileevent} -body {
+} -constraints {stdio testchannel fileevent} -body {
# (srcRead == 0)
set f [openpipe w+ $path(cat)]
chan configure $f -encoding binary -buffering none -buffersize 16
@@ -1365,7 +1370,7 @@ test chan-io-12.4 {ReadChars: split-up char} -setup {
} -result [list "123456789012345" 1 "\u672c" 0]
test chan-io-12.5 {ReadChars: chan events on partial characters} -setup {
variable x {}
-} -constraints {stdio openpipe fileevent} -body {
+} -constraints {stdio fileevent} -body {
set path(test1) [makeFile {
chan configure stdout -encoding binary -buffering none
chan gets stdin; chan puts -nonewline "\xe7"
@@ -1458,7 +1463,7 @@ test chan-io-13.5 {TranslateInputEOL: crlf mode: naked lf} -body {
test chan-io-13.6 {TranslateInputEOL: auto mode: saw cr in last segment} -setup {
variable x {}
variable y {}
-} -constraints {stdio testchannel openpipe fileevent} -body {
+} -constraints {stdio testchannel fileevent} -body {
# (chanPtr->flags & INPUT_SAW_CR)
# This test may fail on slower machines.
set f [openpipe w+ $path(cat)]
@@ -1476,7 +1481,7 @@ test chan-io-13.6 {TranslateInputEOL: auto mode: saw cr in last segment} -setup
} -cleanup {
chan close $f
} -result [list "abcdefghj\n" 1 "01234" 0]
-test chan-io-13.7 {TranslateInputEOL: auto mode: naked \r} -constraints {testchannel openpipe} -body {
+test chan-io-13.7 {TranslateInputEOL: auto mode: naked \r} -constraints testchannel -body {
# (src >= srcMax)
set f [open $path(test1) w]
chan configure $f -translation lf
@@ -1577,7 +1582,7 @@ test chan-io-14.2 {Tcl_SetStdChannel and Tcl_GetStdChannel} -setup {
interp delete x
} -result {line line none}
set path(test3) [makeFile {} test3]
-test chan-io-14.3 {Tcl_SetStdChannel & Tcl_GetStdChannel} -constraints {exec openpipe} -body {
+test chan-io-14.3 {Tcl_SetStdChannel & Tcl_GetStdChannel} -constraints exec -body {
set f [open $path(test1) w]
chan puts -nonewline $f {
chan close stdin
@@ -1674,7 +1679,7 @@ set path(script) [makeFile {} script]
test chan-io-14.8 {reuse of stdio special channels} -setup {
file delete $path(script)
file delete $path(test1)
-} -constraints {stdio openpipe} -body {
+} -constraints stdio -body {
set f [open $path(script) w]
chan puts -nonewline $f {
chan close stderr
@@ -1697,7 +1702,7 @@ test chan-io-14.8 {reuse of stdio special channels} -setup {
test chan-io-14.9 {reuse of stdio special channels} -setup {
file delete $path(script)
file delete $path(test1)
-} -constraints {stdio openpipe fileevent} -body {
+} -constraints {stdio fileevent} -body {
set f [open $path(script) w]
chan puts $f {
array set path [lindex $argv 0]
@@ -1881,7 +1886,7 @@ test chan-io-20.3 {Tcl_CreateChannel: initial settings} -constraints {unix} -bod
} -result {{{} {}} {auto lf}}
test chan-io-20.5 {Tcl_CreateChannel: install channel in empty slot} -setup {
set path(stdout) [makeFile {} stdout]
-} -constraints {stdio openpipe knownMsvcBug} -body {
+} -constraints {stdio knownMsvcBug} -body {
set f [open $path(script) w]
chan puts -nonewline $f {
chan close stdout
@@ -1966,7 +1971,7 @@ test chan-io-26.1 {Tcl_GetChannelInstanceData} -body {
# Don't care what pid is (but must be a number), just want to exercise it.
set f [openpipe r << exit]
pid $f
-} -constraints {stdio openpipe} -cleanup {
+} -constraints stdio -cleanup {
chan close $f
} -match regexp -result {^\d+$}
@@ -2041,7 +2046,7 @@ set path(output) [makeFile {} output]
test chan-io-27.6 {FlushChannel, async flushing, async chan close} -setup {
file delete $path(pipe)
file delete $path(output)
-} -constraints {stdio asyncPipeChan Close openpipe} -body {
+} -constraints {stdio asyncPipeChan Close} -body {
set f [open $path(pipe) w]
chan puts $f "set f \[[list open $path(output) w]]"
chan puts $f {
@@ -2111,7 +2116,7 @@ test chan-io-28.2 {Chan CloseChannel called when all references are dropped} -se
test chan-io-28.3 {Chan CloseChannel, not called before output queue is empty} -setup {
file delete $path(pipe)
file delete $path(output)
-} -constraints {stdio asyncPipeChan Close nonPortable openpipe} -body {
+} -constraints {stdio asyncPipeChan Close nonPortable} -body {
set f [open $path(pipe) w]
chan puts $f {
# Need to not have eof char appended on chan close, because the other
@@ -2165,7 +2170,7 @@ test chan-io-28.4 {Tcl_Chan Close} -constraints {testchannel} -setup {
} -result ok
test chan-io-28.5 {Tcl_Chan Close vs standard handles} -setup {
file delete $path(script)
-} -constraints {stdio unix testchannel openpipe} -body {
+} -constraints {stdio unix testchannel} -body {
set f [open $path(script) w]
chan puts $f {
chan close stdin
@@ -2382,7 +2387,7 @@ test chan-io-29.11 {Tcl_WriteChars, no newline, implicit flush} -setup {
test chan-io-29.12 {Tcl_WriteChars on a pipe} -setup {
file delete $path(test1)
file delete $path(pipe)
-} -constraints {stdio openpipe} -body {
+} -constraints stdio -body {
set f1 [open $path(pipe) w]
chan puts $f1 "set f1 \[[list open $path(longfile) r]]"
chan puts $f1 {
@@ -2409,7 +2414,7 @@ test chan-io-29.12 {Tcl_WriteChars on a pipe} -setup {
test chan-io-29.13 {Tcl_WriteChars to a pipe, line buffered} -setup {
file delete $path(test1)
file delete $path(pipe)
-} -constraints {stdio openpipe} -body {
+} -constraints stdio -body {
set f1 [open $path(pipe) w]
chan puts $f1 {
chan puts [chan gets stdin]
@@ -2462,7 +2467,7 @@ test chan-io-29.15 {Tcl_Flush, channel not open for writing} -setup {
} -match glob -result {channel "*" wasn't opened for writing}
test chan-io-29.16 {Tcl_Flush on pipe opened only for reading} -setup {
set fd [openpipe r cat longfile]
-} -constraints {stdio openpipe} -body {
+} -constraints stdio -body {
chan flush $fd
} -returnCodes error -cleanup {
catch {chan close $fd}
@@ -2538,7 +2543,7 @@ test chan-io-29.20 {Implicit flush when buffer is full} -setup {
} -result {4096 12288 12600}
test chan-io-29.21 {Tcl_Flush to pipe} -setup {
file delete $path(pipe)
-} -constraints {stdio openpipe} -body {
+} -constraints stdio -body {
set f1 [open $path(pipe) w]
chan puts $f1 {set x [chan read stdin 6]}
chan puts $f1 {set cnt [string length $x]}
@@ -2553,7 +2558,7 @@ test chan-io-29.21 {Tcl_Flush to pipe} -setup {
} -result "read 6 characters"
test chan-io-29.22 {Tcl_Flush called at other end of pipe} -setup {
file delete $path(pipe)
-} -constraints {stdio openpipe} -body {
+} -constraints stdio -body {
set f1 [open $path(pipe) w]
chan puts $f1 {
chan configure stdout -buffering full
@@ -2577,7 +2582,7 @@ test chan-io-29.22 {Tcl_Flush called at other end of pipe} -setup {
} -result {hello hello bye}
test chan-io-29.23 {Tcl_Flush and line buffering at end of pipe} -setup {
file delete $path(pipe)
-} -constraints {stdio openpipe} -body {
+} -constraints stdio -body {
set f1 [open $path(pipe) w]
chan puts $f1 {
chan puts hello
@@ -2614,7 +2619,7 @@ test chan-io-29.24 {Tcl_WriteChars and Tcl_Flush move end of file} -setup {
} -result "{} {Line 1\nLine 2}"
test chan-io-29.25 {Implicit flush with Tcl_Flush to command pipelines} -setup {
file delete $path(test3)
-} -constraints {stdio openpipe fileevent} -body {
+} -constraints {stdio fileevent} -body {
set f [openpipe w $path(cat) | [interpreter] $path(cat) > $path(test3)]
chan puts $f "Line 1"
chan puts $f "Line 2"
@@ -2625,7 +2630,7 @@ test chan-io-29.25 {Implicit flush with Tcl_Flush to command pipelines} -setup {
} -cleanup {
chan close $f
} -result "Line 1\nLine 2\n"
-test chan-io-29.26 {Tcl_Flush, Tcl_Write on bidirectional pipelines} -constraints {stdio unixExecs openpipe} -body {
+test chan-io-29.26 {Tcl_Flush, Tcl_Write on bidirectional pipelines} -constraints {stdio unixExecs} -body {
set f [open "|[list cat -u]" r+]
chan puts $f "Line1"
chan flush $f
@@ -2638,7 +2643,7 @@ test chan-io-29.27 {Tcl_Flush on chan closed pipeline} -setup {
set f [open $path(pipe) w]
chan puts $f {exit}
chan close $f
-} -constraints {stdio openpipe} -body {
+} -constraints stdio -body {
set f [openpipe r+ $path(pipe)]
chan gets $f
chan puts $f output
@@ -2691,7 +2696,7 @@ test chan-io-29.30 {Tcl_WriteChars, crlf mode} -setup {
test chan-io-29.31 {Tcl_WriteChars, background flush} -setup {
file delete $path(pipe)
file delete $path(output)
-} -constraints {stdio openpipe} -body {
+} -constraints stdio -body {
set f [open $path(pipe) w]
chan puts $f "set f \[[list open $path(output) w]]"
chan puts $f {chan configure $f -translation lf}
@@ -2724,7 +2729,7 @@ test chan-io-29.31 {Tcl_WriteChars, background flush} -setup {
set result ok
}
# allow a little time for the background process to chan close.
- # otherwise, the following test fails on the [file delete $path(output)
+ # otherwise, the following test fails on the [file delete $path(output)]
# on Windows because a process still has the file open.
after 100 set v 1; vwait v
return $result
@@ -2732,7 +2737,7 @@ test chan-io-29.31 {Tcl_WriteChars, background flush} -setup {
test chan-io-29.32 {Tcl_WriteChars, background flush to slow reader} -setup {
file delete $path(pipe)
file delete $path(output)
-} -constraints {stdio asyncPipeChan Close openpipe} -body {
+} -constraints {stdio asyncPipeChan Close} -body {
set f [open $path(pipe) w]
chan puts $f "set f \[[list open $path(output) w]]"
chan puts $f {chan configure $f -translation lf}
@@ -4005,7 +4010,7 @@ test chan-io-32.9 {Tcl_Read, read to end of file} {
} ok
test chan-io-32.10 {Tcl_Read from a pipe} -setup {
file delete $path(pipe)
-} -constraints {stdio openpipe} -body {
+} -constraints stdio -body {
set f1 [open $path(pipe) w]
chan puts $f1 {chan puts [chan gets stdin]}
chan close $f1
@@ -4019,7 +4024,7 @@ test chan-io-32.10 {Tcl_Read from a pipe} -setup {
test chan-io-32.11 {Tcl_Read from a pipe} -setup {
file delete $path(pipe)
set x ""
-} -constraints {stdio openpipe} -body {
+} -constraints stdio -body {
set f1 [open $path(pipe) w]
chan puts $f1 {chan puts [chan gets stdin]}
chan puts $f1 {chan puts [chan gets stdin]}
@@ -4131,7 +4136,7 @@ test chan-io-33.2 {Tcl_Gets into variable} {
} ok
test chan-io-33.3 {Tcl_Gets from pipe} -setup {
file delete $path(pipe)
-} -constraints {stdio openpipe} -body {
+} -constraints stdio -body {
set f1 [open $path(pipe) w]
chan puts $f1 {chan puts [chan gets stdin]}
chan close $f1
@@ -4341,7 +4346,7 @@ test chan-io-34.7 {Tcl_Seek to offset from end of file, then to current position
} -result {44 rstuv 49}
test chan-io-34.8 {Tcl_Seek on pipes: not supported} -setup {
set pipe [openpipe]
-} -constraints {stdio openpipe} -body {
+} -constraints stdio -body {
chan seek $pipe 0 current
} -returnCodes error -cleanup {
chan close $pipe
@@ -4451,13 +4456,13 @@ test chan-io-34.15 {Tcl_Tell combined with seeking} -setup {
} -cleanup {
chan close $f1
} -result {10 20}
-test chan-io-34.16 {Tcl_Tell on pipe: always -1} -constraints {stdio openpipe} -body {
+test chan-io-34.16 {Tcl_Tell on pipe: always -1} -constraints stdio -body {
set f1 [openpipe]
chan tell $f1
} -cleanup {
chan close $f1
} -result -1
-test chan-io-34.17 {Tcl_Tell on pipe: always -1} {stdio openpipe} {
+test chan-io-34.17 {Tcl_Tell on pipe: always -1} stdio {
set f1 [openpipe]
chan puts $f1 {chan puts hello}
chan flush $f1
@@ -4559,7 +4564,7 @@ test chan-io-35.1 {Tcl_Eof} -setup {
} -cleanup {
chan close $f
} -result {0 0 0 0 1 1}
-test chan-io-35.2 {Tcl_Eof with pipe} -constraints {stdio openpipe} -setup {
+test chan-io-35.2 {Tcl_Eof with pipe} -constraints stdio -setup {
file delete $path(pipe)
} -body {
set f1 [open $path(pipe) w]
@@ -4578,7 +4583,7 @@ test chan-io-35.2 {Tcl_Eof with pipe} -constraints {stdio openpipe} -setup {
} -cleanup {
chan close $f1
} -result {0 0 0 1}
-test chan-io-35.3 {Tcl_Eof with pipe} -constraints {stdio openpipe} -setup {
+test chan-io-35.3 {Tcl_Eof with pipe} -constraints stdio -setup {
file delete $path(pipe)
} -body {
set f1 [open $path(pipe) w]
@@ -4616,7 +4621,7 @@ test chan-io-35.4 {Tcl_Eof, eof detection on nonblocking file} -setup {
test chan-io-35.5 {Tcl_Eof, eof detection on nonblocking pipe} -setup {
file delete $path(pipe)
set l ""
-} -constraints {stdio openpipe} -body {
+} -constraints stdio -body {
set f [open $path(pipe) w]
chan puts $f {
exit
@@ -4801,7 +4806,7 @@ test chan-io-35.17 {Tcl_Eof, eof char in middle, crlf write, crlf read} -setup {
test chan-io-36.1 {Tcl_InputBlocked on nonblocking pipe} -setup {
set x ""
-} -constraints {stdio openpipe} -body {
+} -constraints stdio -body {
set f1 [openpipe]
chan puts $f1 {chan puts hello_from_pipe}
chan flush $f1
@@ -4821,7 +4826,7 @@ test chan-io-36.1 {Tcl_InputBlocked on nonblocking pipe} -setup {
} -result {{} 1 hello 0 {} 1}
test chan-io-36.2 {Tcl_InputBlocked on blocking pipe} -setup {
set x ""
-} -constraints {stdio openpipe} -body {
+} -constraints stdio -body {
set f1 [openpipe]
chan configure $f1 -buffering line
chan puts $f1 {chan puts hello_from_pipe}
@@ -5095,7 +5100,7 @@ test chan-io-39.9 {Tcl_SetChannelOption, blocking mode} -setup {
test chan-io-39.10 {Tcl_SetChannelOption, blocking mode} -setup {
file delete $path(pipe)
set x ""
-} -constraints {stdio openpipe} -body {
+} -constraints stdio -body {
set f1 [open $path(pipe) w]
chan puts $f1 {
chan gets stdin
@@ -5192,7 +5197,7 @@ test chan-io-39.16 {Tcl_SetChannelOption: -encoding, errors} -setup {
} -result {unknown encoding "foobar"}
test chan-io-39.17 {Tcl_SetChannelOption: -encoding, clearing CHANNEL_NEED_MORE_DATA} -setup {
variable x {}
-} -constraints {stdio openpipe fileevent} -body {
+} -constraints {stdio fileevent} -body {
set f [openpipe r+ $path(cat)]
chan configure $f -encoding binary
chan puts -nonewline $f "\xe7"
@@ -5552,7 +5557,7 @@ test chan-io-43.2 {Tcl_FileeventCmd: deleting when many present} -setup {
set f2 [open "|[list cat -u]" r+]
set f3 [open "|[list cat -u]" r+]
set result {}
-} -constraints {stdio unixExecs fileevent openpipe} -body {
+} -constraints {stdio unixExecs fileevent} -body {
lappend result [chan event $f r] [chan event $f2 r] [chan event $f3 r]
chan event $f r "chan read f"
chan event $f2 r "chan read f2"
@@ -5572,7 +5577,7 @@ test chan-io-43.2 {Tcl_FileeventCmd: deleting when many present} -setup {
test chan-io-44.1 {FileEventProc procedure: normal read event} -setup {
set f2 [open "|[list cat -u]" r+]
set f3 [open "|[list cat -u]" r+]
-} -constraints {stdio unixExecs fileevent openpipe} -body {
+} -constraints {stdio unixExecs fileevent} -body {
chan event $f2 readable [namespace code {
set x [chan gets $f2]; chan event $f2 readable {}
}]
@@ -5592,7 +5597,7 @@ test chan-io-44.2 {FileEventProc procedure: error in read event} -setup {
}
set handler [interp bgerror {}]
interp bgerror {} [namespace which myHandler]
-} -constraints {stdio unixExecs fileevent openpipe} -body {
+} -constraints {stdio unixExecs fileevent} -body {
chan event $f2 readable {error bogus}
chan puts $f2 text; chan flush $f2
variable x initial
@@ -5606,7 +5611,7 @@ test chan-io-44.2 {FileEventProc procedure: error in read event} -setup {
test chan-io-44.3 {FileEventProc procedure: normal write event} -setup {
set f2 [open "|[list cat -u]" r+]
set f3 [open "|[list cat -u]" r+]
-} -constraints {stdio unixExecs fileevent openpipe} -body {
+} -constraints {stdio unixExecs fileevent} -body {
chan event $f2 writable [namespace code {
lappend x "triggered"
incr count -1
@@ -5632,7 +5637,7 @@ test chan-io-44.4 {FileEventProc procedure: eror in write event} -setup {
}
set handler [interp bgerror {}]
interp bgerror {} [namespace which myHandler]
-} -constraints {stdio unixExecs fileevent openpipe} -body {
+} -constraints {stdio unixExecs fileevent} -body {
chan event $f2 writable {error bad-write}
variable x initial
vwait [namespace which -variable x]
@@ -5642,7 +5647,9 @@ test chan-io-44.4 {FileEventProc procedure: eror in write event} -setup {
catch {chan close $f2}
catch {chan close $f3}
} -result {bad-write {}}
-test chan-io-44.5 {FileEventProc procedure: end of file} {stdio unixExecs openpipe fileevent} {
+test chan-io-44.5 {FileEventProc procedure: end of file} -constraints {
+ stdio unixExecs fileevent
+} -body {
set f4 [openpipe r $path(cat) << foo]
chan event $f4 readable [namespace code {
if {[chan gets $f4 line] < 0} {
@@ -5655,9 +5662,10 @@ test chan-io-44.5 {FileEventProc procedure: end of file} {stdio unixExecs openpi
variable x initial
vwait [namespace which -variable x]
vwait [namespace which -variable x]
- chan close $f4
set x
-} {initial foo eof}
+} -cleanup {
+ chan close $f4
+} -result {initial foo eof}
chan close $f
makeFile "foo bar" foo
@@ -5718,7 +5726,7 @@ test chan-io-45.3 {DeleteFileEvent, cleanup on chan close} {fileevent} {
# Execute these tests only if the "testfevent" command is present.
-test chan-io-46.1 {Tcl event loop vs multiple interpreters} {testfevent fileevent} {
+test chan-io-46.1 {Tcl event loop vs multiple interpreters} {testfevent fileevent notOSX} {
testfevent create
set script "set f \[[list open $path(foo) r]]\n"
append script {
@@ -5728,9 +5736,10 @@ test chan-io-46.1 {Tcl event loop vs multiple interpreters} {testfevent fileeven
chan event $f readable {}
}]
}
+ set timer [after 10 lappend x timeout]
testfevent cmd $script
- after 1 ;# We must delay because Windows takes a little time to notice
- update
+ vwait x
+ after cancel $timer
testfevent cmd {chan close $f}
list [testfevent cmd {set x}] [testfevent cmd {info commands after}]
} {{f triggered: foo bar} after}
@@ -5918,7 +5927,7 @@ test chan-io-48.2 {testing readability conditions} {nonBlockFiles fileevent} {
set path(my_script) [makeFile {} my_script]
test chan-io-48.3 {testing readability conditions} -setup {
set l ""
-} -constraints {stdio unix nonBlockFiles openpipe fileevent} -body {
+} -constraints {stdio unix nonBlockFiles fileevent} -body {
set f [open $path(bar) w]
chan puts $f abcdefg
chan puts $f abcdefg
@@ -6372,17 +6381,21 @@ test chan-io-49.5 {testing crlf reading, leftover cr disgorgment} -setup {
test chan-io-50.1 {testing handler deletion} -setup {
file delete $path(test1)
-} -constraints {testchannelevent} -body {
+} -constraints testchannelevent -body {
set f [open $path(test1) w]
chan close $f
set f [open $path(test1) r]
+ variable z not_called
+ set timer [after 50 lappend z timeout]
+ testservicemode 0
testchannelevent $f add readable [namespace code {
variable z called
testchannelevent $f delete 0
}]
- variable z not_called
- update
- return $z
+ testservicemode 1
+ vwait z
+ after cancel $timer
+ set z
} -cleanup {
chan close $f
} -result called
@@ -6390,16 +6403,21 @@ test chan-io-50.2 {testing handler deletion with multiple handlers} -setup {
file delete $path(test1)
chan close [open $path(test1) w]
set z ""
-} -constraints {testchannelevent} -body {
- set f [open $path(test1) r]
- testchannelevent $f add readable [namespace code [list delhandler $f 1]]
- testchannelevent $f add readable [namespace code [list delhandler $f 0]]
+} -constraints {testchannelevent testservicemode} -body {
proc delhandler {f i} {
variable z
lappend z "called delhandler $f $i"
testchannelevent $f delete 0
}
- update
+ set z ""
+ set timer [after 50 lappend z timeout]
+ testservicemode 0
+ set f [open $path(test1) r]
+ testchannelevent $f add readable [namespace code [list delhandler $f 1]]
+ testchannelevent $f add readable [namespace code [list delhandler $f 0]]
+ testservicemode 1
+ vwait z
+ after cancel $timer
string equal $z \
[list [list called delhandler $f 0] [list called delhandler $f 1]]
} -cleanup {
@@ -6408,11 +6426,7 @@ test chan-io-50.2 {testing handler deletion with multiple handlers} -setup {
test chan-io-50.3 {testing handler deletion with multiple handlers} -setup {
file delete $path(test1)
chan close [open $path(test1) w]
- set z ""
-} -constraints {testchannelevent} -body {
- set f [open $path(test1) r]
- testchannelevent $f add readable [namespace code [list notcalled $f 1]]
- testchannelevent $f add readable [namespace code [list delhandler $f 0]]
+} -constraints {testchannelevent testservicemode} -body {
proc notcalled {f i} {
variable z
lappend z "notcalled was called!! $f $i"
@@ -6424,7 +6438,15 @@ test chan-io-50.3 {testing handler deletion with multiple handlers} -setup {
testchannelevent $f delete 0
lappend z "delhandler $f $i deleted myself"
}
- update
+ set z ""
+ set timer [after 50 lappend z timeout]
+ testservicemode 0
+ set f [open $path(test1) r]
+ testchannelevent $f add readable [namespace code [list notcalled $f 1]]
+ testchannelevent $f add readable [namespace code [list delhandler $f 0]]
+ testservicemode 1
+ vwait z
+ after cancel $timer
string equal $z \
[list [list delhandler $f 0 called] \
[list delhandler $f 0 deleted myself]]
@@ -6435,7 +6457,7 @@ test chan-io-50.4 {testing handler deletion vs reentrant calls} -setup {
file delete $path(test1)
set f [open $path(test1) w]
chan close $f
-} -constraints {testchannelevent} -body {
+} -constraints testchannelevent -body {
set f [open $path(test1) r]
testchannelevent $f add readable [namespace code {
if {$u eq "recursive"} {
@@ -6449,19 +6471,20 @@ test chan-io-50.4 {testing handler deletion vs reentrant calls} -setup {
}]
variable u toplevel
variable z ""
- update
- return $z
+ set timer [after 50 lappend z timeout]
+ vwait z
+ after cancel $timer
+ set z
} -cleanup {
chan close $f
+ update
} -result {{delrecursive calling recursive} {delrecursive deleting recursive}}
test chan-io-50.5 {testing handler deletion vs reentrant calls} -setup {
file delete $path(test1)
set f [open $path(test1) w]
chan close $f
-} -constraints {testchannelevent} -body {
- set f [open $path(test1) r]
- testchannelevent $f add readable [namespace code [list notcalled $f]]
- testchannelevent $f add readable [namespace code [list del $f]]
+ update
+} -constraints {testchannelevent testservicemode notOSX} -body {
proc notcalled {f} {
variable z
lappend z "notcalled was called!! $f"
@@ -6477,33 +6500,46 @@ test chan-io-50.5 {testing handler deletion vs reentrant calls} -setup {
} else {
set u recursive
lappend z "del calling recursive"
- update
+ set timer [after 50 lappend z timeout]
+ set mode [test servicemode 1]
+ vwait z
+ after cancel $timer
+ test servicemode $mode
lappend z "del after update"
}
}
set z ""
set u toplevel
- update
- return $z
+ set timer [after 50 lappend z timeout]
+ testservicemode 0
+ set f [open $path(test1) r]
+ testchannelevent $f add readable [namespace code [list notcalled $f]]
+ testchannelevent $f add readable [namespace code [list del $f]]
+ testservicemode 1
+ vwait z
+ after cancel $timer
+ set z
} -cleanup {
chan close $f
+ update
} -result [list {del calling recursive} {del deleted notcalled} \
{del deleted myself} {del after update}]
test chan-io-50.6 {testing handler deletion vs reentrant calls} -setup {
file delete $path(test1)
set f [open $path(test1) w]
chan close $f
-} -constraints {testchannelevent} -body {
- set f [open $path(test1) r]
- testchannelevent $f add readable [namespace code [list second $f]]
- testchannelevent $f add readable [namespace code [list first $f]]
+} -constraints {testchannelevent testservicemode} -body {
proc first {f} {
variable u
variable z
if {$u eq "toplevel"} {
lappend z "first called"
+ set mode [testservicemode 1]
+ set timer [after 50 lappend z timeout]
set u first
- update
+ vwait z
+ after cancel $timer
+ testservicemode $mode
lappend z "first after update"
} else {
lappend z "first called not toplevel"
@@ -6526,8 +6562,15 @@ test chan-io-50.6 {testing handler deletion vs reentrant calls} -setup {
}
set z ""
set u toplevel
- update
- return $z
+ set timer [after 50 lappend z timeout]
+ testservicemode 0
+ set f [open $path(test1) r]
+ testchannelevent $f add readable [namespace code [list second $f]]
+ testchannelevent $f add readable [namespace code [list first $f]]
+ testservicemode 1
+ vwait z
+ after cancel $timer
+ set z
} -cleanup {
chan close $f
} -result [list {first called} {first called not toplevel} \
@@ -6709,7 +6752,7 @@ test chan-io-52.7 {TclCopyChannel} -constraints {fcopy} -setup {
test chan-io-52.8 {TclCopyChannel} -setup {
file delete $path(test1)
file delete $path(pipe)
-} -constraints {stdio openpipe fcopy} -body {
+} -constraints {stdio fcopy} -body {
set f1 [open $path(pipe) w]
chan configure $f1 -translation lf
chan puts $f1 "
@@ -6830,7 +6873,7 @@ test chan-io-53.2 {CopyData} -setup {
test chan-io-53.3 {CopyData: background read underflow} -setup {
file delete $path(test1)
file delete $path(pipe)
-} -constraints {stdio unix openpipe fcopy} -body {
+} -constraints {stdio unix fcopy} -body {
set f1 [open $path(pipe) w]
chan puts -nonewline $f1 {
chan puts ready
@@ -6868,7 +6911,7 @@ test chan-io-53.4 {CopyData: background write overflow} -setup {
}
file delete $path(test1)
file delete $path(pipe)
-} -constraints {stdio unix openpipe fileevent fcopy} -body {
+} -constraints {stdio unix fileevent fcopy} -body {
set f1 [open $path(pipe) w]
chan puts $f1 {
chan puts ready
@@ -6932,7 +6975,7 @@ test chan-io-53.6 {CopyData: error during chan copy} -setup {
file delete $path(pipe)
file delete $path(test1)
catch {unset fcopyTestDone}
-} -constraints {stdio openpipe fcopy} -body {
+} -constraints {stdio fcopy} -body {
set f1 [open $path(pipe) w]
chan puts $f1 "exit 1"
chan close $f1
@@ -6966,7 +7009,7 @@ test chan-io-53.7 {CopyData: Flooding chan copy from pipe} -setup {
variable fcopyTestDone
file delete $path(pipe)
catch {unset fcopyTestDone}
-} -constraints {stdio openpipe fcopy} -body {
+} -constraints {stdio fcopy} -body {
set fcopyTestCount 0
set f1 [open $path(pipe) w]
chan puts $f1 {
@@ -7016,7 +7059,7 @@ test chan-io-53.8 {CopyData: async callback and error handling, Bug 1932639} -se
# Channels to copy between
set f [open $foo r] ; fconfigure $f -translation binary
set g [open $bar w] ; fconfigure $g -translation binary -buffering none
-} -constraints {stdio openpipe fcopy} -body {
+} -constraints {stdio fcopy} -body {
# Record input size, so that result is always defined
lappend ::RES [file size $bar]
# Run the copy. Should not invoke -command now.
@@ -7056,7 +7099,7 @@ test chan-io-53.8a {CopyData: async callback and error handling, Bug 1932639, at
# Channels to copy between
set f [open $foo r] ; chan configure $f -translation binary
set g [open $bar w] ; chan configure $g -translation binary -buffering none
-} -constraints {stdio openpipe fcopy} -body {
+} -constraints {stdio fcopy} -body {
# Initialize and force eof on the input.
chan seek $f 0 end ; chan read $f 1
set ::RES [chan eof $f]
@@ -7114,7 +7157,7 @@ test chan-io-53.9 {CopyData: -size and event interaction, Bug 780533} -setup {
}
set ::forever {}
set out [open $out w]
-} -constraints {stdio openpipe fcopy} -body {
+} -constraints {stdio fcopy} -body {
chan copy $pipe $out -size 6 -command ::done
set token [after 5000 {
set ::forever {fcopy hangs}
@@ -7187,7 +7230,7 @@ test chan-io-53.10 {Bug 1350564, multi-directional fcopy} -setup {
chan configure $b -translation binary -buffering none
chan event $a readable [namespace code "done $a"]
chan event $b readable [namespace code "done $b"]
-} -constraints {stdio openpipe fcopy} -body {
+} -constraints {stdio fcopy} -body {
# Now pass data through the server in both directions.
set ::forever {}
chan puts $a AB
@@ -7409,7 +7452,7 @@ test chan-io-57.2 {buffered data and file events, read} -setup {
chan close $server
} -result {1 readable 234567890 timer}
-test chan-io-58.1 {Tcl_NotifyChannel and error when closing} {stdio unixOrWin openpipe fileevent} {
+test chan-io-58.1 {Tcl_NotifyChannel and error when closing} {stdio unixOrWin fileevent} {
set out [open $path(script) w]
chan puts $out {
chan puts "normal message from pipe"
@@ -7447,7 +7490,7 @@ test chan-io-59.1 {Thread reference of channels} {testmainthread testchannel} {
string equal $result [testmainthread]
} {1}
-test chan-io-60.1 {writing illegal utf sequences} {openpipe fileevent testbytestring} {
+test chan-io-60.1 {writing illegal utf sequences} {fileevent testbytestring} {
# This test will hang in older revisions of the core.
set out [open $path(script) w]
chan puts $out "catch {load $::tcltestlib Tcltest}"
diff --git a/tests/clock.test b/tests/clock.test
index f9db14b..c51c829 100644
--- a/tests/clock.test
+++ b/tests/clock.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -250,7 +250,6 @@ proc ::testClock::registry { cmd path key } {
return [dict get $reg $path $key]
}
-
# Test some of the basics of [clock format]
test clock-1.0 "clock format - wrong # args" {
@@ -35631,7 +35630,6 @@ test clock-34.11 {clock scan tests} {
set time [clock scan "1/1/37" -gmt true]
clock format $time -format {%b %d,%Y %H:%M GMT} -gmt true
} {Jan 01,2037 00:00 GMT}
-
test clock-34.12 {clock scan, relative times} {
set time [clock scan "Oct 23, 1992 -1 day"]
clock format $time -format {%b %d, %Y}
@@ -35783,7 +35781,6 @@ test clock-34.43 {last monday in november} {
}
set res
} {1991-11-25 1992-11-30 1993-11-29 1994-11-28 1995-11-27 1996-11-25}
-
test clock-34.44 {2nd monday in november} {
set res {}
foreach i {91 92 93 94 95 96} {
@@ -35816,38 +35813,95 @@ test clock-34.47 {ago with multiple relative units} {
set res [clock scan "2 days 2 hours ago" -base $base]
expr {$base - $res}
} 180000
-
test clock-34.48 {more than one ToD} {*}{
-body {clock scan {10:00 11:00}}
-returnCodes error
-result {unable to convert date-time string "10:00 11:00": more than one time of day in string}
}
-
test clock-34.49 {more than one date} {*}{
-body {clock scan {1/1/2001 2/2/2002}}
-returnCodes error
-result {unable to convert date-time string "1/1/2001 2/2/2002": more than one date in string}
}
-
test clock-34.50 {more than one time zone} {*}{
-body {clock scan {10:00 EST CST}}
-returnCodes error
-result {unable to convert date-time string "10:00 EST CST": more than one time zone in string}
}
-
test clock-34.51 {more than one weekday} {*}{
-body {clock scan {Monday Tuesday}}
-returnCodes error
-result {unable to convert date-time string "Monday Tuesday": more than one weekday in string}
}
-
test clock-34.52 {more than one ordinal month} {*}{
-body {clock scan {next January next March}}
-returnCodes error
-result {unable to convert date-time string "next January next March": more than one ordinal month in string}
}
-
-
+test clock-34.53 {clock scan, ISO 8601 point in time format} {
+ set time [clock scan "19921023T00:00:00"]
+ clock format $time -format {%b %d, %Y %H:%M:%S}
+} "Oct 23, 1992 00:00:00"
+test clock-34.54 {clock scan, ISO 8601 point in time format} {
+ set time [clock scan "1992-10-23T00:00:00"]
+ clock format $time -format {%b %d, %Y %H:%M:%S}
+} "Oct 23, 1992 00:00:00"
+test clock-34.55 {clock scan, ISO 8601 invalid TZ} -body {
+ set time [clock scan "19921023MST000000"]
+ clock format $time -format {%b %d, %Y %H:%M:%S}
+} -returnCodes error -match glob -result {unable to convert date-time string*}
+test clock-34.56 {clock scan, ISO 8601 invalid TZ} -body {
+ set time [clock scan "19921023M000000"]
+ clock format $time -format {%b %d, %Y %H:%M:%S}
+} -returnCodes error -match glob -result {unable to convert date-time string*}
+test clock-34.57 {clock scan, ISO 8601 invalid TZ} -body {
+ set time [clock scan "1992-10-23M00:00:00"]
+ clock format $time -format {%b %d, %Y %H:%M:%S}
+} -returnCodes error -match glob -result {unable to convert date-time string*}
+test clock-34.58 {clock scan, ISO 8601 invalid TZ} -body {
+ set time [clock scan "1992-10-23MST00:00:00"]
+ clock format $time -format {%b %d, %Y %H:%M:%S}
+} -returnCodes error -match glob -result {unable to convert date-time string*}
+test clock-34.59 {clock scan tests (-TZ)} {
+ set time [clock scan "31 Jan 14 23:59:59 -0100"]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Feb 01,2014 00:59:59 GMT}
+test clock-34.60 {clock scan tests (+TZ)} {
+ set time [clock scan "31 Jan 14 23:59:59 +0100"]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Jan 31,2014 22:59:59 GMT}
+test clock-34.61 {clock scan tests (-TZ)} {
+ set time [clock scan "23:59:59 -0100" -base 0 -gmt true]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Jan 02,1970 00:59:59 GMT}
+test clock-34.62 {clock scan tests (+TZ)} {
+ set time [clock scan "23:59:59 +0100" -base 0 -gmt true]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Jan 01,1970 22:59:59 GMT}
+test clock-34.63 {clock scan tests (TZ)} {
+ set time [clock scan "Mon, 30 Jun 2014 23:59:59 CEST"]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Jun 30,2014 21:59:59 GMT}
+test clock-34.64 {clock scan tests (TZ)} {
+ set time [clock scan "Fri, 31 Jan 2014 23:59:59 CET"]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Jan 31,2014 22:59:59 GMT}
+test clock-34.65 {clock scan tests (relspec, day unit not TZ)} {
+ set time [clock scan "23:59:59 +15 day" -base 2000000 -gmt true]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Feb 08,1970 23:59:59 GMT}
+test clock-34.66 {clock scan tests (relspec, day unit not TZ)} {
+ set time [clock scan "23:59:59 -15 day" -base 2000000 -gmt true]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Jan 09,1970 23:59:59 GMT}
+test clock-34.67 {clock scan tests (merid and TZ)} {
+ set time [clock scan "10:59 pm CET" -base 2000000 -gmt true]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Jan 24,1970 21:59:00 GMT}
+test clock-34.68 {clock scan tests (merid and TZ)} {
+ set time [clock scan "10:59 pm +0100" -base 2000000 -gmt true]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Jan 24,1970 21:59:00 GMT}
# clock seconds
test clock-35.1 {clock seconds tests} {
@@ -36947,12 +37001,10 @@ test clock-67.2 {Bug d19a30db57} -body {
# error, not segfault
tcl::clock::GetJulianDayFromEraYearMonthDay {} 2361222
} -returnCodes error -match glob -result *
-
test clock-67.3 {Bug d19a30db57} -body {
# error, not segfault
tcl::clock::GetJulianDayFromEraYearWeekDay {} 2361222
} -returnCodes error -match glob -result *
-
test clock-67.4 {Change format %x output on global locale change [Bug 4a0c163d24]} -setup {
package require msgcat
set current [msgcat::mclocale]
@@ -36964,7 +37016,6 @@ test clock-67.4 {Change format %x output on global locale change [Bug 4a0c163d24
} -cleanup {
msgcat::mclocale $current
} -result {1 1}
-
test clock-67.5 {Change scan %x output on global locale change [Bug 4a0c163d24]} -setup {
package require msgcat
set current [msgcat::mclocale]
diff --git a/tests/cmdAH.test b/tests/cmdAH.test
index 992a8f4..e1fd920 100644
--- a/tests/cmdAH.test
+++ b/tests/cmdAH.test
@@ -11,7 +11,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2.1
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -261,7 +261,7 @@ test cmdAH-6.3 {Tcl_FileObjCmd: volumes} -constraints unix -body {
test cmdAH-6.4 {Tcl_FileObjCmd: volumes} -constraints win -body {
set volumeList [string tolower [file volumes]]
set element [lsearch -exact $volumeList "c:/"]
- list [expr {$element>-1}] [glob -nocomplain [lindex $volumeList $element]*]
+ list [expr {$element>=0}] [glob -nocomplain [lindex $volumeList $element]*]
} -match glob -result {1 *}
# attributes
@@ -1638,7 +1638,7 @@ test cmdAH-31.9 {Tcl_FileObjCmd: channels in other interp} {
lsort [safeInterp eval [list file channels]]
} [lsort [list stdout $newFileId]]
test cmdAH-31.10 {Tcl_FileObjCmd: channels in other interp} {
- # we can now write to $newFileId from slave
+ # we can now write to $newFileId from child
safeInterp eval [list puts $newFileId "hello"]
} {}
interp transfer {} $newFileId safeInterp
diff --git a/tests/cmdIL.test b/tests/cmdIL.test
index fe72d94..68f7892 100644
--- a/tests/cmdIL.test
+++ b/tests/cmdIL.test
@@ -8,11 +8,12 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
+
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
diff --git a/tests/cmdInfo.test b/tests/cmdInfo.test
index 0a587e8..e690002 100644
--- a/tests/cmdInfo.test
+++ b/tests/cmdInfo.test
@@ -13,8 +13,10 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
-namespace import ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
diff --git a/tests/cmdMZ.test b/tests/cmdMZ.test
index 43b3703..0675a5d 100644
--- a/tests/cmdMZ.test
+++ b/tests/cmdMZ.test
@@ -11,9 +11,9 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[catch {package require tcltest 2.1}]} {
- puts stderr "Skipping tests in [info script]. tcltest 2.1 required."
- return
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
}
namespace eval ::tcl::test::cmdMZ {
diff --git a/tests/compExpr-old.test b/tests/compExpr-old.test
index e57f799..f573cfa 100644
--- a/tests/compExpr-old.test
+++ b/tests/compExpr-old.test
@@ -12,11 +12,12 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
+
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
diff --git a/tests/compExpr.test b/tests/compExpr.test
index 3b44af8..e9220c1 100644
--- a/tests/compExpr.test
+++ b/tests/compExpr.test
@@ -9,7 +9,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -341,9 +341,9 @@ test compExpr-7.1 {Memory Leak} -constraints memory -setup {
} -body {
set end [getbytes]
for {set i 0} {$i < 5} {incr i} {
- interp create slave
- slave eval expr 1+2+3+4+5+6+7+8+9+10+11+12+13
- interp delete slave
+ interp create child
+ child eval expr 1+2+3+4+5+6+7+8+9+10+11+12+13
+ interp delete child
set tmp $end
set end [getbytes]
}
diff --git a/tests/compile.test b/tests/compile.test
index 18e978f..b90f124 100644
--- a/tests/compile.test
+++ b/tests/compile.test
@@ -11,8 +11,11 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
-namespace import -force ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
+
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
diff --git a/tests/concat.test b/tests/concat.test
index eeb11ca..8ff5500 100644
--- a/tests/concat.test
+++ b/tests/concat.test
@@ -12,7 +12,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/config.test b/tests/config.test
index 468a1df..b78e29d 100644
--- a/tests/config.test
+++ b/tests/config.test
@@ -12,8 +12,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/coroutine.test b/tests/coroutine.test
index 86a5481..6d79fd7 100644
--- a/tests/coroutine.test
+++ b/tests/coroutine.test
@@ -9,8 +9,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -771,25 +771,25 @@ test coroutine-8.0.1 {coro inject after error} -body {
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 {
+ interp create child
+ child eval {
coroutine demo apply {{} { while {1} yield }}
demo
tcl::unsupported::inject demo set ::result inject-executed
}
- interp delete slave
+ interp delete child
} -result {}
test coroutine-8.1.2 {coro inject with result, ticket 42202ba1e5ff566e} -body {
- interp create slave
- slave eval {
+ interp create child
+ child 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}]
+ child eval demo
+ set result [child eval {set ::result}]
- interp delete slave
+ interp delete child
set result
} -result {inject-executed}
diff --git a/tests/dcall.test b/tests/dcall.test
index 41dd777..7d86135 100644
--- a/tests/dcall.test
+++ b/tests/dcall.test
@@ -11,8 +11,10 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
-namespace import ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
diff --git a/tests/dict.test b/tests/dict.test
index e5284fc..01e4bde 100644
--- a/tests/dict.test
+++ b/tests/dict.test
@@ -9,7 +9,7 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
+if {"::tcltest" ni [namespace children]} {
package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/dstring.test b/tests/dstring.test
index 5feb355..8a24ebe 100644
--- a/tests/dstring.test
+++ b/tests/dstring.test
@@ -12,7 +12,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/encoding.test b/tests/encoding.test
index f483160..d0ca114 100644
--- a/tests/encoding.test
+++ b/tests/encoding.test
@@ -8,13 +8,15 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
+
namespace eval ::tcl::test::encoding {
variable x
-namespace import -force ::tcltest::*
-
catch {
::tcltest::loadTestedCommands
package require -exact Tcltest [info patchlevel]
diff --git a/tests/env.test b/tests/env.test
index 4af46c3..bad9e66 100644
--- a/tests/env.test
+++ b/tests/env.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -326,11 +326,11 @@ test env-5.2 {corner cases - unset the env array} -setup {
} -result {0}
-test env-5.3 {corner cases: unset the env in master should unset child} -setup {
+test env-5.3 {corner cases: unset the env in parent should unset child} -setup {
setup1
interp create i
} -body {
- # Variables deleted in a master interp should be deleted in child interp
+ # Variables deleted in a parent interp should be deleted in child interp
# too.
i eval {set env(THIS_SHOULD_EXIST) a}
set result [set env(THIS_SHOULD_EXIST)]
diff --git a/tests/error.test b/tests/error.test
index af07ed7..a111c80 100644
--- a/tests/error.test
+++ b/tests/error.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/eval.test b/tests/eval.test
index 70ceac8..d473fdf 100644
--- a/tests/eval.test
+++ b/tests/eval.test
@@ -12,7 +12,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/event.test b/tests/event.test
index 5c111f8..3194547 100644
--- a/tests/event.test
+++ b/tests/event.test
@@ -9,7 +9,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
+package require tcltest 2.5
namespace import -force ::tcltest::*
catch {
@@ -23,16 +23,18 @@ testConstraint testfilehandler [llength [info commands testfilehandler]]
testConstraint testexithandler [llength [info commands testexithandler]]
testConstraint testfilewait [llength [info commands testfilewait]]
testConstraint exec [llength [info commands exec]]
-
+testConstraint notOSX [expr {$::tcl_platform(os) ne "Darwin"}]
+
test event-1.1 {Tcl_CreateFileHandler, reading} -setup {
testfilehandler close
set result ""
-} -constraints {testfilehandler} -body {
+} -constraints {testfilehandler notOSX} -body {
testfilehandler create 0 readable off
testfilehandler clear 0
testfilehandler oneevent
lappend result [testfilehandler counts 0]
testfilehandler fillpartial 0
+ update idletasks
testfilehandler oneevent
lappend result [testfilehandler counts 0]
testfilehandler oneevent
diff --git a/tests/exec.test b/tests/exec.test
index 36aeae5..5082393 100644
--- a/tests/exec.test
+++ b/tests/exec.test
@@ -14,8 +14,10 @@
# There is no point in running Valgrind on cases where [exec] forks but then
# fails and the child process doesn't go through full cleanup.
-package require tcltest 2
-namespace import -force ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
diff --git a/tests/execute.test b/tests/execute.test
index fbc4f99..6d27e55 100644
--- a/tests/execute.test
+++ b/tests/execute.test
@@ -15,7 +15,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -657,56 +657,56 @@ test execute-6.8 {TclCompEvalObj: bytecode name resolution epoch validation} -se
namespace delete foo
} -result {0 AHA!}
test execute-6.9 {TclCompEvalObj: bytecode interp validation} -setup {
- interp create slave
+ interp create child
} -body {
set script { llength {} }
- slave eval {proc llength args {return AHA!}}
+ child eval {proc llength args {return AHA!}}
set result {}
lappend result [if 1 $script]
- lappend result [slave eval $script]
+ lappend result [child eval $script]
} -cleanup {
- interp delete slave
+ interp delete child
} -result {0 AHA!}
test execute-6.10 {TclCompEvalObj: bytecode interp validation} -body {
set script { llength {} }
- interp create slave
+ interp create child
set result {}
- lappend result [slave eval $script]
- interp delete slave
- interp create slave
- lappend result [slave eval $script]
+ lappend result [child eval $script]
+ interp delete child
+ interp create child
+ lappend result [child eval $script]
} -cleanup {
- catch {interp delete slave}
+ catch {interp delete child}
} -result {0 0}
test execute-6.11 {Tcl_ExprObj: exprcode interp validation} -setup {
- interp create slave
+ interp create child
} -constraints testexprlongobj -body {
set e { [llength {}]+1 }
set result {}
- load {} Tcltest slave
- interp alias {} e slave testexprlongobj
+ load {} Tcltest child
+ interp alias {} e child testexprlongobj
lappend result [e $e]
- interp delete slave
- interp create slave
- load {} Tcltest slave
- interp alias {} e slave testexprlongobj
+ interp delete child
+ interp create child
+ load {} Tcltest child
+ interp alias {} e child testexprlongobj
lappend result [e $e]
} -cleanup {
- interp delete slave
+ interp delete child
} -result {{This is a result: 1} {This is a result: 1}}
test execute-6.12 {Tcl_ExprObj: exprcode interp validation} -setup {
- interp create slave
+ interp create child
} -body {
set e { [llength {}]+1 }
set result {}
- interp alias {} e slave expr
+ interp alias {} e child expr
lappend result [e $e]
- interp delete slave
- interp create slave
- interp alias {} e slave expr
+ interp delete child
+ interp create child
+ interp alias {} e child expr
lappend result [e $e]
} -cleanup {
- interp delete slave
+ interp delete child
} -result {1 1}
test execute-6.13 {Tcl_ExprObj: exprcode epoch validation} -body {
set e { [llength {}]+1 }
@@ -747,16 +747,16 @@ test execute-6.15 {Tcl_ExprObj: exprcode name resolution epoch validation} -setu
namespace delete foo
} -result {1 2}
test execute-6.16 {Tcl_ExprObj: exprcode interp validation} -setup {
- interp create slave
+ interp create child
} -body {
set e { [llength {}]+1 }
- interp alias {} e slave expr
- slave eval {proc llength args {return 1}}
+ interp alias {} e child expr
+ child eval {proc llength args {return 1}}
set result {}
lappend result [expr $e]
lappend result [e $e]
} -cleanup {
- interp delete slave
+ interp delete child
} -result {1 2}
test execute-6.17 {Tcl_ExprObj: exprcode context validation} -body {
proc foo e {set v 0; expr $e}
@@ -982,9 +982,9 @@ test execute-8.5 {Bug 2038069} -setup {
"catch \[list error FOO\] m o"} -errorline 2}
test execute-8.6 {Compile epoch bump in global level (bug [fa6bf38d07])} -setup {
- interp create slave
- slave eval {
- package require tcltest
+ interp create child
+ child eval {
+ package require tcltest 2.5
catch [list package require -exact Tcltest [info patchlevel]]
::tcltest::loadTestedCommands
if {[namespace which -command testbumpinterpepoch] eq ""} {
@@ -992,32 +992,32 @@ test execute-8.6 {Compile epoch bump in global level (bug [fa6bf38d07])} -setup
}
}
} -body {
- slave eval {
+ child eval {
lappend res A; testbumpinterpepoch; lappend res B; return; lappend res C;
}
- slave eval {
+ child eval {
set i 0; while {[incr i] < 3} {
lappend res A; testbumpinterpepoch; lappend res B; return; lappend res C;
}
}
- slave eval {
+ child eval {
set i 0; while {[incr i] < 3} {
lappend res A; testbumpinterpepoch; lappend res B; break; lappend res C;
}
}
- slave eval {
+ child eval {
catch {
lappend res A; testbumpinterpepoch; lappend res B; error test; lappend res C;
}
}
- slave eval {set res}
+ child eval {set res}
} -cleanup {
- interp delete slave
+ interp delete child
} -result [lrepeat 4 A B]
test execute-8.7 {Compile epoch bump in global level (bug [fa6bf38d07]), exception case} -setup {
- interp create slave
- slave eval {
- package require tcltest
+ interp create child
+ child eval {
+ package require tcltest 2.5
catch [list package require -exact Tcltest [info patchlevel]]
::tcltest::loadTestedCommands
if {[namespace which -command testbumpinterpepoch] eq ""} {
@@ -1027,28 +1027,28 @@ test execute-8.7 {Compile epoch bump in global level (bug [fa6bf38d07]), excepti
} -body {
set res {}
lappend res [catch {
- slave eval {
+ child eval {
lappend res A; testbumpinterpepoch; lappend res B; return -code error test; lappend res C;
}
} e] $e
lappend res [catch {
- slave eval {
+ child eval {
lappend res A; testbumpinterpepoch; lappend res B; error test; lappend res C;
}
} e] $e
lappend res [catch {
- slave eval {
+ child eval {
lappend res A; testbumpinterpepoch; lappend res B; return -code return test; lappend res C;
}
} e] $e
lappend res [catch {
- slave eval {
+ child eval {
lappend res A; testbumpinterpepoch; lappend res B; break; lappend res C;
}
} e] $e
- list $res [slave eval {set res}]
+ list $res [child eval {set res}]
} -cleanup {
- interp delete slave
+ interp delete child
} -result [list {1 test 1 test 2 test 3 {}} [lrepeat 4 A B]]
test execute-9.1 {Interp result resetting [Bug 1522803]} {
@@ -1069,16 +1069,16 @@ test execute-10.1 {TclExecuteByteCode, INST_CONCAT1, bytearrays} {
apply {s {binary scan $s c x; list $x [scan $s$s %c%c]}} \u0130
} {48 {304 304}}
test execute-10.2 {Bug 2802881} -setup {
- interp create slave
+ interp create child
} -body {
# If [Bug 2802881] is not fixed, this will segfault
- slave eval {
+ child eval {
trace add variable ::errorInfo write {expr {$foo} ;#}
proc demo {} {a {}{}}
demo
}
} -cleanup {
- interp delete slave
+ interp delete child
} -returnCodes error -match glob -result *
test execute-10.3 {Bug 3072640} -setup {
proc generate {n} {
@@ -1103,9 +1103,9 @@ test execute-10.3 {Bug 3072640} -setup {
} -result 4
test execute-11.1 {Bug 3142026: GrowEvaluationStack off-by-one} -setup {
- interp create slave
+ interp create child
} -body {
- slave eval {
+ child eval {
set x [lrepeat 1320 199]
for {set i 0} {$i < 20} {incr i} {
lappend x $i
@@ -1115,7 +1115,7 @@ test execute-11.1 {Bug 3142026: GrowEvaluationStack off-by-one} -setup {
return ok
}
} -cleanup {
- interp delete slave
+ interp delete child
} -result ok
test execute-11.2 {Bug 268b23df11} -setup {
diff --git a/tests/expr-old.test b/tests/expr-old.test
index 003ee00..ad5a6bc 100644
--- a/tests/expr-old.test
+++ b/tests/expr-old.test
@@ -13,8 +13,10 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2.1
-namespace import ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
diff --git a/tests/expr.test b/tests/expr.test
index f0b75f4..0b4fa2b 100644
--- a/tests/expr.test
+++ b/tests/expr.test
@@ -10,8 +10,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2.1
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/fCmd.test b/tests/fCmd.test
index e8ed6f9..53313dc 100644
--- a/tests/fCmd.test
+++ b/tests/fCmd.test
@@ -11,7 +11,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/fileName.test b/tests/fileName.test
index 0e4cb9e..c73efac 100644
--- a/tests/fileName.test
+++ b/tests/fileName.test
@@ -11,10 +11,11 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
+
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
@@ -1083,6 +1084,12 @@ test filename-11.48 {Tcl_GlobCmd} -returnCodes error -body {
test filename-11.49 {Tcl_GlobCmd} -returnCodes error -body {
glob -types abcde -path foo -join * *
} -result {bad argument to "-types": abcde}
+test filename-11.50 {Tcl_GlobCmd} -returnCodes error -body {
+ glob -path hello -path salut *
+} -result {"-path" may only be used once}
+test filename-11.51 {Tcl_GlobCmd} -returnCodes error -body {
+ glob -dir hello -dir salut *
+} -result {"-directory" may only be used once}
file rename $horribleglobname globTest
file delete -force $tildeglobname
diff --git a/tests/fileSystem.test b/tests/fileSystem.test
index 361542d..19066ee 100644
--- a/tests/fileSystem.test
+++ b/tests/fileSystem.test
@@ -9,9 +9,12 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
namespace eval ::tcl::test::fileSystem {
- namespace import ::tcltest::*
+
+ if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+ }
catch {
file delete -force link.file
diff --git a/tests/fileSystemEncoding.test b/tests/fileSystemEncoding.test
index 0f8a2a7..6561bef 100644
--- a/tests/fileSystemEncoding.test
+++ b/tests/fileSystemEncoding.test
@@ -7,8 +7,11 @@ if {[string equal $::tcl_platform(os) "Windows NT"]} {
}
namespace eval ::tcl::test::fileSystemEncoding {
- package require tcltest 2
- namespace import ::tcltest::*
+
+ if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+ }
variable fname1 \u767b\u9e1b\u9d72\u6a13
diff --git a/tests/for-old.test b/tests/for-old.test
index a11a791..d00a4ee 100644
--- a/tests/for-old.test
+++ b/tests/for-old.test
@@ -12,8 +12,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/for.test b/tests/for.test
index c8a8187..239e4d6 100644
--- a/tests/for.test
+++ b/tests/for.test
@@ -9,8 +9,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/foreach.test b/tests/foreach.test
index 84af4bd..cdbfc85 100644
--- a/tests/foreach.test
+++ b/tests/foreach.test
@@ -10,8 +10,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/format.test b/tests/format.test
index 3640376..8d6fd82 100644
--- a/tests/format.test
+++ b/tests/format.test
@@ -10,8 +10,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/get.test b/tests/get.test
index e35b2cc..9e7728a 100644
--- a/tests/get.test
+++ b/tests/get.test
@@ -10,8 +10,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -109,6 +109,12 @@ test get-3.4 {Tcl_GetDouble with iffy numbers} testdoubleobj {
set x
}
} {0.0 0.0 0.0 0.0 0.0 7.0 {expected floating-point number but got "- 0"} 0.0 10.0 2.0}
+test get-3.5 {tcl_GetInt with numeric whitespace (i.e. '_')} testgetint {
+ lmap x {0_0 " 1_0" "0_2 " " 3_3 " 14__23__32___4 " 0x_a " " 0_07 " " 0o_1_0 " " 0_b1_0 " _33 42_ 0_x15 0_o17 0_d19 } {
+ catch {testgetint $x} x
+ set x
+ }
+} {0 10 2 33 1423324 10 7 8 {expected integer but got " 0_b1_0 "} {expected integer but got "_33"} {expected integer but got "42_"} {expected integer but got "0_x15"} {expected integer but got "0_o17"} {expected integer but got "0_d19"}}
# cleanup
::tcltest::cleanupTests
diff --git a/tests/history.test b/tests/history.test
index 9ff41f2..922d984 100644
--- a/tests/history.test
+++ b/tests/history.test
@@ -12,7 +12,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/http.test b/tests/http.test
index 8eac3c3..a525691 100644
--- a/tests/http.test
+++ b/tests/http.test
@@ -11,15 +11,17 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
-namespace import -force ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
if {[catch {package require http 2} version]} {
if {[info exists http2]} {
catch {puts "Cannot load http 2.* package"}
return
} else {
- catch {puts "Running http 2.* tests in slave interp"}
+ catch {puts "Running http 2.* tests in child interp"}
set interp [interp create http2]
$interp eval [list set http2 "running"]
$interp eval [list set argv $argv]
@@ -442,6 +444,9 @@ test http-3.33 {http::geturl application/xml is text} -body {
} -cleanup {
catch { http::cleanup $token }
} -result {test 4660 /test}
+test http-3.34 {http::geturl -headers not a dict} -returnCodes error -body {
+ http::geturl http://test/t -headers NoDict
+} -result {Bad value for -headers (NoDict), must be dict}
test http-4.1 {http::Event} -body {
set token [http::geturl $url -keepalive 0]
diff --git a/tests/http11.test b/tests/http11.test
index 1e30802..f243e56 100644
--- a/tests/http11.test
+++ b/tests/http11.test
@@ -7,17 +7,19 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
-namespace import -force ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
-package require http 2.8
+package require http 2.9
# start the server
variable httpd_output
proc create_httpd {} {
proc httpd_read {chan} {
variable httpd_output
- if {[gets $chan line] != -1} {
+ if {[gets $chan line] >= 0} {
#puts stderr "read '$line'"
set httpd_output $line
}
@@ -60,6 +62,20 @@ proc meta {tok {key ""}} {
return $meta
}
+proc state {tok {key ""}} {
+ upvar 1 $tok state
+ if {$key ne ""} {
+ if {[array names state -exact $key] ne {}} {
+ return $state($key)
+ } else {
+ return ""
+ }
+ }
+ set res [array get state]
+ dict set res body <elided>
+ return $res
+}
+
proc check_crc {tok args} {
set crc [meta $tok x-crc32]
set data [expr {[llength $args] ? [lindex $args 0] : [http::data $tok]}]
@@ -241,8 +257,45 @@ test http11-1.12 "normal,identity,chunked" -setup {
halt_httpd
} -result {ok {HTTP/1.1 200 OK} ok {} chunked}
+test http11-1.13 "normal, 1.1 and keepalive as server default, no zip" -setup {
+ variable httpd [create_httpd]
+ set zipTmp [http::config -zip]
+ http::config -zip 0
+} -body {
+ set tok [http::geturl http://localhost:$httpd_port/testdoc.html?transfer= \
+ -protocol 1.1 -keepalive 1 -timeout 10000]
+ http::wait $tok
+ set res1 [list [http::status $tok] [http::code $tok] [check_crc $tok] \
+ [meta $tok connection] [meta $tok transfer-encoding] [state $tok reusing] [state $tok connection]]
+ set toj [http::geturl http://localhost:$httpd_port/testdoc.html?transfer= \
+ -protocol 1.1 -keepalive 1 -timeout 10000]
+ http::wait $toj
+ set res2 [list [http::status $toj] [http::code $toj] [check_crc $toj] \
+ [meta $toj connection] [meta $toj transfer-encoding] [state $toj reusing] [state $toj connection]]
+ concat $res1 -- $res2
+} -cleanup {
+ http::cleanup $tok
+ http::cleanup $toj
+ halt_httpd
+ http::config -zip $zipTmp
+} -result {ok {HTTP/1.1 200 OK} ok {} {} 0 keep-alive -- ok {HTTP/1.1 200 OK} ok {} {} 1 keep-alive}
+
# -------------------------------------------------------------------------
+proc progress {var token total current} {
+ upvar #0 $var log
+ set log [list $current $total]
+ return
+}
+
+proc progressPause {var token total current} {
+ upvar #0 $var log
+ set log [list $current $total]
+ after 100 set ::WaitHere 0
+ vwait ::WaitHere
+ return
+}
+
test http11-2.0 "-channel" -setup {
variable httpd [create_httpd]
set chan [open [makeFile {} testfile.tmp] wb+]
@@ -339,6 +392,58 @@ test http11-2.4 "-channel,encoding identity" -setup {
halt_httpd
} -result {ok {HTTP/1.1 200 OK} ok close {} chunked}
+test http11-2.4.1 "-channel,encoding identity with -progress" -setup {
+ variable httpd [create_httpd]
+ set chan [open [makeFile {} testfile.tmp] wb+]
+ set logdata ""
+} -body {
+ set tok [http::geturl http://localhost:$httpd_port/testdoc.html \
+ -timeout 5000 -channel $chan \
+ -headers {accept-encoding identity} \
+ -progress [namespace code [list progress logdata]]]
+
+ http::wait $tok
+ seek $chan 0
+ set data [read $chan]
+ list [http::status $tok] [http::code $tok] [check_crc $tok $data]\
+ [meta $tok connection] [meta $tok content-encoding]\
+ [meta $tok transfer-encoding] \
+ [expr {[lindex $logdata 0] - [lindex $logdata 1]}] \
+ [expr {[lindex $logdata 0] - [string length $data]}]
+} -cleanup {
+ http::cleanup $tok
+ close $chan
+ removeFile testfile.tmp
+ halt_httpd
+ unset -nocomplain logdata data
+} -result {ok {HTTP/1.1 200 OK} ok close {} chunked 0 0}
+
+test http11-2.4.2 "-channel,encoding identity with -progress progressPause enters event loop" -constraints knownBug -setup {
+ variable httpd [create_httpd]
+ set chan [open [makeFile {} testfile.tmp] wb+]
+ set logdata ""
+} -body {
+ set tok [http::geturl http://localhost:$httpd_port/testdoc.html \
+ -timeout 5000 -channel $chan \
+ -headers {accept-encoding identity} \
+ -progress [namespace code [list progressPause logdata]]]
+
+ http::wait $tok
+ seek $chan 0
+ set data [read $chan]
+ list [http::status $tok] [http::code $tok] [check_crc $tok $data]\
+ [meta $tok connection] [meta $tok content-encoding]\
+ [meta $tok transfer-encoding] \
+ [expr {[lindex $logdata 0] - [lindex $logdata 1]}] \
+ [expr {[lindex $logdata 0] - [string length $data]}]
+} -cleanup {
+ http::cleanup $tok
+ close $chan
+ removeFile testfile.tmp
+ halt_httpd
+ unset -nocomplain logdata data ::WaitHere
+} -result {ok {HTTP/1.1 200 OK} ok close {} chunked 0 0}
+
test http11-2.5 "-channel,encoding unsupported" -setup {
variable httpd [create_httpd]
set chan [open [makeFile {} testfile.tmp] wb+]
@@ -518,6 +623,16 @@ proc handler {var sock token} {
return [string length $chunk]
}
+proc handlerPause {var sock token} {
+ upvar #0 $var data
+ set chunk [read $sock]
+ append data $chunk
+ #::http::Log "handler read [string length $chunk] ([chan configure $sock -buffersize])"
+ after 100 set ::WaitHere 0
+ vwait ::WaitHere
+ return [string length $chunk]
+}
+
test http11-3.0 "-handler,close,identity" -setup {
variable httpd [create_httpd]
set testdata ""
@@ -589,6 +704,135 @@ test http11-3.3 "-handler,keepalive,chunked" -setup {
halt_httpd
} -result {ok {HTTP/1.0 200 OK} ok close {} {} 0}
+# http11-3.4
+# This test is a blatant attempt to confuse the client by instructing the server
+# to send neither "Connection: close" nor "Content-Length" when in non-chunked
+# mode.
+# The client has no way to know the response-body is complete unless the
+# server signals this by closing the connection.
+# In an HTTP/1.1 response the absence of "Connection: close" means
+# "Connection: keep-alive", i.e. the server will keep the connection
+# open. In HTTP/1.0 this is not the case, and this is a test that
+# the Tcl client assumes "Connection: close" by default in HTTP/1.0.
+test http11-3.4 "-handler,close,identity; HTTP/1.0 server does not send Connection: close header or Content-Length" -setup {
+ variable httpd [create_httpd]
+ set testdata ""
+} -body {
+ set tok [http::geturl http://localhost:$httpd_port/testdoc.html?close=1&nosendclose=any \
+ -timeout 10000 -handler [namespace code [list handler testdata]]]
+ http::wait $tok
+ list [http::status $tok] [http::code $tok] [check_crc $tok $testdata]\
+ [meta $tok connection] [meta $tok content-encoding] \
+ [meta $tok transfer-encoding] \
+ [expr {[file size testdoc.html]-[string length $testdata]}]
+} -cleanup {
+ http::cleanup $tok
+ unset -nocomplain testdata
+ halt_httpd
+} -result {ok {HTTP/1.0 200 OK} ok {} {} {} 0}
+
+# It is not forbidden for a handler to enter the event loop.
+test http11-3.5 "-handler,close,identity as http11-3.0 but handlerPause enters event loop" -setup {
+ variable httpd [create_httpd]
+ set testdata ""
+} -body {
+ set tok [http::geturl http://localhost:$httpd_port/testdoc.html?close=1 \
+ -timeout 10000 -handler [namespace code [list handlerPause testdata]]]
+ http::wait $tok
+ list [http::status $tok] [http::code $tok] [check_crc $tok $testdata]\
+ [meta $tok connection] [meta $tok content-encoding] \
+ [meta $tok transfer-encoding] \
+ [expr {[file size testdoc.html]-[string length $testdata]}]
+} -cleanup {
+ http::cleanup $tok
+ unset -nocomplain testdata ::WaitHere
+ halt_httpd
+} -result {ok {HTTP/1.0 200 OK} ok close {} {} 0}
+
+test http11-3.6 "-handler,close,identity as http11-3.0 but with -progress" -setup {
+ variable httpd [create_httpd]
+ set testdata ""
+ set logdata ""
+} -body {
+ set tok [http::geturl http://localhost:$httpd_port/testdoc.html?close=1 \
+ -timeout 10000 -handler [namespace code [list handler testdata]] \
+ -progress [namespace code [list progress logdata]]]
+ http::wait $tok
+ list [http::status $tok] [http::code $tok] [check_crc $tok $testdata]\
+ [meta $tok connection] [meta $tok content-encoding] \
+ [meta $tok transfer-encoding] \
+ [expr {[file size testdoc.html]-[string length $testdata]}] \
+ [expr {[lindex $logdata 0] - [lindex $logdata 1]}] \
+ [expr {[lindex $logdata 0] - [string length $testdata]}]
+} -cleanup {
+ http::cleanup $tok
+ unset -nocomplain testdata logdata ::WaitHere
+ halt_httpd
+} -result {ok {HTTP/1.0 200 OK} ok close {} {} 0 0 0}
+
+test http11-3.7 "-handler,close,identity as http11-3.0 but with -progress progressPause enters event loop" -setup {
+ variable httpd [create_httpd]
+ set testdata ""
+ set logdata ""
+} -body {
+ set tok [http::geturl http://localhost:$httpd_port/testdoc.html?close=1 \
+ -timeout 10000 -handler [namespace code [list handler testdata]] \
+ -progress [namespace code [list progressPause logdata]]]
+ http::wait $tok
+ list [http::status $tok] [http::code $tok] [check_crc $tok $testdata]\
+ [meta $tok connection] [meta $tok content-encoding] \
+ [meta $tok transfer-encoding] \
+ [expr {[file size testdoc.html]-[string length $testdata]}] \
+ [expr {[lindex $logdata 0] - [lindex $logdata 1]}] \
+ [expr {[lindex $logdata 0] - [string length $testdata]}]
+} -cleanup {
+ http::cleanup $tok
+ unset -nocomplain testdata logdata ::WaitHere
+ halt_httpd
+} -result {ok {HTTP/1.0 200 OK} ok close {} {} 0 0 0}
+
+test http11-3.8 "close,identity no -handler but with -progress" -setup {
+ variable httpd [create_httpd]
+ set logdata ""
+} -body {
+ set tok [http::geturl http://localhost:$httpd_port/testdoc.html?close=1 \
+ -timeout 10000 \
+ -progress [namespace code [list progress logdata]] \
+ -headers {accept-encoding {}}]
+ http::wait $tok
+ list [http::status $tok] [http::code $tok] [check_crc $tok]\
+ [meta $tok connection] [meta $tok content-encoding] \
+ [meta $tok transfer-encoding] \
+ [expr {[file size testdoc.html]-[string length [http::data $tok]]}] \
+ [expr {[lindex $logdata 0] - [lindex $logdata 1]}] \
+ [expr {[lindex $logdata 0] - [string length [http::data $tok]]}]
+} -cleanup {
+ http::cleanup $tok
+ unset -nocomplain logdata ::WaitHere
+ halt_httpd
+} -result {ok {HTTP/1.1 200 OK} ok close {} {} 0 0 0}
+
+test http11-3.9 "close,identity no -handler but with -progress progressPause enters event loop" -setup {
+ variable httpd [create_httpd]
+ set logdata ""
+} -body {
+ set tok [http::geturl http://localhost:$httpd_port/testdoc.html?close=1 \
+ -timeout 10000 \
+ -progress [namespace code [list progressPause logdata]] \
+ -headers {accept-encoding {}}]
+ http::wait $tok
+ list [http::status $tok] [http::code $tok] [check_crc $tok]\
+ [meta $tok connection] [meta $tok content-encoding] \
+ [meta $tok transfer-encoding] \
+ [expr {[file size testdoc.html]-[string length [http::data $tok]]}] \
+ [expr {[lindex $logdata 0] - [lindex $logdata 1]}] \
+ [expr {[lindex $logdata 0] - [string length [http::data $tok]]}]
+} -cleanup {
+ http::cleanup $tok
+ unset -nocomplain logdata ::WaitHere
+ halt_httpd
+} -result {ok {HTTP/1.1 200 OK} ok close {} {} 0 0 0}
+
test http11-4.0 "normal post request" -setup {
variable httpd [create_httpd]
} -body {
diff --git a/tests/httpPipeline.test b/tests/httpPipeline.test
index 8de79b9..4306149 100644
--- a/tests/httpPipeline.test
+++ b/tests/httpPipeline.test
@@ -8,10 +8,12 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
-namespace import -force ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
-package require http 2.8
+package require http 2.9
set sourcedir [file normalize [file dirname [info script]]]
source [file join $sourcedir httpTest.tcl]
diff --git a/tests/httpTest.tcl b/tests/httpTest.tcl
index 4345845..8a96d95 100644
--- a/tests/httpTest.tcl
+++ b/tests/httpTest.tcl
@@ -60,7 +60,7 @@ proc http::Log {args} {
variable TestStartTimeInMs
set time [expr {[clock milliseconds] - $TestStartTimeInMs}]
set txt [list $time {*}$args]
- if {[string first ^ $txt] != -1} {
+ if {[string first ^ $txt] >= 0} {
::httpTest::LogRecord $txt
::httpTest::Puts $txt
} elseif {$::httpTest::testOptions(-verbose) > 1} {
@@ -86,7 +86,7 @@ proc httpTest::LogRecord {txt} {
puts stdout "Fix this call to Log in http-*.tm so it has ^ then\
a letter then a numeral."
flush stdout
- } elseif {$pos == -1} {
+ } elseif {$pos < 0} {
# Called by mistake.
} else {
set letter [string index $txt [incr pos]]
@@ -153,7 +153,7 @@ proc httpTest::TestOverlaps {someResults n term msg badTrans notPiped} {
set myStart [lsearch -exact $someResults [list B $i]]
set myEnd [lsearch -exact $someResults [list $term $i]]
- if {($myStart == -1 || $myEnd == -1)} {
+ if {($myStart < 0 || $myEnd < 0)} {
set res "Cannot find positions of transaction $i"
append msg $res \n
Puts $res
@@ -374,7 +374,7 @@ proc httpTest::ProcessRetries {someResults n msg skipOverlaps notIncluded notPip
variable testOptions
set nextRetry [lsearch -glob -index 0 $someResults {[PQR]}]
- if {$nextRetry == -1} {
+ if {$nextRetry < 0} {
return [MostAnalysis $someResults $n $msg $skipOverlaps $notIncluded $notPiped]
}
set badTrans $notIncluded
@@ -391,7 +391,7 @@ proc httpTest::ProcessRetries {someResults n msg skipOverlaps notIncluded notPip
for {set i 1} {$i <= $n} {incr i} {
set first [lsearch -exact $beforeTry [list A $i]]
set last [lsearch -exact $beforeTry [list F $i]]
- if {$first == -1} {
+ if {$first < 0} {
set res "Transaction $i was not started in connection number $tryCount"
# So lappend it to badTrans and don't include it in the call below of MostAnalysis.
# append msg $res \n
@@ -400,7 +400,7 @@ proc httpTest::ProcessRetries {someResults n msg skipOverlaps notIncluded notPip
lappend badTrans $i
} else {
}
- } elseif {$last == -1} {
+ } elseif {$last < 0} {
set res "Transaction $i was started but unfinished in connection number $tryCount"
# So lappend it to badTrans and don't include it in the call below of MostAnalysis.
# append msg $res \n
diff --git a/tests/httpcookie.test b/tests/httpcookie.test
index b3c5412..ca54073 100644
--- a/tests/httpcookie.test
+++ b/tests/httpcookie.test
@@ -9,8 +9,10 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
-namespace import -force ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
::tcltest::loadTestedCommands
diff --git a/tests/httpd11.tcl b/tests/httpd11.tcl
index 7880494..89590ec 100644
--- a/tests/httpd11.tcl
+++ b/tests/httpd11.tcl
@@ -170,14 +170,19 @@ proc Service {chan addr port} {
set close 1
}
+ set nosendclose 0
foreach pair [split $query &] {
if {[scan $pair {%[^=]=%s} key val] != 2} {set val ""}
switch -exact -- $key {
+ nosendclose {set nosendclose 1}
close {set close 1 ; set transfer 0}
transfer {set transfer $val}
content-type {set type $val}
}
}
+ if {$protocol eq "HTTP/1.1"} {
+ set nosendclose 0
+ }
chan configure $chan -buffering line -encoding iso8859-1 -translation crlf
Puts $chan "$protocol $code"
@@ -186,12 +191,16 @@ proc Service {chan addr port} {
if {$req eq "POST"} {
Puts $chan [format "x-query-length: %d" [string length $query]]
}
- if {$close} {
+ if {$close && (!$nosendclose)} {
Puts $chan "connection: close"
}
Puts $chan "x-requested-encodings: [dict get? $meta accept-encoding]"
- if {$encoding eq "identity"} {
+ if {$encoding eq "identity" && (!$nosendclose)} {
Puts $chan "content-length: [string length $data]"
+ } elseif {$encoding eq "identity"} {
+ # This is a blatant attempt to confuse the client by sending neither
+ # "Connection: close" nor "Content-Length" when in non-chunked mode.
+ # See test http11-3.4.
} else {
Puts $chan "content-encoding: $encoding"
}
@@ -228,7 +237,7 @@ proc Accept {chan addr port} {
}
proc Control {chan} {
- if {[gets $chan line] != -1} {
+ if {[gets $chan line] >= 0} {
if {[string trim $line] eq "quit"} {
set ::forever 1
}
diff --git a/tests/if-old.test b/tests/if-old.test
index fbcf56c..e537fea 100644
--- a/tests/if-old.test
+++ b/tests/if-old.test
@@ -13,8 +13,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/if.test b/tests/if.test
index 040364a..f5acf60 100644
--- a/tests/if.test
+++ b/tests/if.test
@@ -10,8 +10,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/incr-old.test b/tests/incr-old.test
index ed457cf..5d792e1 100644
--- a/tests/incr-old.test
+++ b/tests/incr-old.test
@@ -13,8 +13,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/incr.test b/tests/incr.test
index aa2872a..9d92f85 100644
--- a/tests/incr.test
+++ b/tests/incr.test
@@ -11,7 +11,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/indexObj.test b/tests/indexObj.test
index 126d062..079eb52 100644
--- a/tests/indexObj.test
+++ b/tests/indexObj.test
@@ -8,8 +8,8 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/info.test b/tests/info.test
index ce51523..813b418 100644
--- a/tests/info.test
+++ b/tests/info.test
@@ -16,7 +16,7 @@
# DO NOT DELETE THIS LINE
if {{::tcltest} ni [namespace children]} {
- package require tcltest 2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
::tcltest::loadTestedCommands
@@ -2447,16 +2447,16 @@ test info-40.9 {info cmdtype: imports} -setup {
rename ::testinfocmdtype::bar {}
namespace delete ::testinfocmdtype::foo
} -result import
-test info-40.10 {info cmdtype: slaves} -setup {
+test info-40.10 {info cmdtype: interps} -setup {
apply {i {
- rename $i ::testinfocmdtype::slave
- variable ::testinfocmdtype::slave $i
+ rename $i ::testinfocmdtype::child
+ variable ::testinfocmdtype::child $i
}} [interp create]
} -body {
- info cmdtype ::testinfocmdtype::slave
+ info cmdtype ::testinfocmdtype::child
} -cleanup {
- interp delete $::testinfocmdtype::slave
-} -result slave
+ interp delete $::testinfocmdtype::child
+} -result interp
test info-40.11 {info cmdtype: objects} -setup {
apply {{} {
oo::object create obj
@@ -2518,7 +2518,7 @@ test info-40.16 {info cmdtype: dynamic behavior} -setup {
catch {rename bar {}}
}
} -result {0 1 ::testinfocmdtype::foo {} ::testinfocmdtype::bar 1 0}
-test info-40.17 {info cmdtype: aliases in slave interpreters} -setup {
+test info-40.17 {info cmdtype: aliases in child interpreters} -setup {
set i [interp create]
} -body {
$i alias foo gorp
@@ -2528,7 +2528,7 @@ test info-40.17 {info cmdtype: aliases in slave interpreters} -setup {
} -cleanup {
interp delete $i
} -result alias
-test info-40.18 {info cmdtype: aliases in slave interpreters} -setup {
+test info-40.18 {info cmdtype: aliases in child interpreters} -setup {
set safe [interp create -safe]
} -body {
$safe alias foo gorp
@@ -2538,7 +2538,7 @@ test info-40.18 {info cmdtype: aliases in slave interpreters} -setup {
} -returnCodes error -cleanup {
interp delete $safe
} -result {not allowed to invoke subcommand cmdtype of info}
-test info-40.19 {info cmdtype: aliases in slave interpreters} -setup {
+test info-40.19 {info cmdtype: aliases in child interpreters} -setup {
set safe [interp create -safe]
} -body {
set inner [interp create [list $safe bar]]
@@ -2551,7 +2551,7 @@ test info-40.19 {info cmdtype: aliases in slave interpreters} -setup {
} -returnCodes error -cleanup {
interp delete $safe
} -result {not allowed to invoke subcommand cmdtype of info}
-test info-40.20 {info cmdtype: aliases in slave interpreters} -setup {
+test info-40.20 {info cmdtype: aliases in child interpreters} -setup {
set safe [interp create -safe]
} -body {
$safe eval {
diff --git a/tests/init.test b/tests/init.test
index a241c0b..a607ff0 100644
--- a/tests/init.test
+++ b/tests/init.test
@@ -11,7 +11,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2.3.4
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -19,16 +19,16 @@ if {"::tcltest" ni [namespace children]} {
catch {namespace delete {*}[namespace children :: test_ns_*]}
test init-0.1 {no error on initialization phase (init.tcl)} -setup {
- interp create slave
+ interp create child
} -body {
- slave eval {
+ child eval {
list [set v [info exists ::errorInfo]] \
[if {$v} {set ::errorInfo}] \
[set v [info exists ::errorCode]] \
[if {$v} {set ::errorCode}]
}
} -cleanup {
- interp delete slave
+ interp delete child
} -result {0 {} 0 {}}
# Six cases - white box testing
@@ -59,11 +59,11 @@ test init-1.8 {auto_qualify - multiple colons 2} {
auto_qualify :::foo ::bar
} foo
-# We use a sub-interp and auto_reset and double the tests because there is 2
+# We use a child interp and auto_reset and double the tests because there is 2
# places where auto_loading occur (before loading the indexes files and after)
set testInterp [interp create]
-tcltest::loadIntoSlaveInterpreter $testInterp {*}$argv
+tcltest::loadIntoChildInterpreter $testInterp {*}$argv
interp eval $testInterp {
namespace import -force ::tcltest::*
customMatch pairwise {apply {{mode pair} {
diff --git a/tests/interp.test b/tests/interp.test
index 599ac08..f428207 100644
--- a/tests/interp.test
+++ b/tests/interp.test
@@ -11,7 +11,7 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2.1
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -22,7 +22,7 @@ testConstraint testinterpdelete [llength [info commands testinterpdelete]]
set hidden_cmds {cd encoding exec exit fconfigure file glob load open pwd socket source tcl:encoding:dirs tcl:encoding:system tcl:file:atime tcl:file:attributes tcl:file:copy tcl:file:delete tcl:file:dirname tcl:file:executable tcl:file:exists tcl:file:extension tcl:file:isdirectory tcl:file:isfile tcl:file:link tcl:file:lstat tcl:file:mkdir tcl:file:mtime tcl:file:nativename tcl:file:normalize tcl:file:owned tcl:file:readable tcl:file:readlink tcl:file:rename tcl:file:rootname tcl:file:size tcl:file:stat tcl:file:tail tcl:file:tempdir tcl:file:tempfile tcl:file:type tcl:file:volumes tcl:file:writable tcl:info:cmdtype tcl:info:nameofexecutable tcl:process:autopurge tcl:process:list tcl:process:purge tcl:process:status tcl:zipfs:lmkimg tcl:zipfs:lmkzip tcl:zipfs:mkimg tcl:zipfs:mkkey tcl:zipfs:mkzip tcl:zipfs:mount tcl:zipfs:mount_data tcl:zipfs:unmount unload}
-foreach i [interp slaves] {
+foreach i [interp children] {
interp delete $i
}
@@ -32,7 +32,7 @@ test interp-1.1 {options for interp command} -returnCodes error -body {
} -result {wrong # args: should be "interp cmd ?arg ...?"}
test interp-1.2 {options for interp command} -returnCodes error -body {
interp frobox
-} -result {bad option "frobox": must be alias, aliases, bgerror, cancel, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}
+} -result {bad option "frobox": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, share, target, or transfer}
test interp-1.3 {options for interp command} {
interp delete
} ""
@@ -46,17 +46,17 @@ test interp-1.5 {options for interp command} -returnCodes error -body {
# test interp-0.6 was removed
#
test interp-1.6 {options for interp command} -returnCodes error -body {
- interp slaves foo bar zop
-} -result {wrong # args: should be "interp slaves ?path?"}
+ interp children foo bar zop
+} -result {wrong # args: should be "interp children ?path?"}
test interp-1.7 {options for interp command} -returnCodes error -body {
interp hello
-} -result {bad option "hello": must be alias, aliases, bgerror, cancel, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}
+} -result {bad option "hello": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, share, target, or transfer}
test interp-1.8 {options for interp command} -returnCodes error -body {
interp -froboz
-} -result {bad option "-froboz": must be alias, aliases, bgerror, cancel, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}
+} -result {bad option "-froboz": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, share, target, or transfer}
test interp-1.9 {options for interp command} -returnCodes error -body {
interp -froboz -safe
-} -result {bad option "-froboz": must be alias, aliases, bgerror, cancel, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, slaves, share, target, or transfer}
+} -result {bad option "-froboz": must be alias, aliases, bgerror, cancel, children, create, debug, delete, eval, exists, expose, hide, hidden, issafe, invokehidden, limit, marktrusted, recursionlimit, share, target, or transfer}
test interp-1.10 {options for interp command} -returnCodes error -body {
interp target
} -result {wrong # args: should be "interp target path alias"}
@@ -120,45 +120,45 @@ test interp-2.13 {correct default when no $path arg is given} -body {
interp create --
} -match regexp -result {interp[0-9]+}
-foreach i [interp slaves] {
+foreach i [interp children] {
interp delete $i
}
-# Part 2: Testing "interp slaves" and "interp exists"
-test interp-3.1 {testing interp exists and interp slaves} {
- interp slaves
+# Part 2: Testing "interp children" and "interp exists"
+test interp-3.1 {testing interp exists and interp children} {
+ interp children
} ""
-test interp-3.2 {testing interp exists and interp slaves} {
+test interp-3.2 {testing interp exists and interp children} {
interp create a
interp exists a
} 1
-test interp-3.3 {testing interp exists and interp slaves} {
+test interp-3.3 {testing interp exists and interp children} {
interp exists nonexistent
} 0
-test interp-3.4 {testing interp exists and interp slaves} -body {
- interp slaves a b c
-} -returnCodes error -result {wrong # args: should be "interp slaves ?path?"}
-test interp-3.5 {testing interp exists and interp slaves} -body {
+test interp-3.4 {testing interp exists and interp children} -body {
+ interp children a b c
+} -returnCodes error -result {wrong # args: should be "interp children ?path?"}
+test interp-3.5 {testing interp exists and interp children} -body {
interp exists a b c
} -returnCodes error -result {wrong # args: should be "interp exists ?path?"}
-test interp-3.6 {testing interp exists and interp slaves} {
+test interp-3.6 {testing interp exists and interp children} {
interp exists
} 1
-test interp-3.7 {testing interp exists and interp slaves} -setup {
+test interp-3.7 {testing interp exists and interp children} -setup {
catch {interp create a}
} -body {
- interp slaves
+ interp children
} -result a
-test interp-3.8 {testing interp exists and interp slaves} -body {
- interp slaves a b c
-} -returnCodes error -result {wrong # args: should be "interp slaves ?path?"}
-test interp-3.9 {testing interp exists and interp slaves} -setup {
+test interp-3.8 {testing interp exists and interp children} -body {
+ interp children a b c
+} -returnCodes error -result {wrong # args: should be "interp children ?path?"}
+test interp-3.9 {testing interp exists and interp children} -setup {
catch {interp create a}
} -body {
interp create {a a2} -safe
- expr {"a2" in [interp slaves a]}
+ expr {"a2" in [interp children a]}
} -result 1
-test interp-3.10 {testing interp exists and interp slaves} -setup {
+test interp-3.10 {testing interp exists and interp children} -setup {
catch {interp create a}
catch {interp create {a a2}}
} -body {
@@ -186,7 +186,7 @@ test interp-4.5 {testing interp delete} {
interp create a
interp create {a x1}
interp delete {a x1}
- expr {"x1" in [interp slaves a]}
+ expr {"x1" in [interp children a]}
} 0
test interp-4.6 {testing interp delete} {
interp create c1
@@ -203,14 +203,14 @@ test interp-4.8 {testing interp delete} -returnCodes error -body {
interp delete {}
} -result {cannot delete the current interpreter}
-foreach i [interp slaves] {
+foreach i [interp children] {
interp delete $i
}
# Part 4: Consistency checking - all nondeleted interpreters should be
# there:
test interp-5.1 {testing consistency} {
- interp slaves
+ interp children
} ""
test interp-5.2 {testing consistency} {
interp exists a
@@ -247,27 +247,27 @@ test interp-6.6 {testing eval} -returnCodes error -body {
interp eval {a x2} foo
} -result {invalid command name "foo"}
-# UTILITY PROCEDURE RUNNING IN MASTER INTERPRETER:
-proc in_master {args} {
- return [list seen in master: $args]
+# UTILITY PROCEDURE RUNNING IN PARENT INTERPRETER:
+proc in_parent {args} {
+ return [list seen in parent: $args]
}
# Part 6: Testing basic alias creation
test interp-7.1 {testing basic alias creation} {
- a alias foo in_master
+ a alias foo in_parent
} foo
-catch {a alias foo in_master}
+catch {a alias foo in_parent}
test interp-7.2 {testing basic alias creation} {
- a alias bar in_master a1 a2 a3
+ a alias bar in_parent a1 a2 a3
} bar
-catch {a alias bar in_master a1 a2 a3}
+catch {a alias bar in_parent a1 a2 a3}
# Test 6.3 has been deleted.
test interp-7.3 {testing basic alias creation} {
a alias foo
-} in_master
+} in_parent
test interp-7.4 {testing basic alias creation} {
a alias bar
-} {in_master a1 a2 a3}
+} {in_parent a1 a2 a3}
test interp-7.5 {testing basic alias creation} {
lsort [a aliases]
} {bar foo}
@@ -278,14 +278,14 @@ test interp-7.6 {testing basic aliases arg checking} -returnCodes error -body {
# Part 7: testing basic alias invocation
test interp-8.1 {testing basic alias invocation} {
catch {interp create a}
- a alias foo in_master
+ a alias foo in_parent
a eval foo s1 s2 s3
-} {seen in master: {s1 s2 s3}}
+} {seen in parent: {s1 s2 s3}}
test interp-8.2 {testing basic alias invocation} {
catch {interp create a}
- a alias bar in_master a1 a2 a3
+ a alias bar in_parent a1 a2 a3
a eval bar s1 s2 s3
-} {seen in master: {a1 a2 a3 s1 s2 s3}}
+} {seen in parent: {a1 a2 a3 s1 s2 s3}}
test interp-8.3 {testing basic alias invocation} -returnCodes error -body {
catch {interp create a}
a alias
@@ -294,13 +294,13 @@ test interp-8.3 {testing basic alias invocation} -returnCodes error -body {
# Part 8: Testing aliases for non-existent or hidden targets
test interp-9.1 {testing aliases for non-existent targets} {
catch {interp create a}
- a alias zop nonexistent-command-in-master
+ a alias zop nonexistent-command-in-parent
list [catch {a eval zop} msg] $msg
-} {1 {invalid command name "nonexistent-command-in-master"}}
+} {1 {invalid command name "nonexistent-command-in-parent"}}
test interp-9.2 {testing aliases for non-existent targets} {
catch {interp create a}
- a alias zop nonexistent-command-in-master
- proc nonexistent-command-in-master {} {return i_exist!}
+ a alias zop nonexistent-command-in-parent
+ proc nonexistent-command-in-parent {} {return i_exist!}
a eval zop
} i_exist!
test interp-9.3 {testing aliases for hidden commands} {
@@ -329,8 +329,8 @@ test interp-9.4 {testing aliases and namespace commands} {
set res
} {GLOBAL GLOBAL}
-if {[info command nonexistent-command-in-master] != ""} {
- rename nonexistent-command-in-master {}
+if {[info command nonexistent-command-in-parent] != ""} {
+ rename nonexistent-command-in-parent {}
}
# Part 9: Aliasing between interpreters
@@ -380,9 +380,9 @@ test interp-10.6 {testing aliasing between interpreters} {
interp create a
interp create b
interp alias a a_command b b_command a1 a2 a3
- b alias b_command in_master b1 b2 b3
+ b alias b_command in_parent b1 b2 b3
a eval a_command m1 m2 m3
-} {seen in master: {b1 b2 b3 a1 a2 a3 m1 m2 m3}}
+} {seen in parent: {b1 b2 b3 a1 a2 a3 m1 m2 m3}}
test interp-10.7 {testing aliases between interpreters} {
catch {interp delete a}
interp create a
@@ -513,7 +513,7 @@ test interp-14.3 {testing interp aliases} {
interp alias {a x3} froboz "" puts
interp aliases {a x3}
} froboz
-test interp-14.4 {testing interp alias - alias over master} {
+test interp-14.4 {testing interp alias - alias over parent} {
# SF Bug 641195
catch {interp delete a}
interp create a
@@ -793,32 +793,32 @@ test interp-17.6 {alias loop prevention} {
} {1 {cannot define or rename alias "b": would create a loop}}
#
-# Test robustness of Tcl_DeleteInterp when applied to a slave interpreter.
+# Test robustness of Tcl_DeleteInterp when applied to a child interpreter.
# If there are bugs in the implementation these tests are likely to expose
# the bugs as a core dump.
#
-test interp-18.1 {testing Tcl_DeleteInterp vs slaves} testinterpdelete {
+test interp-18.1 {testing Tcl_DeleteInterp vs children} testinterpdelete {
list [catch {testinterpdelete} msg] $msg
} {1 {wrong # args: should be "testinterpdelete path"}}
-test interp-18.2 {testing Tcl_DeleteInterp vs slaves} testinterpdelete {
+test interp-18.2 {testing Tcl_DeleteInterp vs children} testinterpdelete {
catch {interp delete a}
interp create a
testinterpdelete a
} ""
-test interp-18.3 {testing Tcl_DeleteInterp vs slaves} testinterpdelete {
+test interp-18.3 {testing Tcl_DeleteInterp vs children} testinterpdelete {
catch {interp delete a}
interp create a
interp create {a b}
testinterpdelete {a b}
} ""
-test interp-18.4 {testing Tcl_DeleteInterp vs slaves} testinterpdelete {
+test interp-18.4 {testing Tcl_DeleteInterp vs children} testinterpdelete {
catch {interp delete a}
interp create a
interp create {a b}
testinterpdelete a
} ""
-test interp-18.5 {testing Tcl_DeleteInterp vs slaves} testinterpdelete {
+test interp-18.5 {testing Tcl_DeleteInterp vs children} testinterpdelete {
catch {interp delete a}
interp create a
interp create {a b}
@@ -826,7 +826,7 @@ test interp-18.5 {testing Tcl_DeleteInterp vs slaves} testinterpdelete {
proc dodel {x} {testinterpdelete $x}
list [catch {interp eval {a b} {dodel {a b}}} msg] $msg
} {0 {}}
-test interp-18.6 {testing Tcl_DeleteInterp vs slaves} testinterpdelete {
+test interp-18.6 {testing Tcl_DeleteInterp vs children} testinterpdelete {
catch {interp delete a}
interp create a
interp create {a b}
@@ -1615,36 +1615,36 @@ test interp-20.49 {interp invokehidden -namespace} -setup {
set script [makeFile {
set x [namespace current]
} script]
- interp create -safe slave
+ interp create -safe child
} -body {
- slave invokehidden -namespace ::foo source $script
- slave eval {set ::foo::x}
+ child invokehidden -namespace ::foo source $script
+ child eval {set ::foo::x}
} -cleanup {
- interp delete slave
+ interp delete child
removeFile script
} -result ::foo
test interp-20.50 {Bug 2486550} -setup {
- interp create slave
+ interp create child
} -body {
- slave hide coroutine
- slave invokehidden coroutine
+ child hide coroutine
+ child invokehidden coroutine
} -cleanup {
- interp delete slave
+ interp delete child
} -returnCodes error -match glob -result *
test interp-20.50.1 {Bug 2486550} -setup {
- interp create slave
+ interp create child
} -body {
- slave hide coroutine
- catch {slave invokehidden coroutine} m o
+ child hide coroutine
+ catch {child invokehidden coroutine} m o
dict get $o -errorinfo
} -cleanup {
unset -nocomplain m 0
- interp delete slave
+ interp delete child
} -returnCodes ok -result {wrong # args: should be "coroutine name cmd ?arg ...?"
while executing
"coroutine"
invoked from within
-"slave invokehidden coroutine"}
+"child invokehidden coroutine"}
test interp-21.1 {interp hidden} {
interp hidden {}
@@ -2058,8 +2058,8 @@ test interp-25.1 {testing aliasing of string commands} -setup {
test interp-26.1 {result code transmission : interp eval direct} {
# Test that all the possibles error codes from Tcl get passed up
- # from the slave interp's context to the master, even though the
- # slave nominally thinks the command is running at the root level.
+ # from the child interp's context to the parent, even though the
+ # child nominally thinks the command is running at the root level.
catch {interp delete a}
interp create a
set res {}
@@ -2085,7 +2085,7 @@ test interp-26.2 {result code transmission : interp eval indirect} {
} {-1 ret-1 0 ret0 1 ret1 0 ret2 3 ret3 4 ret4 5 ret5}
test interp-26.3 {result code transmission : aliases} {
# Test that all the possibles error codes from Tcl get passed up from the
- # slave interp's context to the master, even though the slave nominally
+ # child interp's context to the parent, even though the child nominally
# thinks the command is running at the root level.
catch {interp delete a}
interp create a
@@ -2180,7 +2180,7 @@ test interp-26.8 {errorInfo transmission: safe interps--bug 1637} -setup {
} -constraints knownBug -body {
# this test fails because the errorInfo is fully transmitted whether the
# interp is safe or not. The errorInfo should never report data from the
- # master interpreter because it could contain sensitive information.
+ # parent interpreter because it could contain sensitive information.
proc MyError {secret} {
return -code error "msg"
}
@@ -2275,22 +2275,22 @@ test interp-27.5 {interp hidden & namespaces} -setup {
test interp-27.6 {interp hidden & aliases & namespaces} -setup {
set i [interp create]
} -constraints knownBug -body {
- set v root-master
+ set v root-parent
namespace eval foo {
- variable v foo-master
+ variable v foo-parent
proc bar {interp args} {
variable v
- list "master bar called ($v) ([namespace current]) ($args)"\
+ list "parent bar called ($v) ([namespace current]) ($args)"\
[interp invokehidden $interp foo::bar $args]
}
}
interp eval $i {
namespace eval foo {
namespace export *
- variable v foo-slave
+ variable v foo-child
proc bar {args} {
variable v
- return "slave bar called ($v) ([namespace current]) ($args)"
+ return "child bar called ($v) ([namespace current]) ($args)"
}
}
}
@@ -2298,7 +2298,7 @@ test interp-27.6 {interp hidden & aliases & namespaces} -setup {
$i hide foo::bar
$i alias foo::bar foo::bar $i
set res [concat $res [interp eval $i {
- set v root-slave
+ set v root-child
namespace eval test {
variable v foo-test
namespace import ::foo::*
@@ -2308,29 +2308,29 @@ test interp-27.6 {interp hidden & aliases & namespaces} -setup {
} -cleanup {
namespace delete foo
interp delete $i
-} -result {{slave bar called (foo-slave) (::foo) (test1)} {master bar called (foo-master) (::foo) (test2)} {slave bar called (foo-slave) (::foo) (test2)}}
+} -result {{child bar called (foo-child) (::foo) (test1)} {parent bar called (foo-parent) (::foo) (test2)} {child bar called (foo-child) (::foo) (test2)}}
test interp-27.7 {interp hidden & aliases & imports & namespaces} -setup {
set i [interp create]
} -constraints knownBug -body {
- set v root-master
+ set v root-parent
namespace eval mfoo {
- variable v foo-master
+ variable v foo-parent
proc bar {interp args} {
variable v
- list "master bar called ($v) ([namespace current]) ($args)"\
+ list "parent bar called ($v) ([namespace current]) ($args)"\
[interp invokehidden $interp test::bar $args]
}
}
interp eval $i {
namespace eval foo {
namespace export *
- variable v foo-slave
+ variable v foo-child
proc bar {args} {
variable v
- return "slave bar called ($v) ([info level 0]) ([uplevel namespace current]) ([namespace current]) ($args)"
+ return "child bar called ($v) ([info level 0]) ([uplevel namespace current]) ([namespace current]) ($args)"
}
}
- set v root-slave
+ set v root-child
namespace eval test {
variable v foo-test
namespace import ::foo::*
@@ -2343,7 +2343,7 @@ test interp-27.7 {interp hidden & aliases & imports & namespaces} -setup {
} -cleanup {
namespace delete mfoo
interp delete $i
-} -result {{slave bar called (foo-slave) (bar test1) (::tcltest) (::foo) (test1)} {master bar called (foo-master) (::mfoo) (test2)} {slave bar called (foo-slave) (test::bar test2) (::) (::foo) (test2)}}
+} -result {{child bar called (foo-child) (bar test1) (::tcltest) (::foo) (test1)} {parent bar called (foo-parent) (::mfoo) (test2)} {child bar called (foo-child) (test::bar test2) (::) (::foo) (test2)}}
test interp-27.8 {hiding, namespaces and integrity} knownBug {
namespace eval foo {
variable v 3
@@ -2355,25 +2355,25 @@ test interp-27.8 {hiding, namespaces and integrity} knownBug {
list [catch {interp invokehidden {} foo::bar} msg] $msg
} {1 {invalid hidden command name "foo"}}
-test interp-28.1 {getting fooled by slave's namespace ?} -setup {
+test interp-28.1 {getting fooled by child's namespace ?} -setup {
set i [interp create -safe]
- proc master {interp args} {interp hide $interp list}
+ proc parent {interp args} {interp hide $interp list}
} -body {
- $i alias master master $i
+ $i alias parent parent $i
set r [interp eval $i {
namespace eval foo {
proc list {args} {
return "dummy foo::list"
}
- master
+ parent
}
info commands list
}]
} -cleanup {
- rename master {}
+ rename parent {}
interp delete $i
} -result {}
-test interp-28.2 {master's nsName cache should not cross} -setup {
+test interp-28.2 {parent's nsName cache should not cross} -setup {
set i [interp create]
$i eval {proc filter lst {lsearch -all -inline -not $lst "::tcl"}}
} -body {
@@ -2432,31 +2432,31 @@ test interp-29.1.7 {interp recursionlimit argument checking} {
interp delete moo
list $result [string range $msg 0 35]
} {1 {integer value too large to represent}}
-test interp-29.1.8 {slave recursionlimit argument checking} {
+test interp-29.1.8 {child recursionlimit argument checking} {
interp create moo
set result [catch {moo recursionlimit foo bar} msg]
interp delete moo
list $result $msg
} {1 {wrong # args: should be "moo recursionlimit ?newlimit?"}}
-test interp-29.1.9 {slave recursionlimit argument checking} {
+test interp-29.1.9 {child recursionlimit argument checking} {
interp create moo
set result [catch {moo recursionlimit foo} msg]
interp delete moo
list $result $msg
} {1 {expected integer but got "foo"}}
-test interp-29.1.10 {slave recursionlimit argument checking} {
+test interp-29.1.10 {child recursionlimit argument checking} {
interp create moo
set result [catch {moo recursionlimit 0} msg]
interp delete moo
list $result $msg
} {1 {recursion limit must be > 0}}
-test interp-29.1.11 {slave recursionlimit argument checking} {
+test interp-29.1.11 {child recursionlimit argument checking} {
interp create moo
set result [catch {moo recursionlimit -1} msg]
interp delete moo
list $result $msg
} {1 {recursion limit must be > 0}}
-test interp-29.1.12 {slave recursionlimit argument checking} {
+test interp-29.1.12 {child recursionlimit argument checking} {
interp create moo
set result [catch {moo recursionlimit [expr {wide(1)<<32}]} msg]
interp delete moo
@@ -2549,8 +2549,8 @@ test interp-29.3.3 {recursion limit} {
set r
} {1 {too many nested evaluations (infinite loop?)} 49}
test interp-29.3.4 {recursion limit error reporting} {
- interp create slave
- set r1 [slave eval {
+ interp create child
+ set r1 [child eval {
catch { # nesting level 1
eval { # 2
eval { # 3
@@ -2564,13 +2564,13 @@ test interp-29.3.4 {recursion limit error reporting} {
}
} msg
}]
- set r2 [slave eval { set msg }]
- interp delete slave
+ set r2 [child eval { set msg }]
+ interp delete child
list $r1 $r2
} {1 {falling back due to new recursion limit}}
test interp-29.3.5 {recursion limit error reporting} {
- interp create slave
- set r1 [slave eval {
+ interp create child
+ set r1 [child eval {
catch { # nesting level 1
eval { # 2
eval { # 3
@@ -2584,13 +2584,13 @@ test interp-29.3.5 {recursion limit error reporting} {
}
} msg
}]
- set r2 [slave eval { set msg }]
- interp delete slave
+ set r2 [child eval { set msg }]
+ interp delete child
list $r1 $r2
} {1 {falling back due to new recursion limit}}
test interp-29.3.6 {recursion limit error reporting} {
- interp create slave
- set r1 [slave eval {
+ interp create child
+ set r1 [child eval {
catch { # nesting level 1
eval { # 2
eval { # 3
@@ -2604,8 +2604,8 @@ test interp-29.3.6 {recursion limit error reporting} {
}
} msg
}]
- set r2 [slave eval { set msg }]
- interp delete slave
+ set r2 [child eval { set msg }]
+ interp delete child
list $r1 $r2
} {0 ok}
#
@@ -2613,9 +2613,9 @@ test interp-29.3.6 {recursion limit error reporting} {
# level will only be verified when it invokes a non-bcc'd command.
#
test interp-29.3.7a {recursion limit error reporting} {
- interp create slave
- after 0 {interp recursionlimit slave 5}
- set r1 [slave eval {
+ interp create child
+ after 0 {interp recursionlimit child 5}
+ set r1 [child eval {
catch { # nesting level 1
eval { # 2
eval { # 3
@@ -2629,14 +2629,14 @@ test interp-29.3.7a {recursion limit error reporting} {
}
} msg
}]
- set r2 [slave eval { set msg }]
- interp delete slave
+ set r2 [child eval { set msg }]
+ interp delete child
list $r1 $r2
} {0 ok}
test interp-29.3.7b {recursion limit error reporting} {
- interp create slave
- after 0 {interp recursionlimit slave 5}
- set r1 [slave eval {
+ interp create child
+ after 0 {interp recursionlimit child 5}
+ set r1 [child eval {
catch { # nesting level 1
eval { # 2
eval { # 3
@@ -2650,14 +2650,14 @@ test interp-29.3.7b {recursion limit error reporting} {
}
} msg
}]
- set r2 [slave eval { set msg }]
- interp delete slave
+ set r2 [child eval { set msg }]
+ interp delete child
list $r1 $r2
} {0 ok}
test interp-29.3.7c {recursion limit error reporting} {
- interp create slave
- after 0 {interp recursionlimit slave 5}
- set r1 [slave eval {
+ interp create child
+ after 0 {interp recursionlimit child 5}
+ set r1 [child eval {
catch { # nesting level 1
eval { # 2
eval { # 3
@@ -2672,14 +2672,14 @@ test interp-29.3.7c {recursion limit error reporting} {
}
} msg
}]
- set r2 [slave eval { set msg }]
- interp delete slave
+ set r2 [child eval { set msg }]
+ interp delete child
list $r1 $r2
} {1 {too many nested evaluations (infinite loop?)}}
test interp-29.3.8a {recursion limit error reporting} {
- interp create slave
- after 0 {interp recursionlimit slave 4}
- set r1 [slave eval {
+ interp create child
+ after 0 {interp recursionlimit child 4}
+ set r1 [child eval {
catch { # nesting level 1
eval { # 2
eval { # 3
@@ -2693,14 +2693,14 @@ test interp-29.3.8a {recursion limit error reporting} {
}
} msg
}]
- set r2 [slave eval { set msg }]
- interp delete slave
+ set r2 [child eval { set msg }]
+ interp delete child
list $r1 $r2
} {0 ok}
test interp-29.3.8b {recursion limit error reporting} {
- interp create slave
- after 0 {interp recursionlimit slave 4}
- set r1 [slave eval {
+ interp create child
+ after 0 {interp recursionlimit child 4}
+ set r1 [child eval {
catch { # nesting level 1
eval { # 2
eval { # 3
@@ -2714,14 +2714,14 @@ test interp-29.3.8b {recursion limit error reporting} {
}
} msg
}]
- set r2 [slave eval { set msg }]
- interp delete slave
+ set r2 [child eval { set msg }]
+ interp delete child
list $r1 $r2
} {1 {too many nested evaluations (infinite loop?)}}
test interp-29.3.9a {recursion limit error reporting} {
- interp create slave
- after 0 {interp recursionlimit slave 6}
- set r1 [slave eval {
+ interp create child
+ after 0 {interp recursionlimit child 6}
+ set r1 [child eval {
catch { # nesting level 1
eval { # 2
eval { # 3
@@ -2735,14 +2735,14 @@ test interp-29.3.9a {recursion limit error reporting} {
}
} msg
}]
- set r2 [slave eval { set msg }]
- interp delete slave
+ set r2 [child eval { set msg }]
+ interp delete child
list $r1 $r2
} {0 ok}
test interp-29.3.9b {recursion limit error reporting} {
- interp create slave
- after 0 {interp recursionlimit slave 6}
- set r1 [slave eval {
+ interp create child
+ after 0 {interp recursionlimit child 6}
+ set r1 [child eval {
catch { # nesting level 1
eval { # 2
eval { # 3
@@ -2756,14 +2756,14 @@ test interp-29.3.9b {recursion limit error reporting} {
}
} msg
}]
- set r2 [slave eval { set msg }]
- interp delete slave
+ set r2 [child eval { set msg }]
+ interp delete child
list $r1 $r2
} {0 ok}
test interp-29.3.10a {recursion limit error reporting} {
- interp create slave
- after 0 {slave recursionlimit 4}
- set r1 [slave eval {
+ interp create child
+ after 0 {child recursionlimit 4}
+ set r1 [child eval {
catch { # nesting level 1
eval { # 2
eval { # 3
@@ -2777,14 +2777,14 @@ test interp-29.3.10a {recursion limit error reporting} {
}
} msg
}]
- set r2 [slave eval { set msg }]
- interp delete slave
+ set r2 [child eval { set msg }]
+ interp delete child
list $r1 $r2
} {0 ok}
test interp-29.3.10b {recursion limit error reporting} {
- interp create slave
- after 0 {slave recursionlimit 4}
- set r1 [slave eval {
+ interp create child
+ after 0 {child recursionlimit 4}
+ set r1 [child eval {
catch { # nesting level 1
eval { # 2
eval { # 3
@@ -2798,14 +2798,14 @@ test interp-29.3.10b {recursion limit error reporting} {
}
} msg
}]
- set r2 [slave eval { set msg }]
- interp delete slave
+ set r2 [child eval { set msg }]
+ interp delete child
list $r1 $r2
} {1 {too many nested evaluations (infinite loop?)}}
test interp-29.3.11a {recursion limit error reporting} {
- interp create slave
- after 0 {slave recursionlimit 5}
- set r1 [slave eval {
+ interp create child
+ after 0 {child recursionlimit 5}
+ set r1 [child eval {
catch { # nesting level 1
eval { # 2
eval { # 3
@@ -2819,14 +2819,14 @@ test interp-29.3.11a {recursion limit error reporting} {
}
} msg
}]
- set r2 [slave eval { set msg }]
- interp delete slave
+ set r2 [child eval { set msg }]
+ interp delete child
list $r1 $r2
} {0 ok}
test interp-29.3.11b {recursion limit error reporting} {
- interp create slave
- after 0 {slave recursionlimit 5}
- set r1 [slave eval {
+ interp create child
+ after 0 {child recursionlimit 5}
+ set r1 [child eval {
catch { # nesting level 1
eval { # 2
eval { # 3
@@ -2841,14 +2841,14 @@ test interp-29.3.11b {recursion limit error reporting} {
}
} msg
}]
- set r2 [slave eval { set msg }]
- interp delete slave
+ set r2 [child eval { set msg }]
+ interp delete child
list $r1 $r2
} {1 {too many nested evaluations (infinite loop?)}}
test interp-29.3.12a {recursion limit error reporting} {
- interp create slave
- after 0 {slave recursionlimit 6}
- set r1 [slave eval {
+ interp create child
+ after 0 {child recursionlimit 6}
+ set r1 [child eval {
catch { # nesting level 1
eval { # 2
eval { # 3
@@ -2862,14 +2862,14 @@ test interp-29.3.12a {recursion limit error reporting} {
}
} msg
}]
- set r2 [slave eval { set msg }]
- interp delete slave
+ set r2 [child eval { set msg }]
+ interp delete child
list $r1 $r2
} {0 ok}
test interp-29.3.12b {recursion limit error reporting} {
- interp create slave
- after 0 {slave recursionlimit 6}
- set r1 [slave eval {
+ interp create child
+ after 0 {child recursionlimit 6}
+ set r1 [child eval {
catch { # nesting level 1
eval { # 2
eval { # 3
@@ -2884,8 +2884,8 @@ test interp-29.3.12b {recursion limit error reporting} {
}
} msg
}]
- set r2 [slave eval { set msg }]
- interp delete slave
+ set r2 [child eval { set msg }]
+ interp delete child
list $r1 $r2
} {0 ok}
test interp-29.4.1 {recursion limit inheritance} {
@@ -2916,121 +2916,121 @@ test interp-29.4.2 {recursion limit inheritance} {
interp delete $i
set r
} 50
-test interp-29.5.1 {does slave recursion limit affect master?} {
+test interp-29.5.1 {does child recursion limit affect parent?} {
set before [interp recursionlimit {}]
set i [interp create]
interp recursionlimit $i 20000
set after [interp recursionlimit {}]
- set slavelimit [interp recursionlimit $i]
+ set childlimit [interp recursionlimit $i]
interp delete $i
- list [expr {$before == $after}] $slavelimit
+ list [expr {$before == $after}] $childlimit
} {1 20000}
-test interp-29.5.2 {does slave recursion limit affect master?} {
+test interp-29.5.2 {does child recursion limit affect parent?} {
set before [interp recursionlimit {}]
set i [interp create]
interp recursionlimit $i 20000
set after [interp recursionlimit {}]
- set slavelimit [$i recursionlimit]
+ set childlimit [$i recursionlimit]
interp delete $i
- list [expr {$before == $after}] $slavelimit
+ list [expr {$before == $after}] $childlimit
} {1 20000}
-test interp-29.5.3 {does slave recursion limit affect master?} {
+test interp-29.5.3 {does child recursion limit affect parent?} {
set before [interp recursionlimit {}]
set i [interp create]
$i recursionlimit 20000
set after [interp recursionlimit {}]
- set slavelimit [interp recursionlimit $i]
+ set childlimit [interp recursionlimit $i]
interp delete $i
- list [expr {$before == $after}] $slavelimit
+ list [expr {$before == $after}] $childlimit
} {1 20000}
-test interp-29.5.4 {does slave recursion limit affect master?} {
+test interp-29.5.4 {does child recursion limit affect parent?} {
set before [interp recursionlimit {}]
set i [interp create]
$i recursionlimit 20000
set after [interp recursionlimit {}]
- set slavelimit [$i recursionlimit]
+ set childlimit [$i recursionlimit]
interp delete $i
- list [expr {$before == $after}] $slavelimit
+ list [expr {$before == $after}] $childlimit
} {1 20000}
test interp-29.6.1 {safe interpreter recursion limit} {
- interp create slave -safe
- set n [interp recursionlimit slave]
- interp delete slave
+ interp create child -safe
+ set n [interp recursionlimit child]
+ interp delete child
set n
} 1000
test interp-29.6.2 {safe interpreter recursion limit} {
- interp create slave -safe
- set n [slave recursionlimit]
- interp delete slave
+ interp create child -safe
+ set n [child recursionlimit]
+ interp delete child
set n
} 1000
test interp-29.6.3 {safe interpreter recursion limit} {
- interp create slave -safe
- set n1 [interp recursionlimit slave 42]
- set n2 [interp recursionlimit slave]
- interp delete slave
+ interp create child -safe
+ set n1 [interp recursionlimit child 42]
+ set n2 [interp recursionlimit child]
+ interp delete child
list $n1 $n2
} {42 42}
test interp-29.6.4 {safe interpreter recursion limit} {
- interp create slave -safe
- set n1 [slave recursionlimit 42]
- set n2 [interp recursionlimit slave]
- interp delete slave
+ interp create child -safe
+ set n1 [child recursionlimit 42]
+ set n2 [interp recursionlimit child]
+ interp delete child
list $n1 $n2
} {42 42}
test interp-29.6.5 {safe interpreter recursion limit} {
- interp create slave -safe
- set n1 [interp recursionlimit slave 42]
- set n2 [slave recursionlimit]
- interp delete slave
+ interp create child -safe
+ set n1 [interp recursionlimit child 42]
+ set n2 [child recursionlimit]
+ interp delete child
list $n1 $n2
} {42 42}
test interp-29.6.6 {safe interpreter recursion limit} {
- interp create slave -safe
- set n1 [slave recursionlimit 42]
- set n2 [slave recursionlimit]
- interp delete slave
+ interp create child -safe
+ set n1 [child recursionlimit 42]
+ set n2 [child recursionlimit]
+ interp delete child
list $n1 $n2
} {42 42}
test interp-29.6.7 {safe interpreter recursion limit} {
- interp create slave -safe
- set n1 [slave recursionlimit 42]
- set n2 [slave recursionlimit]
- interp delete slave
+ interp create child -safe
+ set n1 [child recursionlimit 42]
+ set n2 [child recursionlimit]
+ interp delete child
list $n1 $n2
} {42 42}
test interp-29.6.8 {safe interpreter recursion limit} {
- interp create slave -safe
- set n [catch {slave eval {interp recursionlimit {} 42}} msg]
- interp delete slave
+ interp create child -safe
+ set n [catch {child eval {interp recursionlimit {} 42}} msg]
+ interp delete child
list $n $msg
} {1 {permission denied: safe interpreters cannot change recursion limit}}
test interp-29.6.9 {safe interpreter recursion limit} {
- interp create slave -safe
+ interp create child -safe
set result [
- slave eval {
- interp create slave2 -safe
+ child eval {
+ interp create child2 -safe
set n [catch {
- interp recursionlimit slave2 42
+ interp recursionlimit child2 42
} msg]
list $n $msg
}
]
- interp delete slave
+ interp delete child
set result
} {1 {permission denied: safe interpreters cannot change recursion limit}}
test interp-29.6.10 {safe interpreter recursion limit} {
- interp create slave -safe
+ interp create child -safe
set result [
- slave eval {
- interp create slave2 -safe
+ child eval {
+ interp create child2 -safe
set n [catch {
- slave2 recursionlimit 42
+ child2 recursionlimit 42
} msg]
list $n $msg
}
]
- interp delete slave
+ interp delete child
set result
} {1 {permission denied: safe interpreters cannot change recursion limit}}
@@ -3559,44 +3559,44 @@ test interp-36.2 {interp bgerror syntax} -body {
interp bgerror x y z
} -returnCodes error -result {wrong # args: should be "interp bgerror path ?cmdPrefix?"}
test interp-36.3 {interp bgerror syntax} -setup {
- interp create slave
+ interp create child
} -body {
- slave bgerror x y
+ child bgerror x y
} -cleanup {
- interp delete slave
-} -returnCodes error -result {wrong # args: should be "slave bgerror ?cmdPrefix?"}
-test interp-36.4 {SlaveBgerror syntax} -setup {
- interp create slave
+ interp delete child
+} -returnCodes error -result {wrong # args: should be "child bgerror ?cmdPrefix?"}
+test interp-36.4 {ChildBgerror syntax} -setup {
+ interp create child
} -body {
- slave bgerror \{
+ child bgerror \{
} -cleanup {
- interp delete slave
+ interp delete child
} -returnCodes error -result {cmdPrefix must be list of length >= 1}
-test interp-36.5 {SlaveBgerror syntax} -setup {
- interp create slave
+test interp-36.5 {ChildBgerror syntax} -setup {
+ interp create child
} -body {
- slave bgerror {}
+ child bgerror {}
} -cleanup {
- interp delete slave
+ interp delete child
} -returnCodes error -result {cmdPrefix must be list of length >= 1}
-test interp-36.6 {SlaveBgerror returns handler} -setup {
- interp create slave
+test interp-36.6 {ChildBgerror returns handler} -setup {
+ interp create child
} -body {
- slave bgerror {foo bar soom}
+ child bgerror {foo bar soom}
} -cleanup {
- interp delete slave
+ interp delete child
} -result {foo bar soom}
-test interp-36.7 {SlaveBgerror sets error handler of slave [1999035]} -setup {
- interp create slave
- slave alias handler handler
- slave bgerror handler
+test interp-36.7 {ChildBgerror sets error handler of child [1999035]} -setup {
+ interp create child
+ child alias handler handler
+ child bgerror handler
variable result {untouched}
proc handler {args} {
variable result
set result [lindex $args 0]
}
} -body {
- slave eval {
+ child eval {
variable done {}
after 0 error foo
after 10 [list ::set [namespace which -variable done] {}]
@@ -3606,7 +3606,7 @@ test interp-36.7 {SlaveBgerror sets error handler of slave [1999035]} -setup {
} -cleanup {
variable result {}
unset -nocomplain result
- interp delete slave
+ interp delete child
} -result foo
test interp-37.1 {safe interps and min() and max(): Bug 2895741} -setup {
@@ -3667,7 +3667,7 @@ test interp-38.8 {interp debug basic setup} -body {
# cleanup
unset -nocomplain hidden_cmds
-foreach i [interp slaves] {
+foreach i [interp children] {
interp delete $i
}
::tcltest::cleanupTests
diff --git a/tests/io.test b/tests/io.test
index 73481ca..2752408 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -13,8 +13,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
}
namespace eval ::tcl::test::io {
@@ -38,12 +38,13 @@ namespace eval ::tcl::test::io {
testConstraint testbytestring [llength [info commands testbytestring]]
testConstraint testchannel [llength [info commands testchannel]]
-testConstraint openpipe 1
testConstraint testfevent [llength [info commands testfevent]]
testConstraint testchannelevent [llength [info commands testchannelevent]]
testConstraint testmainthread [llength [info commands testmainthread]]
testConstraint testobj [llength [info commands testobj]]
+testConstraint testservicemode [llength [info commands testservicemode]]
testConstraint knownMsvcBug [expr {![info exists ::env(TRAVIS_OS_NAME)] || ![string match windows $::env(TRAVIS_OS_NAME)]}]
+testConstraint notOSX [expr {$::tcl_platform(os) ne "Darwin"}]
# You need a *very* special environment to do some tests. In
# particular, many file systems do not support large-files...
@@ -481,7 +482,7 @@ test io-6.6 {Tcl_GetsObj: loop test} {
close $f
set x
} [list 256 $a]
-test io-6.7 {Tcl_GetsObj: error in input} {stdio openpipe} {
+test io-6.7 {Tcl_GetsObj: error in input} stdio {
# if (FilterInputBytes(chanPtr, &gs) != 0)
set f [open "|[list [interpreter] $path(cat)]" w+]
@@ -741,7 +742,7 @@ test io-6.30 {Tcl_GetsObj: crlf mode: buffer exhausted} {testchannel} {
close $f
set x
} [list 15 "123456789012345" 15]
-test io-6.31 {Tcl_GetsObj: crlf mode: buffer exhausted, blocked} {stdio testchannel openpipe fileevent} {
+test io-6.31 {Tcl_GetsObj: crlf mode: buffer exhausted, blocked} {stdio testchannel fileevent} {
# (FilterInputBytes() != 0)
set f [open "|[list [interpreter] $path(cat)]" w+]
@@ -880,7 +881,7 @@ test io-6.42 {Tcl_GetsObj: auto mode: several chars} {
close $f
set x
} [list 4 "abcd" 4 "efgh" 4 "ijkl" 4 "mnop" -1 ""]
-test io-6.43 {Tcl_GetsObj: input saw cr} {stdio testchannel openpipe fileevent} {
+test io-6.43 {Tcl_GetsObj: input saw cr} {stdio testchannel fileevent} {
# if (chanPtr->flags & INPUT_SAW_CR)
set f [open "|[list [interpreter] $path(cat)]" w+]
@@ -897,7 +898,7 @@ test io-6.43 {Tcl_GetsObj: input saw cr} {stdio testchannel openpipe fileevent}
close $f
set x
} [list "bbbbbbbbbbbbbbb" 15 "123456789abcdef" 1 4 "abcd" 0 3 "efg"]
-test io-6.44 {Tcl_GetsObj: input saw cr, not followed by cr} {stdio testchannel openpipe fileevent} {
+test io-6.44 {Tcl_GetsObj: input saw cr, not followed by cr} {stdio testchannel fileevent} {
# not (*eol == '\n')
set f [open "|[list [interpreter] $path(cat)]" w+]
@@ -914,7 +915,7 @@ test io-6.44 {Tcl_GetsObj: input saw cr, not followed by cr} {stdio testchannel
close $f
set x
} [list "bbbbbbbbbbbbbbb" 15 "123456789abcdef" 1 4 "abcd" 0 3 "efg"]
-test io-6.45 {Tcl_GetsObj: input saw cr, skip right number of bytes} {stdio testchannel openpipe fileevent} {
+test io-6.45 {Tcl_GetsObj: input saw cr, skip right number of bytes} {stdio testchannel fileevent} {
# Tcl_ExternalToUtf()
set f [open "|[list [interpreter] $path(cat)]" w+]
@@ -931,7 +932,7 @@ test io-6.45 {Tcl_GetsObj: input saw cr, skip right number of bytes} {stdio test
close $f
set x
} [list 15 "123456789abcdef" 1 4 "abcd" 0]
-test io-6.46 {Tcl_GetsObj: input saw cr, followed by just \n should give eof} {stdio testchannel openpipe fileevent} {
+test io-6.46 {Tcl_GetsObj: input saw cr, followed by just \n should give eof} {stdio testchannel fileevent} {
# memmove()
set f [open "|[list [interpreter] $path(cat)]" w+]
@@ -1056,7 +1057,7 @@ test io-6.55 {Tcl_GetsObj: overconverted} {
close $f
set x
} [list 8 "there\u4e00ok" 11 "\u4e01more bytes" 4 "here"]
-test io-6.56 {Tcl_GetsObj: incomplete lines should disable file events} {stdio openpipe fileevent} {
+test io-6.56 {Tcl_GetsObj: incomplete lines should disable file events} {stdio fileevent} {
update
set f [open "|[list [interpreter] $path(cat)]" w+]
fconfigure $f -buffering none
@@ -1116,7 +1117,7 @@ test io-7.3 {FilterInputBytes: split up character at EOF} {testchannel} {
close $f
set x
} [list 15 "1234567890123\uff10\uff11" 18 0 1 -1 ""]
-test io-7.4 {FilterInputBytes: recover from split up character} {stdio openpipe fileevent} {
+test io-7.4 {FilterInputBytes: recover from split up character} {stdio fileevent} {
set f [open "|[list [interpreter] $path(cat)]" w+]
fconfigure $f -encoding binary -buffering none
puts -nonewline $f "1234567890123\x82\x4f\x82\x50\x82"
@@ -1151,7 +1152,7 @@ test io-8.1 {PeekAhead: only go to device if no more cached data} {testchannel}
close $f
set x
} "7"
-test io-8.2 {PeekAhead: only go to device if no more cached data} {stdio testchannel openpipe fileevent} {
+test io-8.2 {PeekAhead: only go to device if no more cached data} {stdio testchannel fileevent} {
# not (bufPtr->nextPtr == NULL)
set f [open "|[list [interpreter] $path(cat)]" w+]
@@ -1171,7 +1172,7 @@ test io-8.2 {PeekAhead: only go to device if no more cached data} {stdio testcha
close $f
set x
} [list -1 "" 42 15 "123456789012345" 25]
-test io-8.3 {PeekAhead: no cached data available} {stdio testchannel openpipe fileevent} {
+test io-8.3 {PeekAhead: no cached data available} {stdio testchannel fileevent} {
# (bytesLeft == 0)
set f [open "|[list [interpreter] $path(cat)]" w+]
@@ -1204,7 +1205,7 @@ test io-8.4 {PeekAhead: cached data available in this buffer} {
set x
} $a
unset a
-test io-8.5 {PeekAhead: don't peek if last read was short} {stdio testchannel openpipe fileevent} {
+test io-8.5 {PeekAhead: don't peek if last read was short} {stdio testchannel fileevent} {
# (bufPtr->nextAdded < bufPtr->length)
set f [open "|[list [interpreter] $path(cat)]" w+]
@@ -1216,7 +1217,7 @@ test io-8.5 {PeekAhead: don't peek if last read was short} {stdio testchannel op
close $f
set x
} {15 abcdefghijklmno 1}
-test io-8.6 {PeekAhead: change to non-blocking mode} {stdio testchannel openpipe fileevent} {
+test io-8.6 {PeekAhead: change to non-blocking mode} {stdio testchannel fileevent} {
# ((chanPtr->flags & CHANNEL_NONBLOCKING) == 0)
set f [open "|[list [interpreter] $path(cat)]" w+]
@@ -1228,7 +1229,7 @@ test io-8.6 {PeekAhead: change to non-blocking mode} {stdio testchannel openpipe
close $f
set x
} {15 abcdefghijklmno 1}
-test io-8.7 {PeekAhead: cleanup} {stdio testchannel openpipe fileevent} {
+test io-8.7 {PeekAhead: cleanup} {stdio testchannel fileevent} {
# Make sure bytes are removed from buffer.
set f [open "|[list [interpreter] $path(cat)]" w+]
@@ -1393,7 +1394,7 @@ test io-12.3 {ReadChars: allocate more space} {
close $f
set x
} {abcdefghijklmnopqrstuvwxyz}
-test io-12.4 {ReadChars: split-up char} {stdio testchannel openpipe fileevent} {
+test io-12.4 {ReadChars: split-up char} {stdio testchannel fileevent} {
# (srcRead == 0)
set f [open "|[list [interpreter] $path(cat)]" w+]
@@ -1418,7 +1419,7 @@ test io-12.4 {ReadChars: split-up char} {stdio testchannel openpipe fileevent} {
close $f
set x
} [list "123456789012345" 1 "\u672c" 0]
-test io-12.5 {ReadChars: fileevents on partial characters} {stdio openpipe fileevent} {
+test io-12.5 {ReadChars: fileevents on partial characters} {stdio fileevent} {
set path(test1) [makeFile {
fconfigure stdout -encoding binary -buffering none
gets stdin; puts -nonewline "\xe7"
@@ -1612,7 +1613,7 @@ test io-13.5 {TranslateInputEOL: crlf mode: naked lf} {
close $f
set x
} "abcd\ndef\nfgh"
-test io-13.6 {TranslateInputEOL: auto mode: saw cr in last segment} {stdio testchannel openpipe fileevent} {
+test io-13.6 {TranslateInputEOL: auto mode: saw cr in last segment} {stdio testchannel fileevent} {
# (chanPtr->flags & INPUT_SAW_CR)
# This test may fail on slower machines.
@@ -1638,7 +1639,7 @@ test io-13.6 {TranslateInputEOL: auto mode: saw cr in last segment} {stdio testc
close $f
set x
} [list "abcdefghj\n" 1 "01234" 0]
-test io-13.7 {TranslateInputEOL: auto mode: naked \r} {testchannel openpipe} {
+test io-13.7 {TranslateInputEOL: auto mode: naked \r} testchannel {
# (src >= srcMax)
set f [open $path(test1) w]
@@ -1783,7 +1784,7 @@ test io-14.2 {Tcl_SetStdChannel and Tcl_GetStdChannel} {
set l
} {line line none}
set path(test3) [makeFile {} test3]
-test io-14.3 {Tcl_SetStdChannel & Tcl_GetStdChannel} {exec openpipe} {
+test io-14.3 {Tcl_SetStdChannel & Tcl_GetStdChannel} exec {
set f [open $path(test1) w]
puts -nonewline $f {
close stdin
@@ -1873,7 +1874,7 @@ test io-14.7 {Tcl_GetChannel: stdio name translation} {
set result
} {{} {} {can not find channel named "stderr"}}
set path(script) [makeFile {} script]
-test io-14.8 {reuse of stdio special channels} {stdio openpipe} {
+test io-14.8 {reuse of stdio special channels} stdio {
file delete $path(script)
file delete $path(test1)
set f [open $path(script) w]
@@ -1895,7 +1896,7 @@ test io-14.8 {reuse of stdio special channels} {stdio openpipe} {
close $f
set c
} hello
-test io-14.9 {reuse of stdio special channels} {stdio openpipe fileevent} {
+test io-14.9 {reuse of stdio special channels} {stdio fileevent} {
file delete $path(script)
file delete $path(test1)
set f [open $path(script) w]
@@ -2078,7 +2079,7 @@ test io-20.3 {Tcl_CreateChannel: initial settings} {unix} {
set x
} {{{} {}} {auto lf}}
set path(stdout) [makeFile {} stdout]
-test io-20.5 {Tcl_CreateChannel: install channel in empty slot} {stdio openpipe} {
+test io-20.5 {Tcl_CreateChannel: install channel in empty slot} stdio {
set f [open $path(script) w]
puts -nonewline $f {
close stdout
@@ -2152,7 +2153,7 @@ test io-25.2 {Tcl_GetChannelHandle, output} {testchannel} {
set l
} {6 6 0 6}
-test io-26.1 {Tcl_GetChannelInstanceData} {stdio openpipe} {
+test io-26.1 {Tcl_GetChannelInstanceData} stdio {
# "pid" command uses Tcl_GetChannelInstanceData
# Don't care what pid is (but must be a number), just want to exercise it.
@@ -2229,7 +2230,7 @@ test io-27.5 {FlushChannel, implicit flush when buffer fills and on close} \
set path(pipe) [makeFile {} pipe]
set path(output) [makeFile {} output]
test io-27.6 {FlushChannel, async flushing, async close} \
- {stdio asyncPipeClose openpipe knownMsvcBug} {
+ {stdio asyncPipeClose knownMsvcBug} {
# This test may fail on old Unix systems (seen on IRIX64 6.5) with
# obsolete gettimeofday() calls. See Tcl Bugs 3530533, 1942197.
file delete $path(pipe)
@@ -2298,7 +2299,7 @@ test io-28.2 {CloseChannel called when all references are dropped} {
set l
} abcdef
test io-28.3 {CloseChannel, not called before output queue is empty} \
- {stdio asyncPipeClose nonPortable openpipe} {
+ {stdio asyncPipeClose nonPortable} {
file delete $path(pipe)
file delete $path(output)
set f [open $path(pipe) w]
@@ -2355,7 +2356,7 @@ test io-28.4 {Tcl_Close} {testchannel} {
$consoleFileNames]
string compare $l $x
} 0
-test io-28.5 {Tcl_Close vs standard handles} {stdio unix testchannel openpipe} {
+test io-28.5 {Tcl_Close vs standard handles} {stdio unix testchannel} {
file delete $path(script)
set f [open $path(script) w]
puts $f {
@@ -2494,7 +2495,7 @@ test io-29.11 {Tcl_WriteChars, no newline, implicit flush} {
close $f2
file size $path(test1)
} 377
-test io-29.12 {Tcl_WriteChars on a pipe} {stdio openpipe} {
+test io-29.12 {Tcl_WriteChars on a pipe} stdio {
file delete $path(test1)
file delete $path(pipe)
set f1 [open $path(pipe) w]
@@ -2519,7 +2520,7 @@ test io-29.12 {Tcl_WriteChars on a pipe} {stdio openpipe} {
close $f2
set y
} ok
-test io-29.13 {Tcl_WriteChars to a pipe, line buffered} {stdio openpipe} {
+test io-29.13 {Tcl_WriteChars to a pipe, line buffered} stdio {
file delete $path(test1)
file delete $path(pipe)
set f1 [open $path(pipe) w]
@@ -2570,7 +2571,7 @@ test io-29.15 {Tcl_Flush, channel not open for writing} {
string compare $x \
[list 1 "channel \"$fd\" wasn't opened for writing"]
} 0
-test io-29.16 {Tcl_Flush on pipe opened only for reading} {stdio openpipe} {
+test io-29.16 {Tcl_Flush on pipe opened only for reading} stdio {
set fd [open "|[list [interpreter] cat longfile]" r]
set x [list [catch {flush $fd} msg] $msg]
catch {close $fd}
@@ -2644,7 +2645,7 @@ test io-29.20 {Implicit flush when buffer is full} {
lappend z [file size $path(test1)]
set z
} {4096 12288 12600}
-test io-29.21 {Tcl_Flush to pipe} {stdio openpipe} {
+test io-29.21 {Tcl_Flush to pipe} stdio {
file delete $path(pipe)
set f1 [open $path(pipe) w]
puts $f1 {set x [read stdin 6]}
@@ -2658,7 +2659,7 @@ test io-29.21 {Tcl_Flush to pipe} {stdio openpipe} {
catch {close $f1}
set x
} "read 6 characters"
-test io-29.22 {Tcl_Flush called at other end of pipe} {stdio openpipe} {
+test io-29.22 {Tcl_Flush called at other end of pipe} stdio {
file delete $path(pipe)
set f1 [open $path(pipe) w]
puts $f1 {
@@ -2681,7 +2682,7 @@ test io-29.22 {Tcl_Flush called at other end of pipe} {stdio openpipe} {
close $f1
set x
} {hello hello bye}
-test io-29.23 {Tcl_Flush and line buffering at end of pipe} {stdio openpipe} {
+test io-29.23 {Tcl_Flush and line buffering at end of pipe} stdio {
file delete $path(pipe)
set f1 [open $path(pipe) w]
puts $f1 {
@@ -2716,7 +2717,7 @@ test io-29.24 {Tcl_WriteChars and Tcl_Flush move end of file} {
close $f
set x
} "{} {Line 1\nLine 2}"
-test io-29.25 {Implicit flush with Tcl_Flush to command pipelines} {stdio openpipe fileevent} {
+test io-29.25 {Implicit flush with Tcl_Flush to command pipelines} {stdio fileevent} {
file delete $path(test3)
set f [open "|[list [interpreter] $path(cat) | [interpreter] $path(cat) > $path(test3)]" w]
puts $f "Line 1"
@@ -2728,7 +2729,7 @@ test io-29.25 {Implicit flush with Tcl_Flush to command pipelines} {stdio openpi
close $f
set x
} "Line 1\nLine 2\n"
-test io-29.26 {Tcl_Flush, Tcl_Write on bidirectional pipelines} {stdio unixExecs openpipe} {
+test io-29.26 {Tcl_Flush, Tcl_Write on bidirectional pipelines} {stdio unixExecs} {
set f [open "|[list cat -u]" r+]
puts $f "Line1"
flush $f
@@ -2736,7 +2737,7 @@ test io-29.26 {Tcl_Flush, Tcl_Write on bidirectional pipelines} {stdio unixExecs
close $f
set x
} {Line1}
-test io-29.27 {Tcl_Flush on closed pipeline} {stdio openpipe} {
+test io-29.27 {Tcl_Flush on closed pipeline} stdio {
file delete $path(pipe)
set f [open $path(pipe) w]
puts $f {exit}
@@ -2790,7 +2791,7 @@ test io-29.30 {Tcl_WriteChars, crlf mode} {
close $f
file size $path(test1)
} 25
-test io-29.31 {Tcl_WriteChars, background flush} {stdio openpipe} {
+test io-29.31 {Tcl_WriteChars, background flush} stdio {
# This test may fail on old Unix systems (seen on IRIX64 6.5) with
# obsolete gettimeofday() calls. See Tcl Bugs 3530533, 1942197.
file delete $path(pipe)
@@ -2827,13 +2828,13 @@ test io-29.31 {Tcl_WriteChars, background flush} {stdio openpipe} {
set result ok
}
# allow a little time for the background process to close.
- # otherwise, the following test fails on the [file delete $path(output)
+ # otherwise, the following test fails on the [file delete $path(output)]
# on Windows because a process still has the file open.
after 100 set v 1; vwait v
set result
} ok
test io-29.32 {Tcl_WriteChars, background flush to slow reader} \
- {stdio asyncPipeClose openpipe knownMsvcBug} {
+ {stdio asyncPipeClose knownMsvcBug} {
# This test may fail on old Unix systems (seen on IRIX64 6.5) with
# obsolete gettimeofday() calls. See Tcl Bugs 3530533, 1942197.
file delete $path(pipe)
@@ -4093,7 +4094,7 @@ test io-32.9 {Tcl_Read, read to end of file} {
}
set x
} ok
-test io-32.10 {Tcl_Read from a pipe} {stdio openpipe} {
+test io-32.10 {Tcl_Read from a pipe} stdio {
file delete $path(pipe)
set f1 [open $path(pipe) w]
puts $f1 {puts [gets stdin]}
@@ -4105,7 +4106,7 @@ test io-32.10 {Tcl_Read from a pipe} {stdio openpipe} {
close $f1
set x
} "hello\n"
-test io-32.11 {Tcl_Read from a pipe} {stdio openpipe} {
+test io-32.11 {Tcl_Read from a pipe} stdio {
file delete $path(pipe)
set f1 [open $path(pipe) w]
puts $f1 {puts [gets stdin]}
@@ -4124,7 +4125,7 @@ test io-32.11 {Tcl_Read from a pipe} {stdio openpipe} {
} {{hello
} {hello
}}
-test io-32.11.1 {Tcl_Read from a pipe} {stdio openpipe} {
+test io-32.11.1 {Tcl_Read from a pipe} stdio {
file delete $path(pipe)
set f1 [open $path(pipe) w]
puts $f1 {chan configure stdout -translation crlf}
@@ -4144,7 +4145,7 @@ test io-32.11.1 {Tcl_Read from a pipe} {stdio openpipe} {
} {{hello
} {hello
}}
-test io-32.11.2 {Tcl_Read from a pipe} {stdio openpipe} {
+test io-32.11.2 {Tcl_Read from a pipe} stdio {
file delete $path(pipe)
set f1 [open $path(pipe) w]
puts $f1 {chan configure stdout -translation crlf}
@@ -4255,7 +4256,7 @@ test io-33.2 {Tcl_Gets into variable} {
close $f1
set z
} ok
-test io-33.3 {Tcl_Gets from pipe} {stdio openpipe} {
+test io-33.3 {Tcl_Gets from pipe} stdio {
file delete $path(pipe)
set f1 [open $path(pipe) w]
puts $f1 {puts [gets stdin]}
@@ -4563,7 +4564,7 @@ test io-34.7 {Tcl_Seek to offset from end of file, then to current position} {
close $f1
list $c1 $r1 $c2
} {44 rstuv 49}
-test io-34.8 {Tcl_Seek on pipes: not supported} {stdio openpipe} {
+test io-34.8 {Tcl_Seek on pipes: not supported} stdio {
set f1 [open "|[list [interpreter]]" r+]
set x [list [catch {seek $f1 0 current} msg] $msg]
close $f1
@@ -4671,13 +4672,13 @@ test io-34.15 {Tcl_Tell combined with seeking} {
close $f1
list $c1 $c2
} {10 20}
-test io-34.16 {Tcl_Tell on pipe: always -1} {stdio openpipe} {
+test io-34.16 {Tcl_Tell on pipe: always -1} stdio {
set f1 [open "|[list [interpreter]]" r+]
set c [tell $f1]
close $f1
set c
} -1
-test io-34.17 {Tcl_Tell on pipe: always -1} {stdio openpipe} {
+test io-34.17 {Tcl_Tell on pipe: always -1} stdio {
set f1 [open "|[list [interpreter]]" r+]
puts $f1 {puts hello}
flush $f1
@@ -4776,7 +4777,7 @@ test io-35.1 {Tcl_Eof} {
close $f
set x
} {0 0 0 0 1 1}
-test io-35.2 {Tcl_Eof with pipe} {stdio openpipe} {
+test io-35.2 {Tcl_Eof with pipe} stdio {
file delete $path(pipe)
set f1 [open $path(pipe) w]
puts $f1 {gets stdin}
@@ -4794,7 +4795,7 @@ test io-35.2 {Tcl_Eof with pipe} {stdio openpipe} {
close $f1
set x
} {0 0 0 1}
-test io-35.3 {Tcl_Eof with pipe} {stdio openpipe} {
+test io-35.3 {Tcl_Eof with pipe} stdio {
file delete $path(pipe)
set f1 [open $path(pipe) w]
puts $f1 {gets stdin}
@@ -4828,7 +4829,7 @@ test io-35.4 {Tcl_Eof, eof detection on nonblocking file} {nonBlockFiles} {
close $f
set l
} {{} 1}
-test io-35.5 {Tcl_Eof, eof detection on nonblocking pipe} {stdio openpipe} {
+test io-35.5 {Tcl_Eof, eof detection on nonblocking pipe} stdio {
file delete $path(pipe)
set f [open $path(pipe) w]
puts $f {
@@ -5105,7 +5106,7 @@ test io-35.20 {Tcl_Eof, eof char in middle, cr write, crlf read} {
# Test Tcl_InputBlocked
-test io-36.1 {Tcl_InputBlocked on nonblocking pipe} {stdio openpipe} {
+test io-36.1 {Tcl_InputBlocked on nonblocking pipe} stdio {
set f1 [open "|[list [interpreter]]" r+]
puts $f1 {puts hello_from_pipe}
flush $f1
@@ -5124,7 +5125,7 @@ test io-36.1 {Tcl_InputBlocked on nonblocking pipe} {stdio openpipe} {
close $f1
set x
} {{} 1 hello 0 {} 1}
-test io-36.1.1 {Tcl_InputBlocked on nonblocking binary pipe} {stdio openpipe} {
+test io-36.1.1 {Tcl_InputBlocked on nonblocking binary pipe} stdio {
set f1 [open "|[list [interpreter]]" r+]
chan configure $f1 -encoding binary -translation lf -eofchar {}
puts $f1 {
@@ -5147,7 +5148,7 @@ test io-36.1.1 {Tcl_InputBlocked on nonblocking binary pipe} {stdio openpipe} {
close $f1
set x
} {{} 1 hello 0 {} 1}
-test io-36.2 {Tcl_InputBlocked on blocking pipe} {stdio openpipe} {
+test io-36.2 {Tcl_InputBlocked on blocking pipe} stdio {
set f1 [open "|[list [interpreter]]" r+]
fconfigure $f1 -buffering line
puts $f1 {puts hello_from_pipe}
@@ -5411,7 +5412,7 @@ test io-39.9 {Tcl_SetChannelOption, blocking mode} {nonBlockFiles} {
close $f1
set x
} {1 0 {} {} 0 1}
-test io-39.10 {Tcl_SetChannelOption, blocking mode} {stdio openpipe} {
+test io-39.10 {Tcl_SetChannelOption, blocking mode} stdio {
file delete $path(pipe)
set f1 [open $path(pipe) w]
puts $f1 {
@@ -5502,7 +5503,7 @@ test io-39.16 {Tcl_SetChannelOption: -encoding, errors} {
close $f
set result
} {1 {unknown encoding "foobar"}}
-test io-39.17 {Tcl_SetChannelOption: -encoding, clearing CHANNEL_NEED_MORE_DATA} {stdio openpipe fileevent} {
+test io-39.17 {Tcl_SetChannelOption: -encoding, clearing CHANNEL_NEED_MORE_DATA} {stdio fileevent} {
set f [open "|[list [interpreter] $path(cat)]" r+]
fconfigure $f -encoding binary
puts -nonewline $f "\xe7"
@@ -5851,7 +5852,7 @@ test io-43.1 {Tcl_FileeventCmd: creating, deleting, querying} {stdio unixExecs f
test io-43.2 {Tcl_FileeventCmd: deleting when many present} -setup {
set f2 [open "|[list cat -u]" r+]
set f3 [open "|[list cat -u]" r+]
-} -constraints {stdio unixExecs fileevent openpipe} -body {
+} -constraints {stdio unixExecs fileevent} -body {
set result {}
lappend result [fileevent $f r] [fileevent $f2 r] [fileevent $f3 r]
fileevent $f r "read f"
@@ -5872,7 +5873,7 @@ test io-43.2 {Tcl_FileeventCmd: deleting when many present} -setup {
test io-44.1 {FileEventProc procedure: normal read event} -setup {
set f2 [open "|[list cat -u]" r+]
set f3 [open "|[list cat -u]" r+]
-} -constraints {stdio unixExecs fileevent openpipe} -body {
+} -constraints {stdio unixExecs fileevent} -body {
fileevent $f2 readable [namespace code {
set x [gets $f2]; fileevent $f2 readable {}
}]
@@ -5885,7 +5886,7 @@ test io-44.1 {FileEventProc procedure: normal read event} -setup {
catch {close $f3}
} -result {text}
test io-44.2 {FileEventProc procedure: error in read event} -constraints {
- stdio unixExecs fileevent openpipe
+ stdio unixExecs fileevent
} -setup {
set f2 [open "|[list cat -u]" r+]
set f3 [open "|[list cat -u]" r+]
@@ -5908,7 +5909,7 @@ test io-44.2 {FileEventProc procedure: error in read event} -constraints {
test io-44.3 {FileEventProc procedure: normal write event} -setup {
set f2 [open "|[list cat -u]" r+]
set f3 [open "|[list cat -u]" r+]
-} -constraints {stdio unixExecs fileevent openpipe} -body {
+} -constraints {stdio unixExecs fileevent} -body {
fileevent $f2 writable [namespace code {
lappend x "triggered"
incr count -1
@@ -5927,7 +5928,7 @@ test io-44.3 {FileEventProc procedure: normal write event} -setup {
catch {close $f3}
} -result {initial triggered triggered triggered}
test io-44.4 {FileEventProc procedure: eror in write event} -constraints {
- stdio unixExecs fileevent openpipe
+ stdio unixExecs fileevent
} -setup {
set f2 [open "|[list cat -u]" r+]
set f3 [open "|[list cat -u]" r+]
@@ -5946,7 +5947,9 @@ test io-44.4 {FileEventProc procedure: eror in write event} -constraints {
catch {close $f2}
catch {close $f3}
} -result {bad-write {}}
-test io-44.5 {FileEventProc procedure: end of file} {stdio unixExecs openpipe fileevent} {
+test io-44.5 {FileEventProc procedure: end of file} -constraints {
+ stdio unixExecs fileevent
+} -body {
set f4 [open "|[list [interpreter] $path(cat) << foo]" r]
fileevent $f4 readable [namespace code {
if {[gets $f4 line] < 0} {
@@ -5959,9 +5962,10 @@ test io-44.5 {FileEventProc procedure: end of file} {stdio unixExecs openpipe fi
variable x initial
vwait [namespace which -variable x]
vwait [namespace which -variable x]
- close $f4
set x
-} {initial foo eof}
+} -cleanup {
+ close $f4
+} -result {initial foo eof}
close $f
@@ -6084,7 +6088,7 @@ test io-45.3 {DeleteFileEvent, cleanup on close} {fileevent} {
# Execute these tests only if the "testfevent" command is present.
-test io-46.1 {Tcl event loop vs multiple interpreters} {testfevent fileevent} {
+test io-46.1 {Tcl event loop vs multiple interpreters} {testfevent fileevent notOSX} {
testfevent create
set script "set f \[[list open $path(foo) r]]\n"
append script {
@@ -6094,9 +6098,10 @@ test io-46.1 {Tcl event loop vs multiple interpreters} {testfevent fileevent} {
fileevent $f readable {}
}]
}
+ set timer [after 10 lappend x timeout]
testfevent cmd $script
- after 1 ;# We must delay because Windows takes a little time to notice
- update
+ vwait x
+ after cancel $timer
testfevent cmd {close $f}
list [testfevent cmd {set x}] [testfevent cmd {info commands after}]
} {{f triggered: foo bar} after}
@@ -6285,7 +6290,7 @@ test io-48.2 {testing readability conditions} {nonBlockFiles fileevent} {
list $x $l
} {done {called called called called called called called}}
set path(my_script) [makeFile {} my_script]
-test io-48.3 {testing readability conditions} {stdio unix nonBlockFiles openpipe fileevent} {
+test io-48.3 {testing readability conditions} {stdio unix nonBlockFiles fileevent} {
set f [open $path(bar) w]
puts $f abcdefg
puts $f abcdefg
@@ -6783,47 +6788,57 @@ 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 testservicemode} -setup {
file delete $path(test1)
+} -body {
set f [open $path(test1) w]
close $f
- set f [open $path(test1) r]
- testchannelevent $f add readable [namespace code [list delhandler $f]]
+ update
proc delhandler {f} {
variable z
set z called
testchannelevent $f delete 0
}
set z not_called
- update
- close $f
+ set timer [after 50 lappend z timeout]
+ testservicemode 0
+ set f [open $path(test1) r]
+ testchannelevent $f add readable [namespace code [list delhandler $f]]
+ testservicemode 1
+ vwait z
+ after cancel $timer
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 testservicemode} -setup {
file delete $path(test1)
+} -body {
set f [open $path(test1) w]
close $f
- set f [open $path(test1) r]
- testchannelevent $f add readable [namespace code [list delhandler $f 1]]
- testchannelevent $f add readable [namespace code [list delhandler $f 0]]
proc delhandler {f i} {
variable z
- lappend z "called delhandler $f $i"
+ lappend z "called delhandler $i"
testchannelevent $f delete 0
}
set z ""
- update
+ testservicemode 0
+ set f [open $path(test1) r]
+ testchannelevent $f add readable [namespace code [list delhandler $f 1]]
+ testchannelevent $f add readable [namespace code [list delhandler $f 0]]
+ testservicemode 1
+ set timer [after 50 lappend z timeout]
+ vwait z
+ after cancel $timer
+ set z
+} -cleanup {
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} {
+} -result {{called delhandler 0} {called delhandler 1}}
+test io-50.3 {testing handler deletion with multiple handlers} -constraints {testchannelevent testservicemode} -setup {
file delete $path(test1)
+} -body {
set f [open $path(test1) w]
close $f
- set f [open $path(test1) r]
- testchannelevent $f add readable [namespace code [list notcalled $f 1]]
- testchannelevent $f add readable [namespace code [list delhandler $f 0]]
set z ""
proc notcalled {f i} {
variable z
@@ -6832,23 +6847,30 @@ test io-50.3 {testing handler deletion with multiple handlers} {testchannelevent
proc delhandler {f i} {
variable z
testchannelevent $f delete 1
- lappend z "delhandler $f $i called"
+ lappend z "delhandler $i called"
testchannelevent $f delete 0
- lappend z "delhandler $f $i deleted myself"
+ lappend z "delhandler $i deleted myself"
}
set z ""
- update
+ testservicemode 0
+ set f [open $path(test1) r]
+ testchannelevent $f add readable [namespace code [list notcalled $f 1]]
+ testchannelevent $f add readable [namespace code [list delhandler $f 0]]
+ testservicemode 1
+ set timer [after 50 lappend z timeout]
+ vwait z
+ after cancel $timer
+ set z
+} -cleanup {
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} {
+} -result {{delhandler 0 called} {delhandler 0 deleted myself}}
+test io-50.4 {testing handler deletion vs reentrant calls} -constraints {testchannelevent testservicemode} -setup {
file delete $path(test1)
+ update
+} -body {
set f [open $path(test1) w]
close $f
- set f [open $path(test1) r]
- testchannelevent $f add readable [namespace code [list delrecursive $f]]
+ update
proc delrecursive {f} {
variable z
variable u
@@ -6863,18 +6885,22 @@ test io-50.4 {testing handler deletion vs reentrant calls} {testchannelevent} {
}
variable u toplevel
variable z ""
- update
+ testservicemode 0
+ set f [open $path(test1) r]
+ testchannelevent $f add readable [namespace code [list delrecursive $f]]
+ testservicemode 1
+ set timer [after 50 lappend z timeout]
+ vwait z
+ after cancel $timer
+ set z
+} -cleanup {
close $f
- string compare [string tolower $z] \
- {{delrecursive calling recursive} {delrecursive deleting recursive}}
-} 0
-test io-50.5 {testing handler deletion vs reentrant calls} {testchannelevent} {
+} -result {{delrecursive calling recursive} {delrecursive deleting recursive}}
+test io-50.5 {testing handler deletion vs reentrant calls} -constraints {testchannelevent testservicemode notOSX} -setup {
file delete $path(test1)
+} -body {
set f [open $path(test1) w]
close $f
- set f [open $path(test1) r]
- testchannelevent $f add readable [namespace code [list notcalled $f]]
- testchannelevent $f add readable [namespace code [list del $f]]
proc notcalled {f} {
variable z
lappend z "notcalled was called!! $f"
@@ -6884,39 +6910,50 @@ test io-50.5 {testing handler deletion vs reentrant calls} {testchannelevent} {
variable z
if {"$u" == "recursive"} {
testchannelevent $f delete 1
- testchannelevent $f delete 0
lappend z "del deleted notcalled"
+ testchannelevent $f delete 0
lappend z "del deleted myself"
} else {
set u recursive
lappend z "del calling recursive"
- update
- lappend z "del after update"
+ set timer [after 50 lappend z timeout]
+ vwait z
+ after cancel $timer
+ lappend z "del after recursive"
}
}
set z ""
set u toplevel
- update
+ testservicemode 0
+ set f [open $path(test1) r]
+ testchannelevent $f add readable [namespace code [list notcalled $f]]
+ testchannelevent $f add readable [namespace code [list del $f]]
+ testservicemode 1
+ set timer [after 50 set z timeout]
+ vwait z
+ after cancel $timer
+ set z
+} -cleanup {
close $f
- string compare [string tolower $z] \
- [list {del calling recursive} {del deleted notcalled} \
- {del deleted myself} {del after update}]
-} 0
-test io-50.6 {testing handler deletion vs reentrant calls} {testchannelevent} {
+} -result [list {del calling recursive} {del deleted notcalled} \
+ {del deleted myself} {del after recursive}]
+test io-50.6 {testing handler deletion vs reentrant calls} -constraints {testchannelevent testservicemode} -setup {
file delete $path(test1)
+} -body {
set f [open $path(test1) w]
close $f
- set f [open $path(test1) r]
- testchannelevent $f add readable [namespace code [list second $f]]
- testchannelevent $f add readable [namespace code [list first $f]]
proc first {f} {
variable u
variable z
+ variable done
if {"$u" == "toplevel"} {
lappend z "first called"
set u first
- update
- lappend z "first after update"
+ set timer [after 50 lappend z timeout]
+ vwait z
+ after cancel $timer
+ lappend z "first after toplevel"
+ set done 1
} else {
lappend z "first called not toplevel"
}
@@ -6938,14 +6975,24 @@ test io-50.6 {testing handler deletion vs reentrant calls} {testchannelevent} {
}
set z ""
set u toplevel
+ set done 0
+ testservicemode 0
+ set f [open $path(test1) r]
+ testchannelevent $f add readable [namespace code [list second $f]]
+ testchannelevent $f add readable [namespace code [list first $f]]
+ testservicemode 1
update
+ if {!$done} {
+ set timer2 [after 200 set done 1]
+ vwait done
+ after cancel $timer2
+ }
+ set z
+} -cleanup {
close $f
- string compare [string tolower $z] \
- [list {first called} {first called not toplevel} \
- {second called, first time} {second called, second time} \
- {first after update}]
-} 0
-
+} -result [list {first called} {first called not toplevel} \
+ {second called, first time} {second called, second time} \
+ {first after toplevel}]
test io-51.1 {Test old socket deletion on Macintosh} {socket} {
set x 0
set result ""
@@ -7135,7 +7182,7 @@ test io-52.7 {TclCopyChannel} {fcopy} {
}
set result
} {0 0 ok}
-test io-52.8 {TclCopyChannel} {stdio openpipe fcopy} {
+test io-52.8 {TclCopyChannel} {stdio fcopy} {
file delete $path(test1)
file delete $path(pipe)
set f1 [open $path(pipe) w]
@@ -7415,7 +7462,7 @@ test io-53.2 {CopyData} {fcopy} {
}
set result
} {0 0 ok}
-test io-53.3 {CopyData: background read underflow} {stdio unix openpipe fcopy} {
+test io-53.3 {CopyData: background read underflow} {stdio unix fcopy} {
file delete $path(test1)
file delete $path(pipe)
set f1 [open $path(pipe) w]
@@ -7447,7 +7494,7 @@ test io-53.3 {CopyData: background read underflow} {stdio unix openpipe fcopy} {
close $f
set result
} "ready line1 line2 {done\n}"
-test io-53.4 {CopyData: background write overflow} {stdio openpipe fileevent fcopy} {
+test io-53.4 {CopyData: background write overflow} {stdio fileevent fcopy} {
set big bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb\n
variable x
for {set x 0} {$x < 12} {incr x} {
@@ -7538,7 +7585,7 @@ test io-53.5 {CopyData: error during fcopy} {socket fcopy} {
close $out
set fcopyTestDone ;# 1 for error condition
} 1
-test io-53.6 {CopyData: error during fcopy} {stdio openpipe fcopy} {
+test io-53.6 {CopyData: error during fcopy} {stdio fcopy} {
variable fcopyTestDone
file delete $path(pipe)
file delete $path(test1)
@@ -7571,7 +7618,7 @@ proc doFcopy {in out {bytes 0} {error {}}} {
-command [namespace code [list doFcopy $in $out]]]
}
}
-test io-53.7 {CopyData: Flooding fcopy from pipe} {stdio openpipe fcopy} {
+test io-53.7 {CopyData: Flooding fcopy from pipe} {stdio fcopy} {
variable fcopyTestDone
file delete $path(pipe)
catch {unset fcopyTestDone}
@@ -7623,7 +7670,7 @@ test io-53.8 {CopyData: async callback and error handling, Bug 1932639} -setup {
# Channels to copy between
set f [open $foo r] ; fconfigure $f -translation binary
set g [open $bar w] ; fconfigure $g -translation binary -buffering none
-} -constraints {stdio openpipe fcopy} -body {
+} -constraints {stdio fcopy} -body {
# Record input size, so that result is always defined
lappend ::RES [file size $bar]
# Run the copy. Should not invoke -command now.
@@ -7664,7 +7711,7 @@ test io-53.8a {CopyData: async callback and error handling, Bug 1932639, at eof}
# Channels to copy between
set f [open $foo r] ; fconfigure $f -translation binary
set g [open $bar w] ; fconfigure $g -translation binary -buffering none
-} -constraints {stdio openpipe fcopy} -body {
+} -constraints {stdio fcopy} -body {
# Initialize and force eof on the input.
seek $f 0 end ; read $f 1
set ::RES [eof $f]
@@ -7704,7 +7751,7 @@ test io-53.8b {CopyData: async callback and -size 0} -setup {
# Channels to copy between
set f [open $foo r] ; fconfigure $f -translation binary
set g [open $bar w] ; fconfigure $g -translation binary -buffering none
-} -constraints {stdio openpipe fcopy} -body {
+} -constraints {stdio fcopy} -body {
set ::RES {}
# Run the copy. Should not invoke -command now.
fcopy $f $g -size 0 -command ::cmd
@@ -7761,7 +7808,7 @@ test io-53.9 {CopyData: -size and event interaction, Bug 780533} -setup {
}
set ::forever {}
set out [open $out w]
-} -constraints {stdio openpipe fcopy} -body {
+} -constraints {stdio fcopy} -body {
fcopy $pipe $out -size 6 -command ::done
set token [after 5000 {
set ::forever {fcopy hangs}
@@ -7831,7 +7878,7 @@ test io-53.10 {Bug 1350564, multi-directional fcopy} -setup {
fconfigure $b -translation binary -buffering none
fileevent $a readable [list ::done $a]
fileevent $b readable [list ::done $b]
-} -constraints {stdio openpipe fcopy} -body {
+} -constraints {stdio fcopy} -body {
# Now pass data through the server in both directions.
set ::forever {}
puts $a AB
@@ -7879,7 +7926,7 @@ test io-53.11 {Bug 2895565} -setup {
removeFile out
removeFile in
} -result {40 bytes copied}
-test io-53.12 {CopyData: foreground short reads, aka bug 3096275} {stdio unix openpipe fcopy} {
+test io-53.12 {CopyData: foreground short reads, aka bug 3096275} {stdio unix fcopy} {
file delete $path(pipe)
set f1 [open $path(pipe) w]
puts -nonewline $f1 {
@@ -8294,7 +8341,7 @@ test io-57.2 {buffered data and file events, read} {fileevent} {
set result
} {1 readable 234567890 timer}
-test io-58.1 {Tcl_NotifyChannel and error when closing} {stdio unixOrWin openpipe fileevent} {
+test io-58.1 {Tcl_NotifyChannel and error when closing} {stdio unixOrWin fileevent} {
set out [open $path(script) w]
puts $out {
puts "normal message from pipe"
@@ -8334,7 +8381,7 @@ test io-59.1 {Thread reference of channels} {testmainthread testchannel} {
string equal $result [testmainthread]
} {1}
-test io-60.1 {writing illegal utf sequences} {openpipe fileevent testbytestring} {
+test io-60.1 {writing illegal utf sequences} {fileevent testbytestring} {
# This test will hang in older revisions of the core.
set out [open $path(script) w]
@@ -8712,16 +8759,16 @@ test io-74.1 {[104f2885bb] improper cache validity check} -setup {
set fn [makeFile {} io-74.1]
set rfd [open $fn r]
testobj freeallvars
- interp create slave
+ interp create child
} -constraints testobj -body {
teststringobj set 1 [string range $rfd 0 end]
read [teststringobj get 1]
testobj duplicate 1 2
- interp transfer {} $rfd slave
+ interp transfer {} $rfd child
catch {read [teststringobj get 1]}
read [teststringobj get 2]
} -cleanup {
- interp delete slave
+ interp delete child
testobj freeallvars
removeFile io-74.1
} -returnCodes error -match glob -result {can not find channel named "*"}
diff --git a/tests/ioCmd.test b/tests/ioCmd.test
index 0e47d2f..749d225 100644
--- a/tests/ioCmd.test
+++ b/tests/ioCmd.test
@@ -13,7 +13,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
+if {"::tcltest" ni [namespace children]} {
package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -2084,7 +2084,7 @@ test iocmd-32.0 {origin interpreter of moved channel gone} -match glob -body {
set ida [interp create];#puts <<$ida>>
set idb [interp create];#puts <<$idb>>
- # Magic to get the test* commands in the slaves
+ # Magic to get the test* commands in the children
load {} Tcltest $ida
load {} Tcltest $idb
@@ -2122,7 +2122,7 @@ test iocmd-32.1 {origin interpreter of moved channel destroyed during access} -m
set ida [interp create];#puts <<$ida>>
set idb [interp create];#puts <<$idb>>
- # Magic to get the test* commands in the slaves
+ # Magic to get the test* commands in the children
load {} Tcltest $ida
load {} Tcltest $idb
@@ -2164,13 +2164,13 @@ test iocmd-32.2 {delete interp of reflected chan} {
# Bug 3034840
# Run this test in an interp with memory debugging to panic
# on the double free
- interp create slave
- slave eval {
+ interp create child
+ child eval {
proc no-op args {}
proc driver {sub args} {return {initialize finalize watch read}}
chan event [chan create read driver] readable no-op
}
- interp delete slave
+ interp delete child
} {}
# ### ### ### ######### ######### #########
diff --git a/tests/ioTrans.test b/tests/ioTrans.test
index 0a335ff..f185117 100644
--- a/tests/ioTrans.test
+++ b/tests/ioTrans.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -36,8 +36,8 @@ testConstraint thread [expr {0 == [catch {package require Thread 2.7-}]}]
# can access this variable.
set helperscript {
- if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+ if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -1162,7 +1162,7 @@ test iortrans-8.3 {chan flush, bug 2921116} -match glob -setup {
test iortrans-11.0 {origin interpreter of moved transform gone} -setup {
set ida [interp create]; #puts <<$ida>>
set idb [interp create]; #puts <<$idb>>
- # Magic to get the test* commands in the slaves
+ # Magic to get the test* commands in the children
load {} Tcltest $ida
load {} Tcltest $idb
} -constraints {testchannel} -match glob -body {
@@ -1205,7 +1205,7 @@ test iortrans-11.0 {origin interpreter of moved transform gone} -setup {
test iortrans-11.1 {origin interpreter of moved transform destroyed during access} -setup {
set ida [interp create]; #puts <<$ida>>
set idb [interp create]; #puts <<$idb>>
- # Magic to get the test* commands in the slaves
+ # Magic to get the test* commands in the children
load {} Tcltest $ida
load {} Tcltest $idb
} -constraints {testchannel} -match glob -body {
@@ -1244,16 +1244,16 @@ test iortrans-11.1 {origin interpreter of moved transform destroyed during acces
tempdone
} -result {Owner lost}
test iortrans-11.2 {delete interp of reflected transform} -setup {
- interp create slave
- # Magic to get the test* commands into the slave
- load {} Tcltest slave
+ interp create child
+ # Magic to get the test* commands into the child
+ load {} Tcltest child
} -constraints {testchannel} -body {
- # Get base channel into the slave
+ # Get base channel into the child
set c [tempchan]
testchannel cut $c
- interp eval slave [list testchannel splice $c]
- interp eval slave [list set c $c]
- slave eval {
+ interp eval child [list testchannel splice $c]
+ interp eval child [list set c $c]
+ child eval {
proc no-op args {}
proc driver {c sub args} {
return {initialize finalize read write}
@@ -1261,7 +1261,7 @@ test iortrans-11.2 {delete interp of reflected transform} -setup {
set t [chan push $c [list driver $c]]
chan event $c readable no-op
}
- interp delete slave
+ interp delete child
} -cleanup {
tempdone
} -result {}
diff --git a/tests/iogt.test b/tests/iogt.test
index 3cac2cf..fb04b5b 100644
--- a/tests/iogt.test
+++ b/tests/iogt.test
@@ -10,9 +10,9 @@
# Copyright (c) 2000 Andreas Kupries.
# All rights reserved.
-if {[catch {package require tcltest 2.1}]} {
- puts stderr "Skipping tests in [info script]. tcltest 2.1 required."
- return
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
}
::tcltest::loadTestedCommands
diff --git a/tests/join.test b/tests/join.test
index 4aeb093..9ea554d 100644
--- a/tests/join.test
+++ b/tests/join.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/lindex.test b/tests/lindex.test
index 2b1742e..f9397d2 100644
--- a/tests/lindex.test
+++ b/tests/lindex.test
@@ -12,8 +12,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2.2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -449,6 +449,14 @@ test lindex-17.1 {Bug 1718580} -body {
lindex a end foo
} -match glob -result {bad index "foo"*} -returnCodes 1
+test lindex-18.0 {nested bytecode execution} -setup {
+ proc demo {i} {lindex {a b c} $i}
+} -body {
+ demo 0+0x10000000000000000
+} -cleanup {
+ rename demo {}
+}
+
catch { unset minus }
# cleanup
diff --git a/tests/link.test b/tests/link.test
index 336634b..89e5aa2 100644
--- a/tests/link.test
+++ b/tests/link.test
@@ -12,7 +12,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/linsert.test b/tests/linsert.test
index 4939e5c..ddc56a9 100644
--- a/tests/linsert.test
+++ b/tests/linsert.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/list.test b/tests/list.test
index 2686bd7..edb572c 100644
--- a/tests/list.test
+++ b/tests/list.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/listObj.test b/tests/listObj.test
index d7fb46c..ce6c978 100644
--- a/tests/listObj.test
+++ b/tests/listObj.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/llength.test b/tests/llength.test
index 169c7ca..a2770c0 100644
--- a/tests/llength.test
+++ b/tests/llength.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/lmap.test b/tests/lmap.test
index 641eac2..3b52c64 100644
--- a/tests/lmap.test
+++ b/tests/lmap.test
@@ -14,7 +14,7 @@
# RCS: @(#) $Id: $
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/load.test b/tests/load.test
index 4cd1fcd..9fdf1cf 100644
--- a/tests/load.test
+++ b/tests/load.test
@@ -10,8 +10,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -103,7 +103,7 @@ test load-3.1 {error in _Init procedure, same interpreter} \
"if 44 {open non_existent}"
invoked from within
"load [file join $testDir pkge$ext] pkge"} {POSIX ENOENT {no such file or directory}}}
-test load-3.2 {error in _Init procedure, slave interpreter} \
+test load-3.2 {error in _Init procedure, child interpreter} \
[list $dll $loaded] {
catch {interp delete x}
interp create x
diff --git a/tests/lpop.test b/tests/lpop.test
index 3e28978..35f0103 100644
--- a/tests/lpop.test
+++ b/tests/lpop.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/lrange.test b/tests/lrange.test
index 5798707..a20422f 100644
--- a/tests/lrange.test
+++ b/tests/lrange.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/lrepeat.test b/tests/lrepeat.test
index e89f1b7..f62f35f 100644
--- a/tests/lrepeat.test
+++ b/tests/lrepeat.test
@@ -9,8 +9,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/lreplace.test b/tests/lreplace.test
index 4ce3ef4..0b3f7f1 100644
--- a/tests/lreplace.test
+++ b/tests/lreplace.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/lsearch.test b/tests/lsearch.test
index 2086615..6d183ad 100644
--- a/tests/lsearch.test
+++ b/tests/lsearch.test
@@ -12,7 +12,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/lset.test b/tests/lset.test
index b1ed110..d98a38e 100644
--- a/tests/lset.test
+++ b/tests/lset.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/lsetComp.test b/tests/lsetComp.test
index 32bfd5f..d313bbc 100644
--- a/tests/lsetComp.test
+++ b/tests/lsetComp.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/macOSXFCmd.test b/tests/macOSXFCmd.test
index f1758f5..0a147f0 100644
--- a/tests/macOSXFCmd.test
+++ b/tests/macOSXFCmd.test
@@ -9,8 +9,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/macOSXLoad.test b/tests/macOSXLoad.test
index 12c77e0..ea4a910 100644
--- a/tests/macOSXLoad.test
+++ b/tests/macOSXLoad.test
@@ -10,8 +10,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
set oldTSF $::tcltest::testSingleFile
diff --git a/tests/main.test b/tests/main.test
index 0398d36..c7347b9 100644
--- a/tests/main.test
+++ b/tests/main.test
@@ -1,8 +1,8 @@
# This file contains a collection of tests for generic/tclMain.c.
-if {[catch {package require tcltest 2.0.2}]} {
- puts stderr "Skipping tests in [info script]. tcltest 2.0.2 required."
- return
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
}
namespace eval ::tcl::test::main {
diff --git a/tests/mathop.test b/tests/mathop.test
index 958a56f..f4a810f 100644
--- a/tests/mathop.test
+++ b/tests/mathop.test
@@ -10,8 +10,8 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2.1
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/misc.test b/tests/misc.test
index db8b14a..8f8516e 100644
--- a/tests/misc.test
+++ b/tests/misc.test
@@ -12,8 +12,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/msgcat.test b/tests/msgcat.test
index 4ab3622..6e95c03 100644
--- a/tests/msgcat.test
+++ b/tests/msgcat.test
@@ -12,10 +12,9 @@
# Note that after running these tests, entries will be left behind in the
# message catalogs for locales foo, foo_BAR, and foo_BAR_baz.
-package require Tcl 8.5-
-if {[catch {package require tcltest 2}]} {
- puts stderr "Skipping tests in [info script]. tcltest 2 required."
- return
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
}
if {[catch {package require msgcat 1.6}]} {
puts stderr "Skipping tests in [info script]. No msgcat 1.6 found to test."
diff --git a/tests/namespace-old.test b/tests/namespace-old.test
index 1d6a805..f503a4d 100644
--- a/tests/namespace-old.test
+++ b/tests/namespace-old.test
@@ -15,7 +15,7 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2.2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/namespace.test b/tests/namespace.test
index 0d93092..8209cf3 100644
--- a/tests/namespace.test
+++ b/tests/namespace.test
@@ -12,8 +12,10 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
-namespace import -force ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
testConstraint memory [llength [info commands memory]]
::tcltest::loadTestedCommands
@@ -179,21 +181,21 @@ test namespace-7.6 {recursive Tcl_DeleteNamespace, no active call frames in ns}
namespace delete test_ns_2
} {}
test namespace-7.7 {Bug 1655305} -setup {
- interp create slave
+ interp create child
# Can't invoke through the ensemble, since deleting the global namespace
# (indirectly, via deleting ::tcl) deletes the ensemble.
- slave eval {rename ::tcl::info::commands ::infocommands}
- slave hide infocommands
- slave eval {
+ child eval {rename ::tcl::info::commands ::infocommands}
+ child hide infocommands
+ child eval {
proc foo {} {
namespace delete ::
}
}
} -body {
- slave eval foo
- slave invokehidden infocommands
+ child eval foo
+ child invokehidden infocommands
} -cleanup {
- interp delete slave
+ interp delete child
} -result {}
test namespace-7.8 {Bug ba1419303b4c} -setup {
@@ -269,28 +271,28 @@ test namespace-8.4 {TclTeardownNamespace, cmds imported from deleted ns go away}
[info commands test_ns_import::*]
} [list [lsort {::test_ns_import::p ::test_ns_import::cmd1 ::test_ns_import::cmd2}] {} ::test_ns_import::p]
test namespace-8.5 {TclTeardownNamespace: preserve errorInfo; errorCode values} {
- interp create slave
- slave eval {trace add execution error leave {namespace delete :: ;#}}
- catch {slave eval error foo bar baz}
- interp delete slave
+ interp create child
+ child eval {trace add execution error leave {namespace delete :: ;#}}
+ catch {child eval error foo bar baz}
+ interp delete child
set ::errorInfo
} {bar
invoked from within
-"slave eval error foo bar baz"}
+"child eval error foo bar baz"}
test namespace-8.6 {TclTeardownNamespace: preserve errorInfo; errorCode values} {
- interp create slave
- slave eval {trace add variable errorCode write {namespace delete :: ;#}}
- catch {slave eval error foo bar baz}
- interp delete slave
+ interp create child
+ child eval {trace add variable errorCode write {namespace delete :: ;#}}
+ catch {child eval error foo bar baz}
+ interp delete child
set ::errorInfo
} {bar
invoked from within
-"slave eval error foo bar baz"}
+"child eval error foo bar baz"}
test namespace-8.7 {TclTeardownNamespace: preserve errorInfo; errorCode values} {
- interp create slave
- slave eval {trace add execution error leave {namespace delete :: ;#}}
- catch {slave eval error foo bar baz}
- interp delete slave
+ interp create child
+ child eval {trace add execution error leave {namespace delete :: ;#}}
+ catch {child eval error foo bar baz}
+ interp delete child
set ::errorCode
} baz
@@ -2797,9 +2799,9 @@ test namespace-51.15 {namespace resolution path control} -body {
namespace delete ::test_ns_2
}
test namespace-51.16 {Bug 1566526} {
- interp create slave
- slave eval namespace eval demo namespace path ::
- interp delete slave
+ interp create child
+ child eval namespace eval demo namespace path ::
+ interp delete child
} {}
test namespace-51.17 {resolution epoch handling: Bug 2898722} -setup {
set result {}
@@ -3000,19 +3002,19 @@ test namespace-52.11 {unknown: with TCL_EVAL_INVOKE} -setup {
}
}
catch {rename ::noSuchCommand {}}
- set ::slave [interp create]
+ set ::child [interp create]
} -body {
- $::slave alias bar noSuchCommand
+ $::child alias bar noSuchCommand
namespace eval test_ns_1 {
namespace unknown unknown
proc unknown args {
return FAIL
}
- $::slave eval bar
+ $::child eval bar
}
} -cleanup {
- interp delete $::slave
- unset ::slave
+ interp delete $::child
+ unset ::child
namespace delete test_ns_1
rename ::unknown {}
rename unknown.save ::unknown
@@ -3337,6 +3339,49 @@ test namespace-56.5 {Bug 8b9854c3d8} -setup {
namespace delete namespace-56.5
} -result 1
+
+
+test namespace-57.0 {
+ an imported alias should be usable in the deletion trace for the alias
+
+ see 29e8848eb976
+} -body {
+ variable res {}
+ namespace eval ns2 {
+ namespace export *
+ proc p1 {oldname newname op} {
+ return success
+ }
+
+ interp alias {} [namespace current]::p2 {} [namespace which p1]
+ }
+
+
+ namespace eval ns3 {
+ namespace import ::ns2::p2
+ }
+
+
+ set ondelete [list apply [list {oldname newname op} {
+ variable res
+ catch {
+ ns3::p2 $oldname $newname $op
+ } cres
+ lappend res $cres
+ } [namespace current]]]
+
+
+ trace add command ::ns2::p2 delete $ondelete
+ rename ns2::p2 {}
+ return $res
+} -cleanup {
+ unset res
+ namespace delete ns2
+ namespace delete ns3
+} -result success
+
+
+
# cleanup
catch {rename cmd1 {}}
diff --git a/tests/notify.test b/tests/notify.test
index d2b9123..7375f83 100644
--- a/tests/notify.test
+++ b/tests/notify.test
@@ -13,8 +13,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/nre.test b/tests/nre.test
index 58f5511..7cf06d1 100644
--- a/tests/nre.test
+++ b/tests/nre.test
@@ -9,8 +9,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/obj.test b/tests/obj.test
index 5bcffa3..e10cebf 100644
--- a/tests/obj.test
+++ b/tests/obj.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -34,7 +34,7 @@ test obj-1.1 {Tcl_AppendAllObjTypes, and InitTypeTable, Tcl_RegisterObjType} tes
string
} {
set first [string first $t [testobj types]]
- set r [expr {$r && ($first != -1)}]
+ set r [expr {$r && ($first >= 0)}]
}
set result $r
} {1}
diff --git a/tests/oo.test b/tests/oo.test
index c73c36c..0dc26f2 100644
--- a/tests/oo.test
+++ b/tests/oo.test
@@ -8,8 +8,8 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
package require TclOO 1.0.3
-package require tcltest 2
-if {"::tcltest" in [namespace children]} {
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -304,19 +304,19 @@ test oo-1.18.2 {Bug 75b8433707: memory leak in oo-1.18} -setup {
rename test-oo-1.18 {}
} -result 0
test oo-1.18.3 {Bug 21c144f0f5} -setup {
- interp create slave
+ interp create child
} -body {
- slave eval {
+ child eval {
oo::define [oo::class create foo] superclass oo::class
oo::class destroy
}
} -cleanup {
- interp delete slave
+ interp delete child
}
test oo-1.18.4 {correct handling of cleanup in superclass set error} -setup {
- interp create slave
+ interp create child
} -body {
- slave eval {
+ child eval {
oo::class create A
oo::class create B {
superclass oo::class
@@ -328,12 +328,12 @@ test oo-1.18.4 {correct handling of cleanup in superclass set error} -setup {
[B create C] create d
}
} -returnCodes error -cleanup {
- interp delete slave
+ interp delete child
} -result {class should only be a direct superclass once}
test oo-1.18.5 {correct handling of cleanup in superclass set error} -setup {
- interp create slave
+ interp create child
} -body {
- slave eval {
+ child eval {
oo::class create A
oo::class create B {
superclass oo::class
@@ -345,7 +345,7 @@ test oo-1.18.5 {correct handling of cleanup in superclass set error} -setup {
[B create C {B C}] create d
}
} -returnCodes error -cleanup {
- interp delete slave
+ interp delete child
} -result {attempt to form circular dependency graph}
test oo-1.19 {basic test of OO functionality: teardown order} -body {
oo::object create o
@@ -1439,16 +1439,16 @@ test oo-7.8 {OO: next at the end of the method chain} -setup {
} -result {foo2 foo 1 {no next method implementation}}
test oo-7.9 {OO: defining inheritance in namespaces} -setup {
set ::result {}
- oo::class create ::master
+ oo::class create ::parent
namespace eval ::foo {
- oo::class create mixin {superclass ::master}
+ oo::class create mixin {superclass ::parent}
}
} -cleanup {
- ::master destroy
+ ::parent destroy
namespace delete ::foo
} -body {
namespace eval ::foo {
- oo::class create bar {superclass master}
+ oo::class create bar {superclass parent}
oo::class create boo
oo::define boo {superclass bar}
oo::define boo {mixin mixin}
@@ -2135,18 +2135,18 @@ test oo-14.5 {OO and mixins and filters - advanced case} -setup {
mix destroy
} -result >>foobar<<
test oo-14.6 {OO and mixins of mixins - Bug 1960703} -setup {
- oo::class create master
+ oo::class create parent
} -cleanup {
- master destroy
+ parent destroy
} -body {
oo::class create A {
- superclass master
+ superclass parent
method egg {} {
return chicken
}
}
oo::class create B {
- superclass master
+ superclass parent
mixin A
method bar {} {
# mixin from A
@@ -2154,7 +2154,7 @@ test oo-14.6 {OO and mixins of mixins - Bug 1960703} -setup {
}
}
oo::class create C {
- superclass master
+ superclass parent
mixin B
method foo {} {
# mixin from B
@@ -2164,12 +2164,12 @@ test oo-14.6 {OO and mixins of mixins - Bug 1960703} -setup {
[C new] foo
} -result chicken
test oo-14.7 {OO and filters from mixins of mixins} -setup {
- oo::class create master
+ oo::class create parent
} -cleanup {
- master destroy
+ parent destroy
} -body {
oo::class create A {
- superclass master
+ superclass parent
method egg {} {
return chicken
}
@@ -2180,7 +2180,7 @@ test oo-14.7 {OO and filters from mixins of mixins} -setup {
}
}
oo::class create B {
- superclass master
+ superclass parent
mixin A
filter f
method bar {} {
@@ -2189,7 +2189,7 @@ test oo-14.7 {OO and filters from mixins of mixins} -setup {
}
}
oo::class create C {
- superclass master
+ superclass parent
mixin B
filter f
method foo {} {
@@ -2201,18 +2201,18 @@ test oo-14.7 {OO and filters from mixins of mixins} -setup {
} -result {(foo) (bar) (egg) chicken (egg) (bar) (foo)}
test oo-14.8 {OO: class mixin order - Bug 1998221} -setup {
set ::result {}
- oo::class create master {
+ oo::class create parent {
method test {} {}
}
} -cleanup {
- master destroy
+ parent destroy
} -body {
oo::class create mix {
- superclass master
+ superclass parent
method test {} {lappend ::result mix; next; return $::result}
}
oo::class create cls {
- superclass master
+ superclass parent
mixin mix
method test {} {lappend ::result cls; next; return $::result}
}
@@ -2915,13 +2915,13 @@ test oo-18.7 {OO: objdefine command support} -setup {
invoked from within
"oo::objdefine inst {rename ::inst ::INST;error foo}"}}
test oo-18.8 {OO: define/self command support} -setup {
- oo::class create master
- oo::class create ::foo {superclass master}
+ oo::class create parent
+ oo::class create ::foo {superclass parent}
} -body {
catch {oo::define foo {rename ::foo ::bar; self {error foobar}}} msg opt
dict get $opt -errorinfo
} -cleanup {
- master destroy
+ parent destroy
} -result {foobar
while executing
"error foobar"
@@ -2932,15 +2932,15 @@ test oo-18.8 {OO: define/self command support} -setup {
invoked from within
"oo::define foo {rename ::foo ::bar; self {error foobar}}"}
test oo-18.9 {OO: define/self command support} -setup {
- oo::class create master
+ oo::class create parent
set c [oo::class create now_this_is_a_very_very_long_class_name_indeed {
- superclass master
+ superclass parent
}]
} -body {
catch {oo::define $c {error err}} msg opt
dict get $opt -errorinfo
} -cleanup {
- master destroy
+ parent destroy
} -result {err
while executing
"error err"
@@ -2948,13 +2948,13 @@ test oo-18.9 {OO: define/self command support} -setup {
invoked from within
"oo::define $c {error err}"}
test oo-18.10 {OO: define/self command support} -setup {
- oo::class create master
- oo::class create ::foo {superclass master}
+ oo::class create parent
+ oo::class create ::foo {superclass parent}
} -body {
catch {oo::define foo {self {rename ::foo {}; error foobar}}} msg opt
dict get $opt -errorinfo
} -cleanup {
- master destroy
+ parent destroy
} -result {foobar
while executing
"error foobar"
@@ -2965,13 +2965,13 @@ test oo-18.10 {OO: define/self command support} -setup {
invoked from within
"oo::define foo {self {rename ::foo {}; error foobar}}"}
test oo-18.11 {OO: define/self command support} -setup {
- oo::class create master
- oo::class create ::foo {superclass master}
+ oo::class create parent
+ oo::class create ::foo {superclass parent}
} -body {
catch {oo::define foo {rename ::foo {}; self {error foobar}}} msg opt
dict get $opt -errorinfo
} -cleanup {
- master destroy
+ parent destroy
} -result {this command cannot be called when the object has been deleted
while executing
"self {error foobar}"
@@ -3594,12 +3594,12 @@ test oo-27.2 {variables declaration - object introspection} -setup {
info object variables foo
} -result {a b c}
test oo-27.3 {variables declaration - basic behaviour} -setup {
- oo::class create master
+ oo::class create parent
} -cleanup {
- master destroy
+ parent destroy
} -body {
oo::class create foo {
- superclass master
+ superclass parent
variable x!
constructor {} {set x! 1}
method y {} {incr x!}
@@ -3609,13 +3609,13 @@ test oo-27.3 {variables declaration - basic behaviour} -setup {
bar y
} -result 3
test oo-27.4 {variables declaration - destructors too} -setup {
- oo::class create master
+ oo::class create parent
set result bad!
} -cleanup {
- master destroy
+ parent destroy
} -body {
oo::class create foo {
- superclass master
+ superclass parent
variable x!
constructor {} {set x! 1}
method y {} {incr x!}
@@ -3640,12 +3640,12 @@ test oo-27.5 {variables declaration - object-bound variables} -setup {
foo y
} -result 2
test oo-27.6 {variables declaration - non-interference of levels} -setup {
- oo::class create master
+ oo::class create parent
} -cleanup {
- master destroy
+ parent destroy
} -body {
oo::class create foo {
- superclass master
+ superclass parent
variable x!
constructor {} {set x! 1}
method y {} {incr x!}
@@ -3660,12 +3660,12 @@ test oo-27.6 {variables declaration - non-interference of levels} -setup {
list [bar y] [lsort [info object vars bar]] [bar eval {info vars *!}]
} -result {{3 2 y! {}} {x! y!} {x! y!}}
test oo-27.7 {variables declaration - one underlying variable space} -setup {
- oo::class create master
+ oo::class create parent
} -cleanup {
- master destroy
+ parent destroy
} -body {
oo::class create foo {
- superclass master
+ superclass parent
variable x!
constructor {} {set x! 1}
method y {} {incr x!}
@@ -3692,12 +3692,12 @@ test oo-27.9 {variables declaration - error cases - arrays} -body {
oo::define oo::object variable bad(var)
} -returnCodes error -result {invalid declared variable name "bad(var)": must not refer to an array element}
test oo-27.10 {variables declaration - no instance var leaks with class resolvers} -setup {
- oo::class create master
+ oo::class create parent
} -cleanup {
- master destroy
+ parent destroy
} -body {
oo::class create foo {
- superclass master
+ superclass parent
variable clsvar
constructor {} {
set clsvar 0
@@ -3720,12 +3720,12 @@ test oo-27.10 {variables declaration - no instance var leaks with class resolver
list [inst1 value] [inst2 value]
} -result {3 2}
test oo-27.11 {variables declaration - no instance var leaks with class resolvers} -setup {
- oo::class create master
+ oo::class create parent
} -cleanup {
- master destroy
+ parent destroy
} -body {
oo::class create foo {
- superclass master
+ superclass parent
variable clsvar
constructor {} {
set clsvar 0
@@ -3793,12 +3793,12 @@ test oo-27.13 {variables declaration: Bug 3185009: require refcount management}
foo destroy
} -result {0 7 1 7 {} 0 1 {can't read "x": no such variable}}
test oo-27.14 {variables declaration - multiple use} -setup {
- oo::class create master
+ oo::class create parent
} -cleanup {
- master destroy
+ parent destroy
} -body {
oo::class create foo {
- superclass master
+ superclass parent
variable x
variable y
method boo {} {
@@ -3809,12 +3809,12 @@ test oo-27.14 {variables declaration - multiple use} -setup {
list [bar boo] [bar boo]
} -result {1,1 2,2}
test oo-27.15 {variables declaration - multiple use} -setup {
- oo::class create master
+ oo::class create parent
} -cleanup {
- master destroy
+ parent destroy
} -body {
oo::class create foo {
- superclass master
+ superclass parent
variable
variable x y
method boo {} {
@@ -3825,12 +3825,12 @@ test oo-27.15 {variables declaration - multiple use} -setup {
list [bar boo] [bar boo]
} -result {1,1 2,2}
test oo-27.16 {variables declaration - multiple use} -setup {
- oo::class create master
+ oo::class create parent
} -cleanup {
- master destroy
+ parent destroy
} -body {
oo::class create foo {
- superclass master
+ superclass parent
variable x
variable -clear
variable y
@@ -3842,12 +3842,12 @@ test oo-27.16 {variables declaration - multiple use} -setup {
list [bar boo] [bar boo]
} -result {1,1 1,2}
test oo-27.17 {variables declaration - multiple use} -setup {
- oo::class create master
+ oo::class create parent
} -cleanup {
- master destroy
+ parent destroy
} -body {
oo::class create foo {
- superclass master
+ superclass parent
variable x
variable -set y
method boo {} {
@@ -3858,12 +3858,12 @@ test oo-27.17 {variables declaration - multiple use} -setup {
list [bar boo] [bar boo]
} -result {1,1 1,2}
test oo-27.18 {variables declaration - multiple use} -setup {
- oo::class create master
+ oo::class create parent
} -cleanup {
- master destroy
+ parent destroy
} -body {
oo::class create foo {
- superclass master
+ superclass parent
variable x
variable -? y
method boo {} {
@@ -3961,12 +3961,12 @@ test oo-27.22 {variables declaration uniqueifies: Bug 3396896} -setup {
} -result {v t}
test oo-27.23 {variable resolver leakage: Bug 1493a43044} -setup {
oo::class create Super
- oo::class create Master {
+ oo::class create Parent {
superclass Super
variable member1 member2
constructor {} {
- set member1 master1
- set member2 master2
+ set member1 parent1
+ set member2 parent2
}
method getChild {} {
Child new [self]
@@ -3987,10 +3987,10 @@ test oo-27.23 {variable resolver leakage: Bug 1493a43044} -setup {
method result {} {return $result}
}
} -body {
- [[Master new] getChild] result
+ [[Parent new] getChild] result
} -cleanup {
Super destroy
-} -result {master1 master2 master1 master2 master1 master2 master1 master2}
+} -result {parent1 parent2 parent1 parent2 parent1 parent2 parent1 parent2}
# A feature that's not supported because the mechanism may change without
# warning, but is supposed to work...
diff --git a/tests/ooNext2.test b/tests/ooNext2.test
index 6a48d28..0ec7cdd 100644
--- a/tests/ooNext2.test
+++ b/tests/ooNext2.test
@@ -8,8 +8,8 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
package require TclOO 1.0.3
-package require tcltest 2
-if {"::tcltest" in [namespace children]} {
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -882,9 +882,9 @@ test oo-call-3.4 {current call introspection: in destructors} -setup {
# caller
set testopts {
-setup {
- oo::class create Master
+ oo::class create Parent
oo::class create Foo {
- superclass Master
+ superclass Parent
method bar {} {
puts abc
tailcall puts hi
@@ -892,11 +892,11 @@ set testopts {
}
}
oo::class create Foo2 {
- superclass Master
+ superclass Parent
}
}
-cleanup {
- Master destroy
+ Parent destroy
}
}
diff --git a/tests/ooUtil.test b/tests/ooUtil.test
index ff7093f..7fc9b9c 100644
--- a/tests/ooUtil.test
+++ b/tests/ooUtil.test
@@ -10,8 +10,8 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
package require TclOO 1.0.3
-package require tcltest 2
-if {"::tcltest" in [namespace children]} {
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -153,7 +153,7 @@ test ooUtil-1.8 {TIP 478: classmethod in child interp} -setup {
oo::class create Table {
superclass ActiveRecord
}
- # This is confirming that this is not the master interpreter
+ # This is confirming that this is not the parent interpreter
list [Table find foo bar] [info globals childinterp]
}
} -cleanup {
diff --git a/tests/opt.test b/tests/opt.test
index 14a6e04..0af4488 100644
--- a/tests/opt.test
+++ b/tests/opt.test
@@ -11,13 +11,13 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
# the package we are going to test
-package require opt 0.4.7
+package require opt 0.4.8
# we are using implementation specifics to test the package
diff --git a/tests/package.test b/tests/package.test
index 2dca06b..1223d82 100644
--- a/tests/package.test
+++ b/tests/package.test
@@ -13,16 +13,16 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2.3.3
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
-# Do all this in a slave interp to avoid garbaging the package list
+# Do all this in a child interp to avoid garbaging the package list
set i [interp create]
-tcltest::loadIntoSlaveInterpreter $i {*}$argv
+tcltest::loadIntoChildInterpreter $i {*}$argv
catch [list load {} Tcltest $i]
interp eval $i {
namespace import -force ::tcltest::*
@@ -945,15 +945,15 @@ test package-4.56 {Tcl_PackageCmd procedure, "vsatisfies" option} -body {
# No tests for FindPackage; can't think up anything detectable errors.
test package-5.1 {TclFreePackageInfo procedure} {
- interp create slave
- slave eval {
+ interp create child
+ child eval {
package ifneeded t 2.3 x
package ifneeded t 2.4 y
package ifneeded x 3.1 z
package provide q 4.3
package unknown "will this get freed?"
}
- interp delete slave
+ interp delete child
} {}
test package-5.2 {TclFreePackageInfo procedure} -body {
interp create foo
diff --git a/tests/parse.test b/tests/parse.test
index 287c392..94c7f74 100644
--- a/tests/parse.test
+++ b/tests/parse.test
@@ -8,9 +8,9 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[catch {package require tcltest 2.0.2}]} {
- puts stderr "Skipping tests in [info script]. tcltest 2.0.2 required."
- return
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
}
namespace eval ::tcl::test::parse {
@@ -405,14 +405,14 @@ test parse-8.11 {Tcl_EvalObjv procedure, TCL_EVAL_INVOKE} testevalobjv {
proc ::unknown args {lappend ::info [info level]; uplevel 1 foo}
proc ::foo args {lappend ::info global}
catch {rename ::noSuchCommand {}}
- set ::slave [interp create]
- $::slave alias bar noSuchCommand
+ set ::child [interp create]
+ $::child alias bar noSuchCommand
set ::info {}
namespace eval test_ns_1 {
proc foo args {lappend ::info namespace}
- $::slave eval bar
- testevalobjv 1 [list $::slave eval bar]
- uplevel #0 [list $::slave eval bar]
+ $::child eval bar
+ testevalobjv 1 [list $::child eval bar]
+ uplevel #0 [list $::child eval bar]
}
namespace delete test_ns_1
rename ::foo {}
@@ -429,14 +429,14 @@ test parse-8.12 {Tcl_EvalObjv procedure, TCL_EVAL_INVOKE} {
lappend ::info ns
}]
catch {rename ::noSuchCommand {}}
- set ::slave [interp create]
- $::slave alias bar noSuchCommand
+ set ::child [interp create]
+ $::child alias bar noSuchCommand
set ::info {}
namespace eval test_ns_1 {
- $::slave eval bar
+ $::child eval bar
}
namespace delete test_ns_1
- interp delete $::slave
+ interp delete $::child
catch {rename ::noSuchCommand {}}
set ::info
} global
diff --git a/tests/parseExpr.test b/tests/parseExpr.test
index 47dbec5..8b5e429 100644
--- a/tests/parseExpr.test
+++ b/tests/parseExpr.test
@@ -8,8 +8,10 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
-namespace import ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
diff --git a/tests/parseOld.test b/tests/parseOld.test
index 504d063..134a3c2 100644
--- a/tests/parseOld.test
+++ b/tests/parseOld.test
@@ -13,8 +13,10 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
-namespace import ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
diff --git a/tests/pid.test b/tests/pid.test
index af21f30..47f753b 100644
--- a/tests/pid.test
+++ b/tests/pid.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/pkgMkIndex.test b/tests/pkgMkIndex.test
index 8ff806c..8121377 100644
--- a/tests/pkgMkIndex.test
+++ b/tests/pkgMkIndex.test
@@ -8,8 +8,10 @@
# Copyright (c) 1998-1999 by Scriptics Corporation.
# All rights reserved.
-package require tcltest 2
-namespace import ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
set fullPkgPath [makeDirectory pkg]
@@ -72,11 +74,11 @@ proc pkgtest::parseArgs { args } {
# of the command line.
proc pkgtest::parseIndex { filePath } {
- # create a slave interpreter, where we override "package ifneeded"
+ # create a child interpreter, where we override "package ifneeded"
- set slave [interp create]
+ set child [interp create]
if {[catch {
- $slave eval {
+ $child eval {
rename package package_original
proc package { args } {
if {[lindex $args 0] eq "ifneeded"} {
@@ -91,17 +93,17 @@ proc pkgtest::parseIndex { filePath } {
}
set dir [file dirname $filePath]
- $slave eval {set curdir [pwd]}
- $slave eval [list cd $dir]
- $slave eval [list set dir $dir]
- $slave eval [list source [file tail $filePath]]
- $slave eval {cd $curdir}
+ $child eval {set curdir [pwd]}
+ $child eval [list cd $dir]
+ $child eval [list set dir $dir]
+ $child eval [list source [file tail $filePath]]
+ $child eval {cd $curdir}
# Create the list in sorted order, so that we don't get spurious
# errors because the order has changed.
array set P {}
- foreach {k v} [$slave eval {array get ::PKGS}] {
+ foreach {k v} [$child eval {array get ::PKGS}] {
set P($k) $v
}
@@ -113,12 +115,12 @@ proc pkgtest::parseIndex { filePath } {
set ei [dict get $opts -errorinfo]
set ec [dict get $opts -errorcode]
- catch {interp delete $slave}
+ catch {interp delete $child}
error $ei $ec
}
- interp delete $slave
+ interp delete $child
return $PKGS
}
diff --git a/tests/platform.test b/tests/platform.test
index 53d534e..fff16fd 100644
--- a/tests/platform.test
+++ b/tests/platform.test
@@ -9,7 +9,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
+package require tcltest 2.5
namespace eval ::tcl::test::platform {
namespace import ::tcltest::testConstraint
diff --git a/tests/proc-old.test b/tests/proc-old.test
index e45cf5c..79ee1fa 100644
--- a/tests/proc-old.test
+++ b/tests/proc-old.test
@@ -14,8 +14,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/proc.test b/tests/proc.test
index 43d76d8..7039dbb 100644
--- a/tests/proc.test
+++ b/tests/proc.test
@@ -14,7 +14,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -389,9 +389,9 @@ test proc-7.3 {Returning loop exception from redefined cmd: Bug 729692} -body {
test proc-7.4 {Proc struct outlives its interp: Bug 3532959} {
set lambda x
lappend lambda {set a 1}
- interp create slave
- slave eval [list apply $lambda foo]
- interp delete slave
+ interp create child
+ child eval [list apply $lambda foo]
+ interp delete child
unset lambda
} {}
diff --git a/tests/process.test b/tests/process.test
index 229d33c..d7f47b2 100644
--- a/tests/process.test
+++ b/tests/process.test
@@ -8,8 +8,8 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/pwd.test b/tests/pwd.test
index 175c852..3486e70 100644
--- a/tests/pwd.test
+++ b/tests/pwd.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/reg.test b/tests/reg.test
index dabd3bc..847da32 100644
--- a/tests/reg.test
+++ b/tests/reg.test
@@ -9,8 +9,9 @@
#
# Copyright (c) 1998, 1999 Henry Spencer. All rights reserved.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
}
::tcltest::loadTestedCommands
@@ -287,7 +288,7 @@ namespace eval RETest {
set infoflags [TestInfoFlags $flags]
set ccmd [list testregexp -about {*}$f $re]
set nsub [expr {[llength $args] - 1}]
- if {$nsub == -1} {
+ if {$nsub < 0} {
# didn't tell us number of subexps
set ccmd "lreplace \[$ccmd\] 0 0"
set info [list $infoflags]
diff --git a/tests/regexp.test b/tests/regexp.test
index bae1217..a2e6dbb 100644
--- a/tests/regexp.test
+++ b/tests/regexp.test
@@ -12,7 +12,7 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -192,6 +192,17 @@ test regexp-3.7 {getting substrings back from regexp} {
set foo 1; set f2 1; set f3 1; set f4 1
list [regexp -indices (a)(b)?(c) xacy foo f2 f3 f4] $foo $f2 $f3 $f4
} {1 {1 2} {1 1} {-1 -1} {2 2}}
+test regexp-3.8a {-indices by multi-byte utf-8} {
+ regexp -inline -indices {(\w+)-(\w+)} \
+ "gr\u00FC\u00DF-\u043F\u0440\u0438\u0432\u0435\u0442"
+} {{0 10} {0 3} {5 10}}
+test regexp-3.8b {-indices by multi-byte utf-8, from -start position} {
+ list\
+ [regexp -inline -indices -start 3 {(\w+)-(\w+)} \
+ "gr\u00FC\u00DF-\u043F\u0440\u0438\u0432\u0435\u0442"] \
+ [regexp -inline -indices -start 4 {(\w+)-(\w+)} \
+ "gr\u00FC\u00DF-\u043F\u0440\u0438\u0432\u0435\u0442"]
+} {{{3 10} {3 3} {5 10}} {}}
test regexp-4.1 {-nocase option to regexp} {
regexp -nocase foo abcFOo
diff --git a/tests/regexpComp.test b/tests/regexpComp.test
index 8819dd2..53a68c5 100644
--- a/tests/regexpComp.test
+++ b/tests/regexpComp.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/registry.test b/tests/registry.test
index 8cfd5be..53e48fe 100644
--- a/tests/registry.test
+++ b/tests/registry.test
@@ -10,8 +10,8 @@
# Copyright (c) 1997 by Sun Microsystems, Inc. All rights reserved.
# Copyright (c) 1998-1999 by Scriptics Corporation.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/rename.test b/tests/rename.test
index ebf5425..ddda909 100644
--- a/tests/rename.test
+++ b/tests/rename.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/resolver.test b/tests/resolver.test
index b0b395d..9916529 100644
--- a/tests/resolver.test
+++ b/tests/resolver.test
@@ -10,8 +10,8 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
-if {"::tcltest" in [namespace children]} {
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -203,7 +203,7 @@ test resolver-2.1 {compiled var resolver: Bug #3383616} -setup {
# resolver-agnostic).
#
# In order to make the test cases for the per-interpreter cmd literal pool
-# reproducable and to minimize interactions between test cases, we use a slave
+# reproducable and to minimize interactions between test cases, we use a child
# interpreter per test-case.
#
#
diff --git a/tests/result.test b/tests/result.test
index 859e546..f1f5fb7 100644
--- a/tests/result.test
+++ b/tests/result.test
@@ -10,8 +10,10 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
-namespace import ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
diff --git a/tests/safe-stock.test b/tests/safe-stock.test
new file mode 100644
index 0000000..192189f
--- /dev/null
+++ b/tests/safe-stock.test
@@ -0,0 +1,248 @@
+# safe-stock.test --
+#
+# This file contains tests for safe Tcl that were previously in the file
+# safe.test, and use files and packages of stock Tcl 8.7 to perform the tests.
+# These files may be changed or disappear in future revisions of Tcl, for
+# example package opt will eventually be removed.
+#
+# The tests are replaced in safe.tcl with tests that use files provided in the
+# tests directory. Test numbering is for comparison with similar tests in
+# safe.test.
+#
+# Sourcing this file into tcl runs the tests and generates output for errors.
+# No output means no errors were found.
+#
+# The defunct package http 1.0 was convenient for testing package loading.
+# - This file, safe-stock.test, uses packages opt and (from cookiejar)
+# tcl::idna to provide alternative tests based on stock Tcl packages.
+# - These are tests 7.1 7.2 7.4 9.11 9.13
+# - Tests 7.[124], 9.1[13] use "package require opt".
+# - Tests 9.1[13] also use "package require tcl::idna".
+# - The corresponding tests in safe.test use example packages provided in
+# subdirectory auto0 of the tests directory, which are independent of any
+# changes made to the packages provided with Tcl.
+#
+# Copyright (c) 1995-1996 Sun Microsystems, Inc.
+# Copyright (c) 1998-1999 by Scriptics Corporation.
+#
+# See the file "license.terms" for information on usage and redistribution of
+# this file, and for a DISCLAIMER OF ALL WARRANTIES.
+
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
+
+foreach i [interp children] {
+ interp delete $i
+}
+
+# When using package opt for testing positive/negative package search:
+# - The directory location and the error message depend on whether
+# and how the package is installed.
+
+# Error message for test 7.2 for "package require opt".
+if {[string match *zipfs:/* [info library]]} {
+ # pkgIndex.tcl is in [info library]
+ # file to be sourced is in [info library]/opt*
+ set pkgOptErrMsg {permission denied}
+} else {
+ # pkgIndex.tcl and file to be sourced are
+ # both in [info library]/opt*
+ set pkgOptErrMsg {can't find package opt}
+}
+
+# Directory of opt for tests 7.4, 9.10, 9.12 for "package require opt".
+if {[file exists [file join [info library] opt0.4]]} {
+ # Installed files in lib8.7/opt0.4
+ set pkgOptDir opt0.4
+} elseif {[file exists [file join [info library] opt]]} {
+ # Installed files in zipfs, or source files used by "make test"
+ set pkgOptDir opt
+} else {
+ error {cannot find opt library}
+}
+
+# Directory of cookiejar for tests 9.10, 9.12 for "package require tcl::idna".
+if {[file exists [file join [info library] cookiejar0.2]]} {
+ # Installed files in lib8.7/cookiejar0.2
+ set pkgJarDir cookiejar0.2
+} elseif {[file exists [file join [info library] cookiejar]]} {
+ # Installed files in zipfs, or source files used by "make test"
+ set pkgJarDir cookiejar
+} else {
+ error {cannot find cookiejar library}
+}
+
+set SaveAutoPath $::auto_path
+set ::auto_path [info library]
+set TestsDir [file normalize [file dirname [info script]]]
+set PathMapp {}
+lappend PathMapp [file join [info library] $pkgOptDir] TCLLIB/OPTDIR
+lappend PathMapp [file join [info library] $pkgJarDir] TCLLIB/JARDIR
+lappend PathMapp $tcl_library TCLLIB $TestsDir TESTSDIR
+
+proc mapList {map listIn} {
+ set listOut {}
+ foreach element $listIn {
+ lappend listOut [string map $map $element]
+ }
+ return $listOut
+}
+proc mapAndSortList {map listIn} {
+ set listOut {}
+ foreach element $listIn {
+ lappend listOut [string map $map $element]
+ }
+ lsort $listOut
+}
+
+# Force actual loading of the safe package because we use un-exported (and
+# thus un-autoindexed) APIs in this test result arguments:
+catch {safe::interpConfigure}
+
+# high level general test
+test safe-stock-7.1 {tests that everything works at high level, uses pkg opt} -setup {
+ set i [safe::interpCreate]
+} -body {
+ # no error shall occur:
+ # (because the default access_path shall include 1st level sub dirs so
+ # package require in a child works like in the parent)
+ set v [interp eval $i {package require opt}]
+ # no error shall occur:
+ interp eval $i {::tcl::Lempty {a list}}
+ set v
+} -cleanup {
+ safe::interpDelete $i
+} -match glob -result 0.4.*
+test safe-stock-7.2 {tests specific path and interpFind/AddToAccessPath, uses pkg opt} -setup {
+} -body {
+ set i [safe::interpCreate -nostat -nested 1 -accessPath [list [info library]]]
+ # should not add anything (p0)
+ set token1 [safe::interpAddToAccessPath $i [info library]]
+ # should add as p* (not p1 if parent has a module path)
+ set token2 [safe::interpAddToAccessPath $i "/dummy/unixlike/test/path"]
+ # an error shall occur (opt is not anymore in the secure 0-level
+ # provided deep path)
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ list $token1 $token2 -- \
+ [catch {interp eval $i {package require opt}} msg] $msg -- \
+ $mappA -- [safe::interpDelete $i]
+} -cleanup {
+} -match glob -result "{\$p(:0:)} {\$p(:*:)} -- 1 {$pkgOptErrMsg} --\
+ {TCLLIB */dummy/unixlike/test/path} -- {}"
+test safe-stock-7.4 {tests specific path and positive search, uses pkg opt} -setup {
+} -body {
+ set i [safe::interpCreate -nostat -nested 1 -accessPath [list [info library]]]
+ # should not add anything (p0)
+ set token1 [safe::interpAddToAccessPath $i [info library]]
+ # should add as p* (not p1 if parent has a module path)
+ set token2 [safe::interpAddToAccessPath $i [file join [info library] $pkgOptDir]]
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ # this time, unlike test safe-stock-7.2, opt should be found
+ list $token1 $token2 -- \
+ [catch {interp eval $i {package require opt}} msg] $msg -- \
+ $mappA -- [safe::interpDelete $i]
+ # Note that the glob match elides directories (those from the module path)
+ # other than the first and last in the access path.
+} -cleanup {
+} -match glob -result {{$p(:0:)} {$p(:*:)} -- 0 0.4.* --\
+ {TCLLIB * TCLLIB/OPTDIR} -- {}}
+
+# The following test checks whether the definition of tcl_endOfWord can be
+# obtained from auto_loading. It was previously test "safe-5.1".
+test safe-stock-9.8 {test auto-loading in safe interpreters, was safe-5.1} -setup {
+ catch {safe::interpDelete a}
+ safe::interpCreate a
+} -body {
+ interp eval a {tcl_endOfWord "" 0}
+} -cleanup {
+ safe::interpDelete a
+} -result -1
+test safe-stock-9.11 {interpConfigure change the access path; pkgIndex.tcl packages unaffected by token rearrangement, uses pkg opt and tcl::idna} -setup {
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library \
+ [file join $tcl_library $pkgOptDir] \
+ [file join $tcl_library $pkgJarDir]]]
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgOptDir]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgJarDir]]
+
+ # Load pkgIndex.tcl data.
+ catch {interp eval $i {package require NOEXIST}}
+
+ # Rearrange access path. Swap tokens {$p(:1:)} and {$p(:2:)}.
+ # This has no effect because the records in Pkg of these directories were from access as children of {$p(:0:)}.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $tcl_library $pkgJarDir] \
+ [file join $tcl_library $pkgOptDir]]
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set mappB [mapList $PathMapp [dict get $confB -accessPath]]
+ set path3 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgOptDir]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgJarDir]]
+
+ # Try to load the packages and run a command from each one.
+ set code3 [catch {interp eval $i {package require tcl::idna}} msg3]
+ set code4 [catch {interp eval $i {package require opt}} msg4]
+ set code5 [catch {interp eval $i {::tcl::Lempty {a list}}} msg5]
+ set code6 [catch {interp eval $i {::tcl::idna::IDNAencode example.com}} msg6]
+
+ list $path1 $path2 -- $path3 $path4 -- $code3 $msg3 $code4 $msg4 -- \
+ $mappA -- $mappB -- $code5 $msg5 $code6 $msg6
+} -cleanup {
+ safe::interpDelete $i
+} -match glob -result {{$p(:1:)} {$p(:2:)} -- {$p(:2:)} {$p(:1:)} -- 0 1.* 0 0.4.* --\
+ {TCLLIB TCLLIB/OPTDIR TCLLIB/JARDIR*} --\
+ {TCLLIB TCLLIB/JARDIR TCLLIB/OPTDIR*} --\
+ 0 0 0 example.com}
+test safe-stock-9.13 {interpConfigure change the access path; pkgIndex.tcl packages fail if directory de-listed, uses pkg opt and tcl::idna} -setup {
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library \
+ [file join $tcl_library $pkgOptDir] \
+ [file join $tcl_library $pkgJarDir]]]
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgOptDir]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $tcl_library $pkgJarDir]]
+
+ # Load pkgIndex.tcl data.
+ catch {interp eval $i {package require NOEXIST}}
+
+ # Limit access path. Remove tokens {$p(:1:)} and {$p(:2:)}.
+ safe::interpConfigure $i -accessPath [list $tcl_library]
+
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set mappB [mapList $PathMapp [dict get $confB -accessPath]]
+ set code4 [catch {::safe::interpFindInAccessPath $i [file join $tcl_library $pkgOptDir]} path4]
+ set code5 [catch {::safe::interpFindInAccessPath $i [file join $tcl_library $pkgJarDir]} path5]
+
+ # Try to load the packages.
+ set code3 [catch {interp eval $i {package require opt}} msg3]
+ set code6 [catch {interp eval $i {package require tcl::idna}} msg6]
+
+ list $path1 $path2 -- $code4 $path4 -- $code5 $path5 -- $code3 $code6 -- \
+ $mappA -- $mappB
+} -cleanup {
+ safe::interpDelete $i
+} -match glob -result {{$p(:1:)} {$p(:2:)} -- 1 {* not found in access path} --\
+ 1 {* not found in access path} -- 1 1 --\
+ {TCLLIB TCLLIB/OPTDIR TCLLIB/JARDIR*} -- {TCLLIB*}}
+
+set ::auto_path $SaveAutoPath
+unset pkgOptErrMsg pkgOptDir pkgJarDir SaveAutoPath TestsDir PathMapp
+rename mapList {}
+rename mapAndSortList {}
+# cleanup
+::tcltest::cleanupTests
+return
+
+# Local Variables:
+# mode: tcl
+# End:
diff --git a/tests/safe-zipfs.test b/tests/safe-zipfs.test
new file mode 100644
index 0000000..73703e4
--- /dev/null
+++ b/tests/safe-zipfs.test
@@ -0,0 +1,729 @@
+# safe-zipfs.test --
+#
+# This file contains tests for safe Tcl that test its compatibility with the
+# zipfs facilities introduced in Tcl 8.7. Test numbering is for comparison
+# with similar tests in safe.test that do not use the zipfs file system.
+#
+# Sourcing this file into tcl runs the tests and generates output for errors.
+# No output means no errors were found.
+#
+# Copyright (c) 1995-1996 Sun Microsystems, Inc.
+# Copyright (c) 1998-1999 by Scriptics Corporation.
+#
+# See the file "license.terms" for information on usage and redistribution of
+# this file, and for a DISCLAIMER OF ALL WARRANTIES.
+
+package require Tcl 8.5-
+
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
+
+foreach i [interp children] {
+ interp delete $i
+}
+
+set SaveAutoPath $::auto_path
+set ::auto_path [info library]
+set TestsDir [file normalize [file dirname [info script]]]
+
+set ZipMountPoint [zipfs root]auto-files
+zipfs mount $ZipMountPoint [file join $TestsDir auto-files.zip]
+
+set PathMapp {}
+lappend PathMapp $tcl_library TCLLIB $TestsDir TESTSDIR $ZipMountPoint ZIPDIR
+
+proc mapList {map listIn} {
+ set listOut {}
+ foreach element $listIn {
+ lappend listOut [string map $map $element]
+ }
+ return $listOut
+}
+proc mapAndSortList {map listIn} {
+ set listOut {}
+ foreach element $listIn {
+ lappend listOut [string map $map $element]
+ }
+ lsort $listOut
+}
+
+# Force actual loading of the safe package because we use un-exported (and
+# thus un-autoindexed) APIs in this test result arguments:
+catch {safe::interpConfigure}
+
+# testing that nested and statics do what is advertised (we use a static
+# package - Tcltest - but it might be absent if we're in standard tclsh)
+
+testConstraint TcltestPackage [expr {![catch {package require Tcltest}]}]
+
+# Tests 5.* test the example files before using them to test safe interpreters.
+
+test safe-zipfs-5.1 {example tclIndex commands, test in parent interpreter; zipfs} -setup {
+ set tmpAutoPath $::auto_path
+ lappend ::auto_path [file join $ZipMountPoint auto0 auto1] [file join $ZipMountPoint auto0 auto2]
+} -body {
+ # Try to load the commands.
+ set code3 [catch report1 msg3]
+ set code4 [catch report2 msg4]
+ list $code3 $msg3 $code4 $msg4
+} -cleanup {
+ catch {rename report1 {}}
+ catch {rename report2 {}}
+ set ::auto_path $tmpAutoPath
+ auto_reset
+} -match glob -result {0 ok1 0 ok2}
+test safe-zipfs-5.2 {example tclIndex commands, negative test in parent interpreter; zipfs} -setup {
+ set tmpAutoPath $::auto_path
+ lappend ::auto_path [file join $ZipMountPoint auto0]
+} -body {
+ # Try to load the commands.
+ set code3 [catch report1 msg3]
+ set code4 [catch report2 msg4]
+ list $code3 $msg3 $code4 $msg4
+} -cleanup {
+ catch {rename report1 {}}
+ catch {rename report2 {}}
+ set ::auto_path $tmpAutoPath
+ auto_reset
+} -match glob -result {1 {invalid command name "report1"} 1 {invalid command name "report2"}}
+test safe-zipfs-5.3 {example pkgIndex.tcl packages, test in parent interpreter, child directories; zipfs} -setup {
+ set tmpAutoPath $::auto_path
+ lappend ::auto_path [file join $ZipMountPoint auto0]
+} -body {
+ # Try to load the packages and run a command from each one.
+ set code3 [catch {package require SafeTestPackage1} msg3]
+ set code4 [catch {package require SafeTestPackage2} msg4]
+ set code5 [catch HeresPackage1 msg5]
+ set code6 [catch HeresPackage2 msg6]
+ list $code3 $msg3 $code4 $msg4 $code5 $msg5 $code6 $msg6
+} -cleanup {
+ set ::auto_path $tmpAutoPath
+ catch {package forget SafeTestPackage1}
+ catch {package forget SafeTestPackage2}
+ catch {rename HeresPackage1 {}}
+ catch {rename HeresPackage2 {}}
+} -match glob -result {0 1.2.3 0 2.3.4 0 OK1 0 OK2}
+test safe-zipfs-5.4 {example pkgIndex.tcl packages, test in parent interpreter, main directories; zipfs} -setup {
+ set tmpAutoPath $::auto_path
+ lappend ::auto_path [file join $ZipMountPoint auto0 auto1] \
+ [file join $ZipMountPoint auto0 auto2]
+} -body {
+ # Try to load the packages and run a command from each one.
+ set code3 [catch {package require SafeTestPackage1} msg3]
+ set code4 [catch {package require SafeTestPackage2} msg4]
+ set code5 [catch HeresPackage1 msg5]
+ set code6 [catch HeresPackage2 msg6]
+ list $code3 $msg3 $code4 $msg4 $code5 $msg5 $code6 $msg6
+} -cleanup {
+ set ::auto_path $tmpAutoPath
+ catch {package forget SafeTestPackage1}
+ catch {package forget SafeTestPackage2}
+ catch {rename HeresPackage1 {}}
+ catch {rename HeresPackage2 {}}
+} -match glob -result {0 1.2.3 0 2.3.4 0 OK1 0 OK2}
+test safe-zipfs-5.5 {example modules packages, test in parent interpreter, replace path; zipfs} -setup {
+ set oldTm [tcl::tm::path list]
+ foreach path $oldTm {
+ tcl::tm::path remove $path
+ }
+ tcl::tm::path add [file join $ZipMountPoint auto0 modules]
+} -body {
+ # Try to load the modules and run a command from each one.
+ set code0 [catch {package require test0} msg0]
+ set code1 [catch {package require mod1::test1} msg1]
+ set code2 [catch {package require mod2::test2} msg2]
+ set out0 [test0::try0]
+ set out1 [mod1::test1::try1]
+ set out2 [mod2::test2::try2]
+ list $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $out0 $out1 $out2
+} -cleanup {
+ tcl::tm::path remove [file join $ZipMountPoint auto0 modules]
+ foreach path [lreverse $oldTm] {
+ tcl::tm::path add $path
+ }
+ catch {package forget test0}
+ catch {package forget mod1::test1}
+ catch {package forget mod2::test2}
+ catch {namespace delete ::test0}
+ catch {namespace delete ::mod1}
+} -match glob -result {0 0.5 0 1.0 0 2.0 -- res0 res1 res2}
+test safe-zipfs-5.6 {example modules packages, test in parent interpreter, append to path; zipfs} -setup {
+ tcl::tm::path add [file join $ZipMountPoint auto0 modules]
+} -body {
+ # Try to load the modules and run a command from each one.
+ set code0 [catch {package require test0} msg0]
+ set code1 [catch {package require mod1::test1} msg1]
+ set code2 [catch {package require mod2::test2} msg2]
+ set out0 [test0::try0]
+ set out1 [mod1::test1::try1]
+ set out2 [mod2::test2::try2]
+ list $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $out0 $out1 $out2
+} -cleanup {
+ tcl::tm::path remove [file join $ZipMountPoint auto0 modules]
+ catch {package forget test0}
+ catch {package forget mod1::test1}
+ catch {package forget mod2::test2}
+ catch {namespace delete ::test0}
+ catch {namespace delete ::mod1}
+} -match glob -result {0 0.5 0 1.0 0 2.0 -- res0 res1 res2}
+
+# high level general test
+# Use zipped example packages not http1.0 etc
+test safe-zipfs-7.1 {tests that everything works at high level; zipfs} -setup {
+ set tmpAutoPath $::auto_path
+ lappend ::auto_path [file join $ZipMountPoint auto0]
+ set i [safe::interpCreate]
+ set ::auto_path $tmpAutoPath
+} -body {
+ # no error shall occur:
+ # (because the default access_path shall include 1st level sub dirs so
+ # package require in a child works like in the parent)
+ set v [interp eval $i {package require SafeTestPackage1}]
+ # no error shall occur:
+ interp eval $i {HeresPackage1}
+ set v
+} -cleanup {
+ safe::interpDelete $i
+} -match glob -result 1.2.3
+test safe-zipfs-7.2 {tests specific path and interpFind/AddToAccessPath; zipfs} -setup {
+} -body {
+ set i [safe::interpCreate -nostat -nested 1 -accessPath [list [info library]]]
+ # should not add anything (p0)
+ set token1 [safe::interpAddToAccessPath $i [info library]]
+ # should add as p* (not p1 if parent has a module path)
+ set token2 [safe::interpAddToAccessPath $i "/dummy/unixlike/test/path"]
+ # should add as p* (not p2 if parent has a module path)
+ set token3 [safe::interpAddToAccessPath $i [file join $ZipMountPoint auto0]]
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ # an error shall occur (SafeTestPackage1 is not anymore in the secure 0-level
+ # provided deep path)
+ list $token1 $token2 $token3 -- \
+ [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg -- \
+ $mappA -- [safe::interpDelete $i]
+} -cleanup {
+} -match glob -result {{$p(:0:)} {$p(:*:)} {$p(:*:)} --\
+ 1 {can't find package SafeTestPackage1} --\
+ {TCLLIB */dummy/unixlike/test/path ZIPDIR/auto0} -- {}}
+test safe-zipfs-7.4 {tests specific path and positive search; zipfs} -setup {
+} -body {
+ set i [safe::interpCreate -nostat -nested 1 -accessPath [list [info library]]]
+ # should not add anything (p0)
+ set token1 [safe::interpAddToAccessPath $i [info library]]
+ # should add as p* (not p1 if parent has a module path)
+ set token2 [safe::interpAddToAccessPath $i [file join $ZipMountPoint auto0 auto1]]
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ # this time, unlike test safe-zipfs-7.2, SafeTestPackage1 should be found
+ list $token1 $token2 -- \
+ [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg -- \
+ $mappA -- [safe::interpDelete $i]
+ # Note that the glob match elides directories (those from the module path)
+ # other than the first and last in the access path.
+} -cleanup {
+} -match glob -result {{$p(:0:)} {$p(:*:)} -- 0 1.2.3 --\
+ {TCLLIB * ZIPDIR/auto0/auto1} -- {}}
+
+test safe-zipfs-9.9 {interpConfigure change the access path; tclIndex commands unaffected by token rearrangement (dummy test of doreset); zipfs} -setup {
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library \
+ [file join $ZipMountPoint auto0 auto1] \
+ [file join $ZipMountPoint auto0 auto2]]]
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
+
+ # Load auto_load data.
+ interp eval $i {catch nonExistentCommand}
+
+ # Load and run the commands.
+ # This guarantees the test will pass even if the tokens are swapped.
+ set code1 [catch {interp eval $i {report1}} msg1]
+ set code2 [catch {interp eval $i {report2}} msg2]
+
+ # Rearrange access path. Swap tokens {$p(:1:)} and {$p(:2:)}.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $ZipMountPoint auto0 auto2] \
+ [file join $ZipMountPoint auto0 auto1]]
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set mappB [mapList $PathMapp [dict get $confB -accessPath]]
+ set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
+
+ # Run the commands.
+ set code3 [catch {interp eval $i {report1}} msg3]
+ set code4 [catch {interp eval $i {report2}} msg4]
+
+ list $path1 $path2 -- $path3 $path4 -- $code3 $msg3 $code4 $msg4 -- $mappA -- $mappB
+} -cleanup {
+ safe::interpDelete $i
+} -match glob -result {{$p(:1:)} {$p(:2:)} -- {$p(:2:)} {$p(:1:)} -- 0 ok1 0 ok2 --\
+ {TCLLIB ZIPDIR/auto0/auto1 ZIPDIR/auto0/auto2*} --\
+ {TCLLIB ZIPDIR/auto0/auto2 ZIPDIR/auto0/auto1*}}
+test safe-zipfs-9.10 {interpConfigure change the access path; tclIndex commands unaffected by token rearrangement (actual test of doreset); zipfs} -setup {
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library \
+ [file join $ZipMountPoint auto0 auto1] \
+ [file join $ZipMountPoint auto0 auto2]]]
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
+
+ # Load auto_load data.
+ interp eval $i {catch nonExistentCommand}
+
+ # Do not load the commands. With the tokens swapped, the test
+ # will pass only if the Safe Base has called auto_reset.
+
+ # Rearrange access path. Swap tokens {$p(:1:)} and {$p(:2:)}.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $ZipMountPoint auto0 auto2] \
+ [file join $ZipMountPoint auto0 auto1]]
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set mappB [mapList $PathMapp [dict get $confB -accessPath]]
+ set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
+
+ # Load and run the commands.
+ set code3 [catch {interp eval $i {report1}} msg3]
+ set code4 [catch {interp eval $i {report2}} msg4]
+
+ list $path1 $path2 -- $path3 $path4 -- $code3 $msg3 $code4 $msg4 -- $mappA -- $mappB
+} -cleanup {
+ safe::interpDelete $i
+} -match glob -result {{$p(:1:)} {$p(:2:)} -- {$p(:2:)} {$p(:1:)} --\
+ 0 ok1 0 ok2 --\
+ {TCLLIB ZIPDIR/auto0/auto1 ZIPDIR/auto0/auto2*} --\
+ {TCLLIB ZIPDIR/auto0/auto2 ZIPDIR/auto0/auto1*}}
+test safe-zipfs-9.11 {interpConfigure change the access path; pkgIndex.tcl packages unaffected by token rearrangement; zipfs} -setup {
+} -body {
+ # For complete correspondence to safe-stock87-9.11, include auto0 in access path.
+ set i [safe::interpCreate -accessPath [list $tcl_library \
+ [file join $ZipMountPoint auto0] \
+ [file join $ZipMountPoint auto0 auto1] \
+ [file join $ZipMountPoint auto0 auto2]]]
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ set path0 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
+
+ # Load pkgIndex.tcl data.
+ catch {interp eval $i {package require NOEXIST}}
+
+ # Rearrange access path. Swap tokens {$p(:2:)} and {$p(:3:)}.
+ # This would have no effect because the records in Pkg of these directories
+ # were from access as children of {$p(:1:)}.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $ZipMountPoint auto0] \
+ [file join $ZipMountPoint auto0 auto2] \
+ [file join $ZipMountPoint auto0 auto1]]
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set mappB [mapList $PathMapp [dict get $confB -accessPath]]
+ set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
+
+ # Try to load the packages and run a command from each one.
+ set code3 [catch {interp eval $i {package require SafeTestPackage1}} msg3 opts3]
+ set code4 [catch {interp eval $i {package require SafeTestPackage2}} msg4 opts4]
+ set code5 [catch {interp eval $i {HeresPackage1}} msg5 opts5]
+ set code6 [catch {interp eval $i {HeresPackage2}} msg6 opts6]
+
+ list $path1 $path2 -- $path3 $path4 -- $code3 $msg3 $code4 $msg4 -- \
+ $mappA -- $mappB -- $code5 $msg5 $code6 $msg6
+} -cleanup {
+ safe::interpDelete $i
+} -match glob -result {{$p(:2:)} {$p(:3:)} -- {$p(:3:)} {$p(:2:)} -- 0 1.2.3 0 2.3.4 --\
+ {TCLLIB ZIPDIR/auto0 ZIPDIR/auto0/auto1 ZIPDIR/auto0/auto2*} --\
+ {TCLLIB ZIPDIR/auto0 ZIPDIR/auto0/auto2 ZIPDIR/auto0/auto1*} --\
+ 0 OK1 0 OK2}
+test safe-zipfs-9.12 {interpConfigure change the access path; pkgIndex.tcl packages unaffected by token rearrangement, 9.10 without path auto0; zipfs} -setup {
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library \
+ [file join $ZipMountPoint auto0 auto1] \
+ [file join $ZipMountPoint auto0 auto2]]]
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
+
+ # Load pkgIndex.tcl data.
+ catch {interp eval $i {package require NOEXIST}}
+
+ # Rearrange access path. Swap tokens {$p(:1:)} and {$p(:2:)}.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $ZipMountPoint auto0 auto2] \
+ [file join $ZipMountPoint auto0 auto1]]
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set mappB [mapList $PathMapp [dict get $confB -accessPath]]
+ set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
+
+ # Try to load the packages and run a command from each one.
+ set code3 [catch {interp eval $i {package require SafeTestPackage1}} msg3 opts3]
+ set code4 [catch {interp eval $i {package require SafeTestPackage2}} msg4 opts4]
+ set code5 [catch {interp eval $i {HeresPackage1}} msg5 opts5]
+ set code6 [catch {interp eval $i {HeresPackage2}} msg6 opts6]
+
+ list $path1 $path2 -- $path3 $path4 -- $code3 $msg3 $code4 $msg4 -- \
+ $mappA -- $mappB -- $code5 $msg5 $code6 $msg6
+} -cleanup {
+ safe::interpDelete $i
+} -match glob -result {{$p(:1:)} {$p(:2:)} -- {$p(:2:)} {$p(:1:)} --\
+ 0 1.2.3 0 2.3.4 --\
+ {TCLLIB ZIPDIR/auto0/auto1 ZIPDIR/auto0/auto2*} --\
+ {TCLLIB ZIPDIR/auto0/auto2 ZIPDIR/auto0/auto1*} --\
+ 0 OK1 0 OK2}
+test safe-zipfs-9.13 {interpConfigure change the access path; pkgIndex.tcl packages fail if directory de-listed; zipfs} -setup {
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library \
+ [file join $ZipMountPoint auto0 auto1] \
+ [file join $ZipMountPoint auto0 auto2]]]
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]]
+
+ # Load pkgIndex.tcl data.
+ catch {interp eval $i {package require NOEXIST}}
+
+ # Limit access path. Remove tokens {$p(:1:)} and {$p(:2:)}.
+ safe::interpConfigure $i -accessPath [list $tcl_library]
+
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set mappB [mapList $PathMapp [dict get $confB -accessPath]]
+ set code4 [catch {::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto1]} path4]
+ set code5 [catch {::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 auto2]} path5]
+
+ # Try to load the packages.
+ set code3 [catch {interp eval $i {package require SafeTestPackage1}} msg3]
+ set code6 [catch {interp eval $i {package require SafeTestPackage2}} msg6]
+
+ list $path1 $path2 -- $code4 $path4 -- $code5 $path5 -- $code3 $code6 -- \
+ $mappA -- $mappB
+} -cleanup {
+ safe::interpDelete $i
+} -match glob -result {{$p(:1:)} {$p(:2:)} -- 1 {* not found in access path} --\
+ 1 {* not found in access path} -- 1 1 --\
+ {TCLLIB ZIPDIR/auto0/auto1 ZIPDIR/auto0/auto2*} -- {TCLLIB*}}
+test safe-zipfs-9.20 {check module loading; zipfs} -setup {
+ set oldTm [tcl::tm::path list]
+ foreach path $oldTm {
+ tcl::tm::path remove $path
+ }
+ tcl::tm::path add [file join $ZipMountPoint auto0 modules]
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library]]
+
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]]
+ set modsA [interp eval $i {tcl::tm::path list}]
+ set path0 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
+
+ # Try to load the packages and run a command from each one.
+ set code0 [catch {interp eval $i {package require test0}} msg0]
+ set code1 [catch {interp eval $i {package require mod1::test1}} msg1]
+ set code2 [catch {interp eval $i {package require mod2::test2}} msg2]
+ set out0 [interp eval $i {test0::try0}]
+ set out1 [interp eval $i {mod1::test1::try1}]
+ set out2 [interp eval $i {mod2::test2::try2}]
+
+ list [lsort [list $path0 $path1 $path2]] -- $modsA -- \
+ $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $out0 $out1 $out2
+} -cleanup {
+ tcl::tm::path remove [file join $ZipMountPoint auto0 modules]
+ foreach path [lreverse $oldTm] {
+ tcl::tm::path add $path
+ }
+ safe::interpDelete $i
+} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\
+ 0 0.5 0 1.0 0 2.0 --\
+ {TCLLIB ZIPDIR/auto0/modules ZIPDIR/auto0/modules/mod1\
+ ZIPDIR/auto0/modules/mod2} -- res0 res1 res2}
+# - The command safe::InterpSetConfig adds the parent's [tcl::tm::list] in
+# tokenized form to the child's access path, and then adds all the
+# descendants, discovered recursively by using glob.
+# - The order of the directories in the list returned by glob is system-dependent,
+# and therefore this is true also for (a) the order of token assignment to
+# descendants of the [tcl::tm::list] roots; and (b) the order of those same
+# directories in the access path. Both those things must be sorted before
+# comparing with expected results. The test is therefore not totally strict,
+# but will notice missing or surplus directories.
+test safe-zipfs-9.21 {interpConfigure change the access path; check module loading; stale data case 1; zipfs} -setup {
+ set oldTm [tcl::tm::path list]
+ foreach path $oldTm {
+ tcl::tm::path remove $path
+ }
+ tcl::tm::path add [file join $ZipMountPoint auto0 modules]
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library]]
+
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]]
+ set modsA [interp eval $i {tcl::tm::path list}]
+ set path0 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
+
+ # Add to access path.
+ # This injects more tokens, pushing modules to higher token numbers.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $ZipMountPoint auto0 auto1] \
+ [file join $ZipMountPoint auto0 auto2]]
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set sortB [mapAndSortList $PathMapp [dict get $confB -accessPath]]
+ set modsB [interp eval $i {tcl::tm::path list}]
+ set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]]
+ set path5 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
+
+ # Load pkg data.
+ catch {interp eval $i {package require NOEXIST}}
+ catch {interp eval $i {package require mod1::NOEXIST}}
+ catch {interp eval $i {package require mod2::NOEXIST}}
+
+ # Try to load the packages and run a command from each one.
+ set code0 [catch {interp eval $i {package require test0}} msg0]
+ set code1 [catch {interp eval $i {package require mod1::test1}} msg1]
+ set code2 [catch {interp eval $i {package require mod2::test2}} msg2]
+ set out0 [interp eval $i {test0::try0}]
+ set out1 [interp eval $i {mod1::test1::try1}]
+ set out2 [interp eval $i {mod2::test2::try2}]
+
+ list [lsort [list $path0 $path1 $path2]] -- $modsA -- \
+ [lsort [list $path3 $path4 $path5]] -- $modsB -- \
+ $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $sortB -- \
+ $out0 $out1 $out2
+} -cleanup {
+ tcl::tm::path remove [file join $ZipMountPoint auto0 modules]
+ foreach path [lreverse $oldTm] {
+ tcl::tm::path add $path
+ }
+ safe::interpDelete $i
+} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\
+ {{$p(:3:)} {$p(:4:)} {$p(:5:)}} -- {{$p(:3:)}} --\
+ 0 0.5 0 1.0 0 2.0 --\
+ {TCLLIB ZIPDIR/auto0/modules ZIPDIR/auto0/modules/mod1\
+ ZIPDIR/auto0/modules/mod2} --\
+ {TCLLIB ZIPDIR/auto0/auto1 ZIPDIR/auto0/auto2 ZIPDIR/auto0/modules\
+ ZIPDIR/auto0/modules/mod1 ZIPDIR/auto0/modules/mod2} --\
+ res0 res1 res2}
+# See comments on lsort after test safe-zipfs-9.20.
+test safe-zipfs-9.22 {interpConfigure change the access path; check module loading; stale data case 0; zipfs} -setup {
+ set oldTm [tcl::tm::path list]
+ foreach path $oldTm {
+ tcl::tm::path remove $path
+ }
+ tcl::tm::path add [file join $ZipMountPoint auto0 modules]
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library]]
+
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]]
+ set modsA [interp eval $i {tcl::tm::path list}]
+ set path0 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
+
+ # Add to access path.
+ # This injects more tokens, pushing modules to higher token numbers.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $ZipMountPoint auto0 auto1] \
+ [file join $ZipMountPoint auto0 auto2]]
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set sortB [mapAndSortList $PathMapp [dict get $confB -accessPath]]
+ set modsB [interp eval $i {tcl::tm::path list}]
+ set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]]
+ set path5 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
+
+ # Try to load the packages and run a command from each one.
+ set code0 [catch {interp eval $i {package require test0}} msg0]
+ set code1 [catch {interp eval $i {package require mod1::test1}} msg1]
+ set code2 [catch {interp eval $i {package require mod2::test2}} msg2]
+ set out0 [interp eval $i {test0::try0}]
+ set out1 [interp eval $i {mod1::test1::try1}]
+ set out2 [interp eval $i {mod2::test2::try2}]
+
+ list [lsort [list $path0 $path1 $path2]] -- $modsA -- \
+ [lsort [list $path3 $path4 $path5]] -- $modsB -- \
+ $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $sortB -- \
+ $out0 $out1 $out2
+} -cleanup {
+ tcl::tm::path remove [file join $ZipMountPoint auto0 modules]
+ foreach path [lreverse $oldTm] {
+ tcl::tm::path add $path
+ }
+ safe::interpDelete $i
+} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\
+ {{$p(:3:)} {$p(:4:)} {$p(:5:)}} -- {{$p(:3:)}} --\
+ 0 0.5 0 1.0 0 2.0 --\
+ {TCLLIB ZIPDIR/auto0/modules ZIPDIR/auto0/modules/mod1\
+ ZIPDIR/auto0/modules/mod2} --\
+ {TCLLIB ZIPDIR/auto0/auto1 ZIPDIR/auto0/auto2 ZIPDIR/auto0/modules\
+ ZIPDIR/auto0/modules/mod1 ZIPDIR/auto0/modules/mod2} --\
+ res0 res1 res2}
+# See comments on lsort after test safe-zipfs-9.20.
+test safe-zipfs-9.23 {interpConfigure change the access path; check module loading; stale data case 3; zipfs} -setup {
+ set oldTm [tcl::tm::path list]
+ foreach path $oldTm {
+ tcl::tm::path remove $path
+ }
+ tcl::tm::path add [file join $ZipMountPoint auto0 modules]
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library]]
+
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]]
+ set modsA [interp eval $i {tcl::tm::path list}]
+ set path0 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
+
+ # Force the interpreter to acquire pkg data which will soon become stale.
+ catch {interp eval $i {package require NOEXIST}}
+ catch {interp eval $i {package require mod1::NOEXIST}}
+ catch {interp eval $i {package require mod2::NOEXIST}}
+
+ # Add to access path.
+ # This injects more tokens, pushing modules to higher token numbers.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $ZipMountPoint auto0 auto1] \
+ [file join $ZipMountPoint auto0 auto2]]
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set sortB [mapAndSortList $PathMapp [dict get $confB -accessPath]]
+ set modsB [interp eval $i {tcl::tm::path list}]
+ set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]]
+ set path5 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
+
+ # Refresh stale pkg data.
+ catch {interp eval $i {package require NOEXIST}}
+ catch {interp eval $i {package require mod1::NOEXIST}}
+ catch {interp eval $i {package require mod2::NOEXIST}}
+
+ # Try to load the packages and run a command from each one.
+ set code0 [catch {interp eval $i {package require test0}} msg0]
+ set code1 [catch {interp eval $i {package require mod1::test1}} msg1]
+ set code2 [catch {interp eval $i {package require mod2::test2}} msg2]
+ set out0 [interp eval $i {test0::try0}]
+ set out1 [interp eval $i {mod1::test1::try1}]
+ set out2 [interp eval $i {mod2::test2::try2}]
+
+ list [lsort [list $path0 $path1 $path2]] -- $modsA -- \
+ [lsort [list $path3 $path4 $path5]] -- $modsB -- \
+ $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $sortB -- \
+ $out0 $out1 $out2
+} -cleanup {
+ tcl::tm::path remove [file join $ZipMountPoint auto0 modules]
+ foreach path [lreverse $oldTm] {
+ tcl::tm::path add $path
+ }
+ safe::interpDelete $i
+} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\
+ {{$p(:3:)} {$p(:4:)} {$p(:5:)}} -- {{$p(:3:)}} --\
+ 0 0.5 0 1.0 0 2.0 --\
+ {TCLLIB ZIPDIR/auto0/modules ZIPDIR/auto0/modules/mod1\
+ ZIPDIR/auto0/modules/mod2} --\
+ {TCLLIB ZIPDIR/auto0/auto1 ZIPDIR/auto0/auto2 ZIPDIR/auto0/modules\
+ ZIPDIR/auto0/modules/mod1 ZIPDIR/auto0/modules/mod2} --\
+ res0 res1 res2}
+# See comments on lsort after test safe-zipfs-9.20.
+test safe-zipfs-9.24 {interpConfigure change the access path; check module loading; stale data case 2 (worst case); zipfs} -setup {
+ set oldTm [tcl::tm::path list]
+ foreach path $oldTm {
+ tcl::tm::path remove $path
+ }
+ tcl::tm::path add [file join $ZipMountPoint auto0 modules]
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library]]
+
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]]
+ set modsA [interp eval $i {tcl::tm::path list}]
+ set path0 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
+
+ # Force the interpreter to acquire pkg data which will soon become stale.
+ catch {interp eval $i {package require NOEXIST}}
+ catch {interp eval $i {package require mod1::NOEXIST}}
+ catch {interp eval $i {package require mod2::NOEXIST}}
+
+ # Add to access path.
+ # This injects more tokens, pushing modules to higher token numbers.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $ZipMountPoint auto0 auto1] \
+ [file join $ZipMountPoint auto0 auto2]]
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set sortB [mapAndSortList $PathMapp [dict get $confB -accessPath]]
+ set modsB [interp eval $i {tcl::tm::path list}]
+ set path3 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod1]]
+ set path5 [::safe::interpFindInAccessPath $i [file join $ZipMountPoint auto0 modules mod2]]
+
+ # Try to load the packages and run a command from each one.
+ set code0 [catch {interp eval $i {package require test0}} msg0]
+ set code1 [catch {interp eval $i {package require mod1::test1}} msg1]
+ set code2 [catch {interp eval $i {package require mod2::test2}} msg2]
+ set out0 [interp eval $i {test0::try0}]
+ set out1 [interp eval $i {mod1::test1::try1}]
+ set out2 [interp eval $i {mod2::test2::try2}]
+
+ list [lsort [list $path0 $path1 $path2]] -- $modsA -- \
+ [lsort [list $path3 $path4 $path5]] -- $modsB -- \
+ $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $sortB -- \
+ $out0 $out1 $out2
+} -cleanup {
+ tcl::tm::path remove [file join $ZipMountPoint auto0 modules]
+ foreach path [lreverse $oldTm] {
+ tcl::tm::path add $path
+ }
+ safe::interpDelete $i
+} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\
+ {{$p(:3:)} {$p(:4:)} {$p(:5:)}} -- {{$p(:3:)}} --\
+ 0 0.5 0 1.0 0 2.0 --\
+ {TCLLIB ZIPDIR/auto0/modules ZIPDIR/auto0/modules/mod1\
+ ZIPDIR/auto0/modules/mod2} --\
+ {TCLLIB ZIPDIR/auto0/auto1 ZIPDIR/auto0/auto2 ZIPDIR/auto0/modules\
+ ZIPDIR/auto0/modules/mod1 ZIPDIR/auto0/modules/mod2} --\
+ res0 res1 res2}
+# See comments on lsort after test safe-zipfs-9.20.
+
+# cleanup
+set ::auto_path $SaveAutoPath
+zipfs unmount ${ZipMountPoint}
+unset SaveAutoPath TestsDir ZipMountPoint PathMapp
+rename mapList {}
+rename mapAndSortList {}
+::tcltest::cleanupTests
+return
+
+# Local Variables:
+# mode: tcl
+# End:
diff --git a/tests/safe.test b/tests/safe.test
index 356e176..ebaedabe 100644
--- a/tests/safe.test
+++ b/tests/safe.test
@@ -4,27 +4,52 @@
# using safe interpreters. Sourcing this file into tcl runs the tests and
# generates output for errors. No output means no errors were found.
#
+# The defunct package http 1.0 was convenient for testing package loading.
+# - Tests that used http are replaced here with tests that use example packages
+# provided in subdirectory auto0 of the tests directory, which are independent
+# of any changes made to the packages provided with Tcl itself.
+# - These are tests 7.1 7.2 7.4 9.11 9.13
+# - Tests 5.* test the example packages themselves before they
+# are used to test Safe Base interpreters.
+# - Alternative tests using stock packages of Tcl 8.7 are in file
+# safe-stock87.test.
+#
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require Tcl 8.5-
-
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
-foreach i [interp slaves] {
+foreach i [interp children] {
interp delete $i
}
-set saveAutoPath $::auto_path
+set SaveAutoPath $::auto_path
set ::auto_path [info library]
+set TestsDir [file normalize [file dirname [info script]]]
+set PathMapp [list $tcl_library TCLLIB $TestsDir TESTSDIR]
+
+proc mapList {map listIn} {
+ set listOut {}
+ foreach element $listIn {
+ lappend listOut [string map $map $element]
+ }
+ return $listOut
+}
+proc mapAndSortList {map listIn} {
+ set listOut {}
+ foreach element $listIn {
+ lappend listOut [string map $map $element]
+ }
+ lsort $listOut
+}
-# Force actual loading of the safe package because we use un exported (and
+# Force actual loading of the safe package because we use un-exported (and
# thus un-autoindexed) APIs in this test result arguments:
catch {safe::interpConfigure}
@@ -35,16 +60,16 @@ testConstraint TcltestPackage [expr {![catch {package require Tcltest}]}]
test safe-1.1 {safe::interpConfigure syntax} -returnCodes error -body {
safe::interpConfigure
-} -result {no value given for parameter "slave" (use -help for full usage) :
- slave name () name of the slave}
+} -result {no value given for parameter "child" (use -help for full usage) :
+ child name () name of the child}
test safe-1.2 {safe::interpCreate syntax} -returnCodes error -body {
safe::interpCreate -help
} -result {Usage information:
Var/FlagName Type Value Help
------------ ---- ----- ----
(-help gives this help)
- ?slave? name () name of the slave (optional)
- -accessPath list () access path for the slave
+ ?child? name () name of the child (optional)
+ -accessPath list () access path for the child
-noStatics boolflag (false) prevent loading of statically linked pkgs
-statics boolean (true) loading of statically linked pkgs
-nestedLoadOk boolflag (false) allow nested loading
@@ -53,7 +78,7 @@ test safe-1.2 {safe::interpCreate syntax} -returnCodes error -body {
test safe-1.3 {safe::interpInit syntax} -returnCodes error -body {
safe::interpInit -noStatics
} -result {bad value "-noStatics" for parameter
- slave name () name of the slave}
+ child name () name of the child}
test safe-2.1 {creating interpreters, should have no aliases} emptyTest {
# Disabled this test. It tests nothing sensible. [Bug 999612]
@@ -66,6 +91,8 @@ test safe-2.2 {creating interpreters, should have no aliases} -setup {
a aliases
} -cleanup {
safe::interpDelete a
+ # This (ab)use of safe::interpDelete to delete non-Safe-Base interpreters
+ # is regrettable and should be removed at the next major revision.
} -result ""
test safe-2.3 {creating safe interpreters, should have no unexpected aliases} -setup {
catch {safe::interpDelete a}
@@ -115,6 +142,8 @@ test safe-4.1 {safe::interpDelete} -setup {
} -body {
interp create a
safe::interpDelete a
+ # This (ab)use of safe::interpDelete to delete non-Safe-Base interpreters
+ # is regrettable and should be removed at the next major revision.
} -result ""
test safe-4.2 {safe::interpDelete, indirectly} -setup {
catch {safe::interpDelete a}
@@ -122,6 +151,8 @@ test safe-4.2 {safe::interpDelete, indirectly} -setup {
interp create a
a alias exit safe::interpDelete a
a eval exit
+ # This (ab)use of safe::interpDelete to delete non-Safe-Base interpreters
+ # is regrettable and should be removed at the next major revision.
} -result ""
test safe-4.5 {safe::interpDelete} -setup {
catch {safe::interpDelete a}
@@ -138,17 +169,118 @@ test safe-4.6 {safe::interpDelete, indirectly} -setup {
a eval exit
} -result ""
-# The following test checks whether the definition of tcl_endOfWord can be
-# obtained from auto_loading.
+# The old test "safe-5.1" has been moved to "safe-stock87-9.8".
+# A replacement test using example files is "safe-9.8".
+# Tests 5.* test the example files before using them to test safe interpreters.
-test safe-5.1 {test auto-loading in safe interpreters} -setup {
- catch {safe::interpDelete a}
- safe::interpCreate a
+test safe-5.1 {example tclIndex commands, test in parent interpreter} -setup {
+ set tmpAutoPath $::auto_path
+ lappend ::auto_path [file join $TestsDir auto0 auto1] [file join $TestsDir auto0 auto2]
} -body {
- interp eval a {tcl_endOfWord "" 0}
+ # Try to load the commands.
+ set code3 [catch report1 msg3]
+ set code4 [catch report2 msg4]
+ list $code3 $msg3 $code4 $msg4
} -cleanup {
- safe::interpDelete a
-} -result -1
+ catch {rename report1 {}}
+ catch {rename report2 {}}
+ set ::auto_path $tmpAutoPath
+ auto_reset
+} -match glob -result {0 ok1 0 ok2}
+test safe-5.2 {example tclIndex commands, negative test in parent interpreter} -setup {
+ set tmpAutoPath $::auto_path
+ lappend ::auto_path [file join $TestsDir auto0]
+} -body {
+ # Try to load the commands.
+ set code3 [catch report1 msg3]
+ set code4 [catch report2 msg4]
+ list $code3 $msg3 $code4 $msg4
+} -cleanup {
+ catch {rename report1 {}}
+ catch {rename report2 {}}
+ set ::auto_path $tmpAutoPath
+ auto_reset
+} -match glob -result {1 {invalid command name "report1"} 1 {invalid command name "report2"}}
+test safe-5.3 {example pkgIndex.tcl packages, test in parent interpreter, child directories} -setup {
+ set tmpAutoPath $::auto_path
+ lappend ::auto_path [file join $TestsDir auto0]
+} -body {
+ # Try to load the packages and run a command from each one.
+ set code3 [catch {package require SafeTestPackage1} msg3]
+ set code4 [catch {package require SafeTestPackage2} msg4]
+ set code5 [catch HeresPackage1 msg5]
+ set code6 [catch HeresPackage2 msg6]
+ list $code3 $msg3 $code4 $msg4 $code5 $msg5 $code6 $msg6
+} -cleanup {
+ set ::auto_path $tmpAutoPath
+ catch {package forget SafeTestPackage1}
+ catch {package forget SafeTestPackage2}
+ catch {rename HeresPackage1 {}}
+ catch {rename HeresPackage2 {}}
+} -match glob -result {0 1.2.3 0 2.3.4 0 OK1 0 OK2}
+test safe-5.4 {example pkgIndex.tcl packages, test in parent interpreter, main directories} -setup {
+ set tmpAutoPath $::auto_path
+ lappend ::auto_path [file join $TestsDir auto0 auto1] \
+ [file join $TestsDir auto0 auto2]
+} -body {
+ # Try to load the packages and run a command from each one.
+ set code3 [catch {package require SafeTestPackage1} msg3]
+ set code4 [catch {package require SafeTestPackage2} msg4]
+ set code5 [catch HeresPackage1 msg5]
+ set code6 [catch HeresPackage2 msg6]
+ list $code3 $msg3 $code4 $msg4 $code5 $msg5 $code6 $msg6
+} -cleanup {
+ set ::auto_path $tmpAutoPath
+ catch {package forget SafeTestPackage1}
+ catch {package forget SafeTestPackage2}
+ catch {rename HeresPackage1 {}}
+ catch {rename HeresPackage2 {}}
+} -match glob -result {0 1.2.3 0 2.3.4 0 OK1 0 OK2}
+test safe-5.5 {example modules packages, test in parent interpreter, replace path} -setup {
+ set oldTm [tcl::tm::path list]
+ foreach path $oldTm {
+ tcl::tm::path remove $path
+ }
+ tcl::tm::path add [file join $TestsDir auto0 modules]
+} -body {
+ # Try to load the modules and run a command from each one.
+ set code0 [catch {package require test0} msg0]
+ set code1 [catch {package require mod1::test1} msg1]
+ set code2 [catch {package require mod2::test2} msg2]
+ set out0 [test0::try0]
+ set out1 [mod1::test1::try1]
+ set out2 [mod2::test2::try2]
+ list $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $out0 $out1 $out2
+} -cleanup {
+ tcl::tm::path remove [file join $TestsDir auto0 modules]
+ foreach path [lreverse $oldTm] {
+ tcl::tm::path add $path
+ }
+ catch {package forget test0}
+ catch {package forget mod1::test1}
+ catch {package forget mod2::test2}
+ catch {namespace delete ::test0}
+ catch {namespace delete ::mod1}
+} -match glob -result {0 0.5 0 1.0 0 2.0 -- res0 res1 res2}
+test safe-5.6 {example modules packages, test in parent interpreter, append to path} -setup {
+ tcl::tm::path add [file join $TestsDir auto0 modules]
+} -body {
+ # Try to load the modules and run a command from each one.
+ set code0 [catch {package require test0} msg0]
+ set code1 [catch {package require mod1::test1} msg1]
+ set code2 [catch {package require mod2::test2} msg2]
+ set out0 [test0::try0]
+ set out1 [mod1::test1::try1]
+ set out2 [mod2::test2::try2]
+ list $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $out0 $out1 $out2
+} -cleanup {
+ tcl::tm::path remove [file join $TestsDir auto0 modules]
+ catch {package forget test0}
+ catch {package forget mod1::test1}
+ catch {package forget mod2::test2}
+ catch {namespace delete ::test0}
+ catch {namespace delete ::mod1}
+} -match glob -result {0 0.5 0 1.0 0 2.0 -- res0 res1 res2}
# test safe interps 'information leak'
proc SafeEval {script} {
@@ -176,59 +308,121 @@ test safe-6.3 {test safe interpreters knowledge of the world} {
lsort $r
} {byteOrder engine pathSeparator platform pointerSize wordSize}
+rename SafeEval {}
# More test should be added to check that hostname, nameofexecutable, aren't
# leaking infos, but they still do...
# high level general test
-test safe-7.1 {tests that everything works at high level} -body {
+# Use example packages not http1.0 etc
+test safe-7.1 {tests that everything works at high level} -setup {
+ set tmpAutoPath $::auto_path
+ lappend ::auto_path [file join $TestsDir auto0]
set i [safe::interpCreate]
+ set ::auto_path $tmpAutoPath
+} -body {
# no error shall occur:
# (because the default access_path shall include 1st level sub dirs so
- # package require in a slave works like in the master)
- set v [interp eval $i {package require http 2}]
+ # package require in a child works like in the parent)
+ set v [interp eval $i {package require SafeTestPackage1}]
# no error shall occur:
- interp eval $i {http::config}
- safe::interpDelete $i
+ interp eval $i {HeresPackage1}
set v
-} -match glob -result 2.*
-test safe-7.2 {tests specific path and interpFind/AddToAccessPath} -body {
+} -cleanup {
+ safe::interpDelete $i
+} -match glob -result 1.2.3
+test safe-7.2 {tests specific path and interpFind/AddToAccessPath} -setup {
+} -body {
set i [safe::interpCreate -nostat -nested 1 -accessPath [list [info library]]]
# should not add anything (p0)
set token1 [safe::interpAddToAccessPath $i [info library]]
- # should add as p1
+ # should add as p* (not p1 if parent has a module path)
set token2 [safe::interpAddToAccessPath $i "/dummy/unixlike/test/path"]
- # an error shall occur (http is not anymore in the secure 0-level
+ # should add as p* (not p2 if parent has a module path)
+ set token3 [safe::interpAddToAccessPath $i [file join $TestsDir auto0]]
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ # an error shall occur (SafeTestPackage1 is not anymore in the secure 0-level
# provided deep path)
- list $token1 $token2 \
- [catch {interp eval $i {package require http 1}} msg] $msg \
- [safe::interpConfigure $i]\
- [safe::interpDelete $i]
-} -match glob -result "{\$p(:0:)} {\$p(:*:)} 1 {can't find package http 1} {-accessPath {[list $tcl_library */dummy/unixlike/test/path]} -statics 0 -nested 1 -deleteHook {}} {}"
+ list $token1 $token2 $token3 -- \
+ [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg -- \
+ $mappA -- [safe::interpDelete $i]
+} -cleanup {
+} -match glob -result {{$p(:0:)} {$p(:*:)} {$p(:*:)} --\
+ 1 {can't find package SafeTestPackage1} --\
+ {TCLLIB */dummy/unixlike/test/path TESTSDIR/auto0} -- {}}
test safe-7.3 {check that safe subinterpreters work} {
+ set g [interp children]
+ if {$g ne {}} {
+ append g { -- residue of an earlier test}
+ }
+ set h [info vars ::safe::S*]
+ if {$h ne {}} {
+ append h { -- residue of an earlier test}
+ }
set i [safe::interpCreate]
set j [safe::interpCreate [list $i x]]
- list [interp eval $j {join {o k} ""}] [safe::interpDelete $i] [interp exists $j]
-} {ok {} 0}
+ list $g $h [interp eval $j {join {o k} ""}] [safe::interpDelete $i] \
+ [interp exists $j] [info vars ::safe::S*]
+} {{} {} ok {} 0 {}}
+test safe-7.3.1 {check that safe subinterpreters work with namespace names} -setup {
+} -body {
+ set g [interp children]
+ if {$g ne {}} {
+ append g { -- residue of an earlier test}
+ }
+ set h [info vars ::safe::S*]
+ if {$h ne {}} {
+ append h { -- residue of an earlier test}
+ }
+ set i [safe::interpCreate foo::bar]
+ set j [safe::interpCreate [list $i hello::world]]
+ list $g $h [interp eval $j {join {o k} ""}] \
+ [foo::bar eval {hello::world eval {join {o k} ""}}] \
+ [safe::interpDelete $i] \
+ [interp exists $j] [info vars ::safe::S*]
+} -match glob -result {{} {} ok ok {} 0 {}}
+test safe-7.4 {tests specific path and positive search} -setup {
+} -body {
+ set i [safe::interpCreate -nostat -nested 1 -accessPath [list [info library]]]
+ # should not add anything (p0)
+ set token1 [safe::interpAddToAccessPath $i [info library]]
+ # should add as p* (not p1 if parent has a module path)
+ set token2 [safe::interpAddToAccessPath $i [file join $TestsDir auto0 auto1]]
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ # this time, unlike test safe-7.2, SafeTestPackage1 should be found
+ list $token1 $token2 -- \
+ [catch {interp eval $i {package require SafeTestPackage1}} msg] $msg -- \
+ $mappA -- [safe::interpDelete $i]
+ # Note that the glob match elides directories (those from the module path)
+ # other than the first and last in the access path.
+} -cleanup {
+} -match glob -result {{$p(:0:)} {$p(:*:)} -- 0 1.2.3 --\
+ {TCLLIB * TESTSDIR/auto0/auto1} -- {}}
# test source control on file name
-set i "a"
test safe-8.1 {safe source control on file} -setup {
+ set i "a"
catch {safe::interpDelete $i}
} -body {
safe::interpCreate $i
$i eval {source}
} -returnCodes error -cleanup {
safe::interpDelete $i
+ unset i
} -result {wrong # args: should be "source ?-encoding E? fileName"}
test safe-8.2 {safe source control on file} -setup {
+ set i "a"
catch {safe::interpDelete $i}
} -body {
safe::interpCreate $i
$i eval {source a b c d e}
} -returnCodes error -cleanup {
safe::interpDelete $i
+ unset i
} -result {wrong # args: should be "source ?-encoding E? fileName"}
test safe-8.3 {safe source control on file} -setup {
+ set i "a"
catch {safe::interpDelete $i}
set log {}
proc safe-test-log {str} {lappend ::log $str}
@@ -239,10 +433,12 @@ test safe-8.3 {safe source control on file} -setup {
list [catch {$i eval {source .}} msg] $msg $log
} -cleanup {
safe::setLogCmd $prevlog
- unset log
safe::interpDelete $i
-} -result {1 {permission denied} {{ERROR for slave a : ".": is a directory}}}
+ rename safe-test-log {}
+ unset i log
+} -result {1 {permission denied} {{ERROR for child a : ".": is a directory}}}
test safe-8.4 {safe source control on file} -setup {
+ set i "a"
catch {safe::interpDelete $i}
set log {}
proc safe-test-log {str} {global log; lappend log $str}
@@ -253,10 +449,12 @@ test safe-8.4 {safe source control on file} -setup {
list [catch {$i eval {source /abc/def}} msg] $msg $log
} -cleanup {
safe::setLogCmd $prevlog
- unset log
safe::interpDelete $i
-} -result {1 {permission denied} {{ERROR for slave a : "/abc/def": not in access_path}}}
+ rename safe-test-log {}
+ unset i log
+} -result {1 {permission denied} {{ERROR for child a : "/abc/def": not in access_path}}}
test safe-8.5 {safe source control on file} -setup {
+ set i "a"
catch {safe::interpDelete $i}
set log {}
proc safe-test-log {str} {global log; lappend log $str}
@@ -271,10 +469,12 @@ test safe-8.5 {safe source control on file} -setup {
} msg] $msg $log
} -cleanup {
safe::setLogCmd $prevlog
- unset log
safe::interpDelete $i
-} -result [list 1 {no such file or directory} [list "ERROR for slave a : [file join [info library] blah]:no such file or directory"]]
+ rename safe-test-log {}
+ unset i log
+} -result [list 1 {no such file or directory} [list "ERROR for child a : [file join [info library] blah]:no such file or directory"]]
test safe-8.6 {safe source control on file} -setup {
+ set i "a"
catch {safe::interpDelete $i}
set log {}
proc safe-test-log {str} {global log; lappend log $str}
@@ -287,10 +487,12 @@ test safe-8.6 {safe source control on file} -setup {
} msg] $msg $log
} -cleanup {
safe::setLogCmd $prevlog
- unset log
safe::interpDelete $i
-} -result [list 1 {no such file or directory} [list "ERROR for slave a : [file join [info library] blah.tcl]:no such file or directory"]]
+ rename safe-test-log {}
+ unset i log
+} -result [list 1 {no such file or directory} [list "ERROR for child a : [file join [info library] blah.tcl]:no such file or directory"]]
test safe-8.7 {safe source control on file} -setup {
+ set i "a"
catch {safe::interpDelete $i}
set log {}
proc safe-test-log {str} {global log; lappend log $str}
@@ -305,14 +507,16 @@ test safe-8.7 {safe source control on file} -setup {
} msg] $msg $log
} -cleanup {
safe::setLogCmd $prevlog
- unset log
safe::interpDelete $i
-} -result [list 1 {no such file or directory} [list "ERROR for slave a : [file join [info library] xxxxxxxxxxx.tcl]:no such file or directory"]]
+ rename safe-test-log {}
+ unset i log
+} -result [list 1 {no such file or directory} [list "ERROR for child a : [file join [info library] xxxxxxxxxxx.tcl]:no such file or directory"]]
test safe-8.8 {safe source forbids -rsrc} emptyTest {
# Disabled this test. It was only useful for long unsupported
# Mac OS 9 systems. [Bug 860a9f1945]
} {}
test safe-8.9 {safe source and return} -setup {
+ set i "a"
set returnScript [makeFile {return "ok"} return.tcl]
catch {safe::interpDelete $i}
} -body {
@@ -322,8 +526,10 @@ test safe-8.9 {safe source and return} -setup {
} -cleanup {
catch {safe::interpDelete $i}
removeFile $returnScript
+ unset i
} -result ok
test safe-8.10 {safe source and return} -setup {
+ set i "a"
set returnScript [makeFile {return -level 2 "ok"} return.tcl]
catch {safe::interpDelete $i}
} -body {
@@ -336,10 +542,11 @@ test safe-8.10 {safe source and return} -setup {
} -cleanup {
catch {safe::interpDelete $i}
removeFile $returnScript
+ unset i
} -result ok
-set i "a"
test safe-9.1 {safe interps' deleteHook} -setup {
+ set i "a"
catch {safe::interpDelete $i}
set res {}
} -body {
@@ -352,8 +559,12 @@ test safe-9.1 {safe interps' deleteHook} -setup {
}
safe::interpCreate $i -deleteHook "testDelHook arg1 arg2"
list [interp eval $i exit] $res
+} -cleanup {
+ catch {rename testDelHook {}}
+ unset i res
} -result {{} {arg1 arg2 a}}
test safe-9.2 {safe interps' error in deleteHook} -setup {
+ set i "a"
catch {safe::interpDelete $i}
set res {}
set log {}
@@ -374,8 +585,10 @@ test safe-9.2 {safe interps' error in deleteHook} -setup {
list [safe::interpDelete $i] $res $log
} -cleanup {
safe::setLogCmd $prevlog
- unset log
-} -result {{} {arg1 arg2 a} {{NOTICE for slave a : About to delete} {ERROR for slave a : Delete hook error (being catched)} {NOTICE for slave a : Deleted}}}
+ catch {rename testDelHook {}}
+ rename safe-test-log {}
+ unset i log res
+} -result {{} {arg1 arg2 a} {{NOTICE for child a : About to delete} {ERROR for child a : Delete hook error (being catched)} {NOTICE for child a : Deleted}}}
test safe-9.3 {dual specification of statics} -returnCodes error -body {
safe::interpCreate -stat true -nostat
} -result {conflicting values given for -statics and -noStatics}
@@ -403,7 +616,546 @@ test safe-9.6 {interpConfigure widget like behaviour} -body {
safe::interpConfigure $i]\
[safe::interpConfigure $i -deleteHook toto -nosta -nested 0
safe::interpConfigure $i]
-} -match glob -result {{-accessPath * -statics 0 -nested 1 -deleteHook {foo bar}} {-accessPath *} {-nested 1} {-statics 0} {-deleteHook {foo bar}} {-accessPath * -statics 1 -nested 1 -deleteHook {foo bar}} {-accessPath * -statics 0 -nested 0 -deleteHook toto}}
+} -cleanup {
+ safe::interpDelete $i
+} -match glob -result {{-accessPath * -statics 0 -nested 1 -deleteHook {foo bar}}\
+ {-accessPath *} {-nested 1} {-statics 0} {-deleteHook {foo bar}}\
+ {-accessPath * -statics 1 -nested 1 -deleteHook {foo bar}}\
+ {-accessPath * -statics 0 -nested 0 -deleteHook toto}}
+test safe-9.7 {interpConfigure widget like behaviour (demystified)} -body {
+ # this test shall work, believed equivalent to 9.6
+ set i [safe::interpCreate \
+ -noStatics \
+ -nestedLoadOk \
+ -deleteHook {foo bar}]
+ safe::interpConfigure $i -accessPath /foo/bar
+ set a [safe::interpConfigure $i]
+ set b [safe::interpConfigure $i -aCCess]
+ set c [safe::interpConfigure $i -nested]
+ set d [safe::interpConfigure $i -statics]
+ set e [safe::interpConfigure $i -DEL]
+ safe::interpConfigure $i -accessPath /blah -statics 1
+ set f [safe::interpConfigure $i]
+ safe::interpConfigure $i -deleteHook toto -nosta -nested 0
+ set g [safe::interpConfigure $i]
+
+ list $a $b $c $d $e $f $g
+} -cleanup {
+ safe::interpDelete $i
+ unset -nocomplain a b c d e f g i
+} -match glob -result {{-accessPath * -statics 0 -nested 1 -deleteHook {foo bar}}\
+ {-accessPath *} {-nested 1} {-statics 0} {-deleteHook {foo bar}}\
+ {-accessPath * -statics 1 -nested 1 -deleteHook {foo bar}}\
+ {-accessPath * -statics 0 -nested 0 -deleteHook toto}}
+test safe-9.8 {test autoloading commands indexed in tclIndex files} -setup {
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library \
+ [file join $TestsDir auto0 auto1] \
+ [file join $TestsDir auto0 auto2]]]
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]]
+
+ # Load and run the commands.
+ set code1 [catch {interp eval $i {report1}} msg1]
+ set code2 [catch {interp eval $i {report2}} msg2]
+
+ list $path1 $path2 -- $code1 $msg1 $code2 $msg2 -- $mappA
+} -cleanup {
+ safe::interpDelete $i
+} -match glob -result {{$p(:1:)} {$p(:2:)} -- 0 ok1 0 ok2 --\
+ {TCLLIB TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2*}}
+test safe-9.9 {interpConfigure change the access path; tclIndex commands unaffected by token rearrangement (dummy test of doreset)} -setup {
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library \
+ [file join $TestsDir auto0 auto1] \
+ [file join $TestsDir auto0 auto2]]]
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]]
+
+ # Load auto_load data.
+ interp eval $i {catch nonExistentCommand}
+
+ # Load and run the commands.
+ # This guarantees the test will pass even if the tokens are swapped.
+ set code1 [catch {interp eval $i {report1}} msg1]
+ set code2 [catch {interp eval $i {report2}} msg2]
+
+ # Rearrange access path. Swap tokens {$p(:1:)} and {$p(:2:)}.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $TestsDir auto0 auto2] \
+ [file join $TestsDir auto0 auto1]]
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set mappB [mapList $PathMapp [dict get $confB -accessPath]]
+ set path3 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]]
+
+ # Run the commands.
+ set code3 [catch {interp eval $i {report1}} msg3]
+ set code4 [catch {interp eval $i {report2}} msg4]
+
+ list $path1 $path2 -- $path3 $path4 -- $code3 $msg3 $code4 $msg4 -- $mappA -- $mappB
+} -cleanup {
+ safe::interpDelete $i
+} -match glob -result {{$p(:1:)} {$p(:2:)} -- {$p(:2:)} {$p(:1:)} -- 0 ok1 0 ok2 --\
+ {TCLLIB TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2*} --\
+ {TCLLIB TESTSDIR/auto0/auto2 TESTSDIR/auto0/auto1*}}
+test safe-9.10 {interpConfigure change the access path; tclIndex commands unaffected by token rearrangement (actual test of doreset)} -setup {
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library \
+ [file join $TestsDir auto0 auto1] \
+ [file join $TestsDir auto0 auto2]]]
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]]
+
+ # Load auto_load data.
+ interp eval $i {catch nonExistentCommand}
+
+ # Do not load the commands. With the tokens swapped, the test
+ # will pass only if the Safe Base has called auto_reset.
+
+ # Rearrange access path. Swap tokens {$p(:1:)} and {$p(:2:)}.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $TestsDir auto0 auto2] \
+ [file join $TestsDir auto0 auto1]]
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set mappB [mapList $PathMapp [dict get $confB -accessPath]]
+ set path3 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]]
+
+ # Load and run the commands.
+ set code3 [catch {interp eval $i {report1}} msg3]
+ set code4 [catch {interp eval $i {report2}} msg4]
+
+ list $path1 $path2 -- $path3 $path4 -- $code3 $msg3 $code4 $msg4 -- $mappA -- $mappB
+} -cleanup {
+ safe::interpDelete $i
+} -match glob -result {{$p(:1:)} {$p(:2:)} -- {$p(:2:)} {$p(:1:)} --\
+ 0 ok1 0 ok2 --\
+ {TCLLIB TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2*} --\
+ {TCLLIB TESTSDIR/auto0/auto2 TESTSDIR/auto0/auto1*}}
+test safe-9.11 {interpConfigure change the access path; pkgIndex.tcl packages unaffected by token rearrangement} -setup {
+} -body {
+ # For complete correspondence to safe-9.10opt, include auto0 in access path.
+ set i [safe::interpCreate -accessPath [list $tcl_library \
+ [file join $TestsDir auto0] \
+ [file join $TestsDir auto0 auto1] \
+ [file join $TestsDir auto0 auto2]]]
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ set path0 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]]
+
+ # Load pkgIndex.tcl data.
+ catch {interp eval $i {package require NOEXIST}}
+
+ # Rearrange access path. Swap tokens {$p(:2:)} and {$p(:3:)}.
+ # This would have no effect because the records in Pkg of these directories
+ # were from access as children of {$p(:1:)}.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $TestsDir auto0] \
+ [file join $TestsDir auto0 auto2] \
+ [file join $TestsDir auto0 auto1]]
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set mappB [mapList $PathMapp [dict get $confB -accessPath]]
+ set path3 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]]
+
+ # Try to load the packages and run a command from each one.
+ set code3 [catch {interp eval $i {package require SafeTestPackage1}} msg3 opts3]
+ set code4 [catch {interp eval $i {package require SafeTestPackage2}} msg4 opts4]
+ set code5 [catch {interp eval $i {HeresPackage1}} msg5 opts5]
+ set code6 [catch {interp eval $i {HeresPackage2}} msg6 opts6]
+
+ list $path1 $path2 -- $path3 $path4 -- $code3 $msg3 $code4 $msg4 -- \
+ $mappA -- $mappB -- $code5 $msg5 $code6 $msg6
+} -cleanup {
+ safe::interpDelete $i
+} -match glob -result {{$p(:2:)} {$p(:3:)} -- {$p(:3:)} {$p(:2:)} -- 0 1.2.3 0 2.3.4 --\
+ {TCLLIB TESTSDIR/auto0 TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2*} --\
+ {TCLLIB TESTSDIR/auto0 TESTSDIR/auto0/auto2 TESTSDIR/auto0/auto1*} --\
+ 0 OK1 0 OK2}
+test safe-9.12 {interpConfigure change the access path; pkgIndex.tcl packages unaffected by token rearrangement, 9.10 without path auto0} -setup {
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library \
+ [file join $TestsDir auto0 auto1] \
+ [file join $TestsDir auto0 auto2]]]
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]]
+
+ # Load pkgIndex.tcl data.
+ catch {interp eval $i {package require NOEXIST}}
+
+ # Rearrange access path. Swap tokens {$p(:1:)} and {$p(:2:)}.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $TestsDir auto0 auto2] \
+ [file join $TestsDir auto0 auto1]]
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set mappB [mapList $PathMapp [dict get $confB -accessPath]]
+ set path3 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]]
+
+ # Try to load the packages and run a command from each one.
+ set code3 [catch {interp eval $i {package require SafeTestPackage1}} msg3 opts3]
+ set code4 [catch {interp eval $i {package require SafeTestPackage2}} msg4 opts4]
+ set code5 [catch {interp eval $i {HeresPackage1}} msg5 opts5]
+ set code6 [catch {interp eval $i {HeresPackage2}} msg6 opts6]
+
+ list $path1 $path2 -- $path3 $path4 -- $code3 $msg3 $code4 $msg4 -- \
+ $mappA -- $mappB -- \
+ $code5 $msg5 $code6 $msg6
+} -cleanup {
+ safe::interpDelete $i
+} -match glob -result {{$p(:1:)} {$p(:2:)} -- {$p(:2:)} {$p(:1:)} --\
+ 0 1.2.3 0 2.3.4 --\
+ {TCLLIB TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2*} --\
+ {TCLLIB TESTSDIR/auto0/auto2 TESTSDIR/auto0/auto1*} --\
+ 0 OK1 0 OK2}
+test safe-9.13 {interpConfigure change the access path; pkgIndex.tcl packages fail if directory de-listed} -setup {
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library \
+ [file join $TestsDir auto0 auto1] \
+ [file join $TestsDir auto0 auto2]]]
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set mappA [mapList $PathMapp [dict get $confA -accessPath]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]]
+
+ # Load pkgIndex.tcl data.
+ catch {interp eval $i {package require NOEXIST}}
+
+ # Limit access path. Remove tokens {$p(:1:)} and {$p(:2:)}.
+ safe::interpConfigure $i -accessPath [list $tcl_library]
+
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set mappB [mapList $PathMapp [dict get $confB -accessPath]]
+ set code4 [catch {::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto1]} path4]
+ set code5 [catch {::safe::interpFindInAccessPath $i [file join $TestsDir auto0 auto2]} path5]
+
+ # Try to load the packages.
+ set code3 [catch {interp eval $i {package require SafeTestPackage1}} msg3]
+ set code6 [catch {interp eval $i {package require SafeTestPackage2}} msg6]
+
+ list $path1 $path2 -- $code4 $path4 -- $code5 $path5 -- $code3 $code6 -- \
+ $mappA -- $mappB
+} -cleanup {
+ safe::interpDelete $i
+} -match glob -result {{$p(:1:)} {$p(:2:)} -- 1 {* not found in access path} --\
+ 1 {* not found in access path} -- 1 1 --\
+ {TCLLIB TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2*} -- {TCLLIB*}}
+test safe-9.20 {check module loading} -setup {
+ set oldTm [tcl::tm::path list]
+ foreach path $oldTm {
+ tcl::tm::path remove $path
+ }
+ tcl::tm::path add [file join $TestsDir auto0 modules]
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library]]
+
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]]
+ set modsA [interp eval $i {tcl::tm::path list}]
+ set path0 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
+
+ # Try to load the packages and run a command from each one.
+ set code0 [catch {interp eval $i {package require test0}} msg0]
+ set code1 [catch {interp eval $i {package require mod1::test1}} msg1]
+ set code2 [catch {interp eval $i {package require mod2::test2}} msg2]
+ set out0 [interp eval $i {test0::try0}]
+ set out1 [interp eval $i {mod1::test1::try1}]
+ set out2 [interp eval $i {mod2::test2::try2}]
+
+ list [lsort [list $path0 $path1 $path2]] -- $modsA -- \
+ $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $out0 $out1 $out2
+} -cleanup {
+ tcl::tm::path remove [file join $TestsDir auto0 modules]
+ foreach path [lreverse $oldTm] {
+ tcl::tm::path add $path
+ }
+ safe::interpDelete $i
+} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\
+ 0 0.5 0 1.0 0 2.0 --\
+ {TCLLIB TESTSDIR/auto0/modules TESTSDIR/auto0/modules/mod1\
+ TESTSDIR/auto0/modules/mod2} -- res0 res1 res2}
+# - The command safe::InterpSetConfig adds the parent's [tcl::tm::list] in
+# tokenized form to the child's access path, and then adds all the
+# descendants, discovered recursively by using glob.
+# - The order of the directories in the list returned by glob is system-dependent,
+# and therefore this is true also for (a) the order of token assignment to
+# descendants of the [tcl::tm::list] roots; and (b) the order of those same
+# directories in the access path. Both those things must be sorted before
+# comparing with expected results. The test is therefore not totally strict,
+# but will notice missing or surplus directories.
+test safe-9.21 {interpConfigure change the access path; check module loading; stale data case 1} -setup {
+ set oldTm [tcl::tm::path list]
+ foreach path $oldTm {
+ tcl::tm::path remove $path
+ }
+ tcl::tm::path add [file join $TestsDir auto0 modules]
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library]]
+
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]]
+ set modsA [interp eval $i {tcl::tm::path list}]
+ set path0 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
+
+ # Add to access path.
+ # This injects more tokens, pushing modules to higher token numbers.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $TestsDir auto0 auto1] \
+ [file join $TestsDir auto0 auto2]]
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set sortB [mapAndSortList $PathMapp [dict get $confB -accessPath]]
+ set modsB [interp eval $i {tcl::tm::path list}]
+ set path3 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]]
+ set path5 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
+
+ # Load pkg data.
+ catch {interp eval $i {package require NOEXIST}}
+ catch {interp eval $i {package require mod1::NOEXIST}}
+ catch {interp eval $i {package require mod2::NOEXIST}}
+
+ # Try to load the packages and run a command from each one.
+ set code0 [catch {interp eval $i {package require test0}} msg0]
+ set code1 [catch {interp eval $i {package require mod1::test1}} msg1]
+ set code2 [catch {interp eval $i {package require mod2::test2}} msg2]
+ set out0 [interp eval $i {test0::try0}]
+ set out1 [interp eval $i {mod1::test1::try1}]
+ set out2 [interp eval $i {mod2::test2::try2}]
+
+ list [lsort [list $path0 $path1 $path2]] -- $modsA -- \
+ [lsort [list $path3 $path4 $path5]] -- $modsB -- \
+ $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $sortB -- \
+ $out0 $out1 $out2
+} -cleanup {
+ tcl::tm::path remove [file join $TestsDir auto0 modules]
+ foreach path [lreverse $oldTm] {
+ tcl::tm::path add $path
+ }
+ safe::interpDelete $i
+} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\
+ {{$p(:3:)} {$p(:4:)} {$p(:5:)}} -- {{$p(:3:)}} --\
+ 0 0.5 0 1.0 0 2.0 --\
+ {TCLLIB TESTSDIR/auto0/modules TESTSDIR/auto0/modules/mod1\
+ TESTSDIR/auto0/modules/mod2} --\
+ {TCLLIB TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2 TESTSDIR/auto0/modules\
+ TESTSDIR/auto0/modules/mod1 TESTSDIR/auto0/modules/mod2} --\
+ res0 res1 res2}
+# See comments on lsort after test safe-9.20.
+test safe-9.22 {interpConfigure change the access path; check module loading; stale data case 0} -setup {
+ set oldTm [tcl::tm::path list]
+ foreach path $oldTm {
+ tcl::tm::path remove $path
+ }
+ tcl::tm::path add [file join $TestsDir auto0 modules]
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library]]
+
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]]
+ set modsA [interp eval $i {tcl::tm::path list}]
+ set path0 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
+
+ # Add to access path.
+ # This injects more tokens, pushing modules to higher token numbers.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $TestsDir auto0 auto1] \
+ [file join $TestsDir auto0 auto2]]
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set sortB [mapAndSortList $PathMapp [dict get $confB -accessPath]]
+ set modsB [interp eval $i {tcl::tm::path list}]
+ set path3 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]]
+ set path5 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
+
+ # Try to load the packages and run a command from each one.
+ set code0 [catch {interp eval $i {package require test0}} msg0]
+ set code1 [catch {interp eval $i {package require mod1::test1}} msg1]
+ set code2 [catch {interp eval $i {package require mod2::test2}} msg2]
+ set out0 [interp eval $i {test0::try0}]
+ set out1 [interp eval $i {mod1::test1::try1}]
+ set out2 [interp eval $i {mod2::test2::try2}]
+
+ list [lsort [list $path0 $path1 $path2]] -- $modsA -- \
+ [lsort [list $path3 $path4 $path5]] -- $modsB -- \
+ $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $sortB -- \
+ $out0 $out1 $out2
+} -cleanup {
+ tcl::tm::path remove [file join $TestsDir auto0 modules]
+ foreach path [lreverse $oldTm] {
+ tcl::tm::path add $path
+ }
+ safe::interpDelete $i
+} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\
+ {{$p(:3:)} {$p(:4:)} {$p(:5:)}} -- {{$p(:3:)}} --\
+ 0 0.5 0 1.0 0 2.0 --\
+ {TCLLIB TESTSDIR/auto0/modules TESTSDIR/auto0/modules/mod1\
+ TESTSDIR/auto0/modules/mod2} --\
+ {TCLLIB TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2 TESTSDIR/auto0/modules\
+ TESTSDIR/auto0/modules/mod1 TESTSDIR/auto0/modules/mod2} --\
+ res0 res1 res2}
+# See comments on lsort after test safe-9.20.
+test safe-9.23 {interpConfigure change the access path; check module loading; stale data case 3} -setup {
+ set oldTm [tcl::tm::path list]
+ foreach path $oldTm {
+ tcl::tm::path remove $path
+ }
+ tcl::tm::path add [file join $TestsDir auto0 modules]
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library]]
+
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]]
+ set modsA [interp eval $i {tcl::tm::path list}]
+ set path0 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
+
+ # Force the interpreter to acquire pkg data which will soon become stale.
+ catch {interp eval $i {package require NOEXIST}}
+ catch {interp eval $i {package require mod1::NOEXIST}}
+ catch {interp eval $i {package require mod2::NOEXIST}}
+
+ # Add to access path.
+ # This injects more tokens, pushing modules to higher token numbers.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $TestsDir auto0 auto1] \
+ [file join $TestsDir auto0 auto2]]
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set sortB [mapAndSortList $PathMapp [dict get $confB -accessPath]]
+ set modsB [interp eval $i {tcl::tm::path list}]
+ set path3 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]]
+ set path5 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
+
+ # Refresh stale pkg data.
+ catch {interp eval $i {package require NOEXIST}}
+ catch {interp eval $i {package require mod1::NOEXIST}}
+ catch {interp eval $i {package require mod2::NOEXIST}}
+
+ # Try to load the packages and run a command from each one.
+ set code0 [catch {interp eval $i {package require test0}} msg0]
+ set code1 [catch {interp eval $i {package require mod1::test1}} msg1]
+ set code2 [catch {interp eval $i {package require mod2::test2}} msg2]
+ set out0 [interp eval $i {test0::try0}]
+ set out1 [interp eval $i {mod1::test1::try1}]
+ set out2 [interp eval $i {mod2::test2::try2}]
+
+ list [lsort [list $path0 $path1 $path2]] -- $modsA -- \
+ [lsort [list $path3 $path4 $path5]] -- $modsB -- \
+ $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $sortB -- \
+ $out0 $out1 $out2
+} -cleanup {
+ tcl::tm::path remove [file join $TestsDir auto0 modules]
+ foreach path [lreverse $oldTm] {
+ tcl::tm::path add $path
+ }
+ safe::interpDelete $i
+} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\
+ {{$p(:3:)} {$p(:4:)} {$p(:5:)}} -- {{$p(:3:)}} --\
+ 0 0.5 0 1.0 0 2.0 --\
+ {TCLLIB TESTSDIR/auto0/modules TESTSDIR/auto0/modules/mod1\
+ TESTSDIR/auto0/modules/mod2} --\
+ {TCLLIB TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2 TESTSDIR/auto0/modules\
+ TESTSDIR/auto0/modules/mod1 TESTSDIR/auto0/modules/mod2} --\
+ res0 res1 res2}
+# See comments on lsort after test safe-9.20.
+test safe-9.24 {interpConfigure change the access path; check module loading; stale data case 2 (worst case)} -setup {
+ set oldTm [tcl::tm::path list]
+ foreach path $oldTm {
+ tcl::tm::path remove $path
+ }
+ tcl::tm::path add [file join $TestsDir auto0 modules]
+} -body {
+ set i [safe::interpCreate -accessPath [list $tcl_library]]
+
+ # Inspect.
+ set confA [safe::interpConfigure $i]
+ set sortA [mapAndSortList $PathMapp [dict get $confA -accessPath]]
+ set modsA [interp eval $i {tcl::tm::path list}]
+ set path0 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]]
+ set path1 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]]
+ set path2 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
+
+ # Force the interpreter to acquire pkg data which will soon become stale.
+ catch {interp eval $i {package require NOEXIST}}
+ catch {interp eval $i {package require mod1::NOEXIST}}
+ catch {interp eval $i {package require mod2::NOEXIST}}
+
+ # Add to access path.
+ # This injects more tokens, pushing modules to higher token numbers.
+ safe::interpConfigure $i -accessPath [list $tcl_library \
+ [file join $TestsDir auto0 auto1] \
+ [file join $TestsDir auto0 auto2]]
+ # Inspect.
+ set confB [safe::interpConfigure $i]
+ set sortB [mapAndSortList $PathMapp [dict get $confB -accessPath]]
+ set modsB [interp eval $i {tcl::tm::path list}]
+ set path3 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules]]
+ set path4 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod1]]
+ set path5 [::safe::interpFindInAccessPath $i [file join $TestsDir auto0 modules mod2]]
+
+ # Try to load the packages and run a command from each one.
+ set code0 [catch {interp eval $i {package require test0}} msg0]
+ set code1 [catch {interp eval $i {package require mod1::test1}} msg1]
+ set code2 [catch {interp eval $i {package require mod2::test2}} msg2]
+ set out0 [interp eval $i {test0::try0}]
+ set out1 [interp eval $i {mod1::test1::try1}]
+ set out2 [interp eval $i {mod2::test2::try2}]
+
+ list [lsort [list $path0 $path1 $path2]] -- $modsA -- \
+ [lsort [list $path3 $path4 $path5]] -- $modsB -- \
+ $code0 $msg0 $code1 $msg1 $code2 $msg2 -- $sortA -- $sortB -- \
+ $out0 $out1 $out2
+} -cleanup {
+ tcl::tm::path remove [file join $TestsDir auto0 modules]
+ foreach path [lreverse $oldTm] {
+ tcl::tm::path add $path
+ }
+ safe::interpDelete $i
+} -match glob -result {{{$p(:1:)} {$p(:2:)} {$p(:3:)}} -- {{$p(:1:)}} --\
+ {{$p(:3:)} {$p(:4:)} {$p(:5:)}} -- {{$p(:3:)}} --\
+ 0 0.5 0 1.0 0 2.0 --\
+ {TCLLIB TESTSDIR/auto0/modules TESTSDIR/auto0/modules/mod1\
+ TESTSDIR/auto0/modules/mod2} --\
+ {TCLLIB TESTSDIR/auto0/auto1 TESTSDIR/auto0/auto2 TESTSDIR/auto0/modules\
+ TESTSDIR/auto0/modules/mod1 TESTSDIR/auto0/modules/mod2} --\
+ res0 res1 res2}
+# See comments on lsort after test safe-9.20.
catch {teststaticpkg Safepkg1 0 0}
test safe-10.1 {testing statics loading} -constraints TcltestPackage -setup {
@@ -412,7 +1164,7 @@ test safe-10.1 {testing statics loading} -constraints TcltestPackage -setup {
interp eval $i {load {} Safepkg1}
} -returnCodes error -cleanup {
safe::interpDelete $i
-} -result {can't use package in a safe interpreter: no Safepkg1_SafeInit procedure}
+} -result {load of binary library for package Safepkg1 failed: can't use package in a safe interpreter: no Safepkg1_SafeInit procedure}
test safe-10.1.1 {testing statics loading} -constraints TcltestPackage -setup {
set i [safe::interpCreate]
} -body {
@@ -421,7 +1173,7 @@ test safe-10.1.1 {testing statics loading} -constraints TcltestPackage -setup {
} -returnCodes ok -cleanup {
unset -nocomplain m o
safe::interpDelete $i
-} -result {can't use package in a safe interpreter: no Safepkg1_SafeInit procedure
+} -result {load of binary library for package Safepkg1 failed: can't use package in a safe interpreter: no Safepkg1_SafeInit procedure
invoked from within
"load {} Safepkg1"
invoked from within
@@ -444,7 +1196,7 @@ test safe-10.4 {testing nested statics loading / -nestedloadok} -constraints Tcl
interp eval $i {interp create x; load {} Safepkg1 x}
} -returnCodes error -cleanup {
safe::interpDelete $i
-} -result {can't use package in a safe interpreter: no Safepkg1_SafeInit procedure}
+} -result {load of binary library for package Safepkg1 failed: can't use package in a safe interpreter: no Safepkg1_SafeInit procedure}
test safe-10.4.1 {testing nested statics loading / -nestedloadok} -constraints TcltestPackage -body {
set i [safe::interpCreate -nestedloadok]
catch {interp eval $i {interp create x; load {} Safepkg1 x}} m o
@@ -452,7 +1204,7 @@ test safe-10.4.1 {testing nested statics loading / -nestedloadok} -constraints T
} -returnCodes ok -cleanup {
unset -nocomplain m o
safe::interpDelete $i
-} -result {can't use package in a safe interpreter: no Safepkg1_SafeInit procedure
+} -result {load of binary library for package Safepkg1 failed: can't use package in a safe interpreter: no Safepkg1_SafeInit procedure
invoked from within
"load {} Safepkg1 x"
invoked from within
@@ -608,6 +1360,15 @@ proc buildEnvironment {filename} {
set testdir2 [makeDirectory deletemetoo $testdir]
set testfile [makeFile {} $filename $testdir2]
}
+proc buildEnvironment2 {filename} {
+ upvar 1 testdir testdir testdir2 testdir2 testfile testfile
+ upvar 1 testdir3 testdir3 testfile2 testfile2
+ set testdir [makeDirectory deletethisdir]
+ set testdir2 [makeDirectory deletemetoo $testdir]
+ set testfile [makeFile {} $filename $testdir2]
+ set testdir3 [makeDirectory deleteme $testdir]
+ set testfile2 [makeFile {} $filename $testdir3]
+}
#### New tests for Safe base glob, with patches @ Bug 2964715
test safe-13.1 {glob is restricted [Bug 2964715]} -setup {
set i [safe::interpCreate]
@@ -679,21 +1440,33 @@ test safe-13.6 {as 13.4 but test silent failure when result is outside access_pa
safe::interpDelete $i
removeDirectory $testdir
} -result {}
-test safe-13.7 {mimic the glob call by tclPkgUnknown which gives a deliberate error in a safe interpreter [Bug 2964715]} -setup {
+test safe-13.7 {mimic the glob call by tclPkgUnknown in a safe interpreter [Bug 2964715]} -setup {
set i [safe::interpCreate]
buildEnvironment pkgIndex.tcl
} -body {
set safeTD [::safe::interpAddToAccessPath $i $testdir]
::safe::interpAddToAccessPath $i $testdir2
- string map [list $safeTD EXPECTED] [$i eval [list \
+ mapList [list $safeTD EXPECTED] [$i eval [list \
+ glob -directory $safeTD -join * pkgIndex.tcl]]
+} -cleanup {
+ safe::interpDelete $i
+ removeDirectory $testdir
+} -result {EXPECTED/deletemetoo/pkgIndex.tcl}
+test safe-13.7.1 {mimic the glob call by tclPkgUnknown in a safe interpreter with multiple subdirectories} -setup {
+ set i [safe::interpCreate]
+ buildEnvironment2 pkgIndex.tcl
+} -body {
+ set safeTD [::safe::interpAddToAccessPath $i $testdir]
+ ::safe::interpAddToAccessPath $i $testdir2
+ ::safe::interpAddToAccessPath $i $testdir3
+ mapAndSortList [list $safeTD EXPECTED] [$i eval [list \
glob -directory $safeTD -join * pkgIndex.tcl]]
} -cleanup {
safe::interpDelete $i
removeDirectory $testdir
-} -result {{EXPECTED/deletemetoo/pkgIndex.tcl}}
-# Note the extra {} around the result above; that's *expected* because of the
-# format of virtual path roots.
-test safe-13.8 {mimic the glob call by tclPkgUnknown without the deliberate error that is specific to pkgIndex.tcl [Bug 2964715]} -setup {
+} -result {EXPECTED/deleteme/pkgIndex.tcl EXPECTED/deletemetoo/pkgIndex.tcl}
+# See comments on lsort after test safe-9.20.
+test safe-13.8 {mimic the glob call by tclPkgUnknown without the special treatment that is specific to pkgIndex.tcl [Bug 2964715]} -setup {
set i [safe::interpCreate]
buildEnvironment notIndex.tcl
} -body {
@@ -731,9 +1504,10 @@ test safe-13.10 {as 13.8 but test silent failure when result is outside access_p
removeDirectory $testdir
} -result {}
rename buildEnvironment {}
+rename buildEnvironment2 {}
#### Test for the module path
-test safe-14.1 {Check that module path is the same as in the master interpreter [Bug 2964715]} -setup {
+test safe-14.1 {Check that module path is the same as in the parent interpreter [Bug 2964715]} -setup {
set i [safe::interpCreate]
} -body {
set tm {}
@@ -795,6 +1569,7 @@ test safe-16.1 {Bug 3529949: defang ~ in paths} -setup {
} -cleanup {
safe::interpDelete $i
set env(HOME) $savedHOME
+ unset savedHOME
} -result {./~}
test safe-16.2 {Bug 3529949: defang ~user in paths} -setup {
set i [safe::interpCreate]
@@ -804,6 +1579,7 @@ test safe-16.2 {Bug 3529949: defang ~user in paths} -setup {
"file join \[file dirname ~$user\] \[file tail ~$user\]"]
} -cleanup {
safe::interpDelete $i
+ unset user
} -result {./~USER}
test safe-16.3 {Bug 3529949: defang ~ in globs} -setup {
set syntheticHOME [makeDirectory foo]
@@ -818,6 +1594,7 @@ test safe-16.3 {Bug 3529949: defang ~ in globs} -setup {
safe::interpDelete $i
set env(HOME) $savedHOME
removeDirectory $syntheticHOME
+ unset savedHOME syntheticHOME
} -result {}
test safe-16.4 {Bug 3529949: defang ~user in globs} -setup {
set i [safe::interpCreate]
@@ -827,9 +1604,58 @@ test safe-16.4 {Bug 3529949: defang ~user in globs} -setup {
} -cleanup {
safe::interpDelete $i
} -result {}
+test safe-16.5 {Bug 3529949: defang ~ in paths used by AliasGlob (1)} -setup {
+ set savedHOME $env(HOME)
+ set env(HOME) /foo/bar
+ set i [safe::interpCreate]
+} -body {
+ $i eval {
+ set d [format %c 126]
+ file join {$p(:0:)} $d
+ }
+} -cleanup {
+ safe::interpDelete $i
+ set env(HOME) $savedHOME
+ unset savedHOME
+} -result {~}
+test safe-16.6 {Bug 3529949: defang ~ in paths used by AliasGlob (2)} -setup {
+ set savedHOME $env(HOME)
+ set env(HOME) /foo/bar
+ set i [safe::interpCreate]
+} -body {
+ $i eval {
+ set d [format %c 126]
+ file join {$p(:0:)/foo/bar} $d
+ }
+} -cleanup {
+ safe::interpDelete $i
+ set env(HOME) $savedHOME
+ unset savedHOME
+} -result {~}
+test safe-16.7 {Bug 3529949: defang ~user in paths used by AliasGlob (1)} -setup {
+ set i [safe::interpCreate]
+ set user $tcl_platform(user)
+} -body {
+ string map [list $user USER] [$i eval [list file join {$p(:0:)} ~$user]]
+} -cleanup {
+ safe::interpDelete $i
+ unset user
+} -result {~USER}
+test safe-16.8 {Bug 3529949: defang ~user in paths used by AliasGlob (2)} -setup {
+ set i [safe::interpCreate]
+ set user $tcl_platform(user)
+} -body {
+ string map [list $user USER] [$i eval [list file join {$p(:0:)/foo/bar} ~$user]]
+} -cleanup {
+ safe::interpDelete $i
+ unset user
+} -result {~USER}
-set ::auto_path $saveAutoPath
# cleanup
+set ::auto_path $SaveAutoPath
+unset SaveAutoPath TestsDir PathMapp
+rename mapList {}
+rename mapAndSortList {}
::tcltest::cleanupTests
return
diff --git a/tests/scan.test b/tests/scan.test
index b488f68..fe912db 100644
--- a/tests/scan.test
+++ b/tests/scan.test
@@ -12,7 +12,7 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -555,6 +555,11 @@ test scan-5.19 {bigint scanning invalid} -setup {
list [scan "207698809136909011942886895" \
%llu a] $a
} -result {1 207698809136909011942886895}
+test scan-5.20 {ignore digit separators} -setup {
+ set a {}; set b {}; set c {};
+} -body {
+ list [scan "10_23_45" %d_%d_%d a b c] $a $b $c
+} -result {3 10 23 45}
test scan-6.1 {floating-point scanning} -setup {
set a {}; set b {}; set c {}; set d {}
@@ -600,6 +605,11 @@ test scan-6.8 {floating-point scanning} -setup {
} -body {
list [scan "4.6 5.2" "%f %f %f %f" a b c d] $a $b $c $d
} -result {2 4.6 5.2 {} {}}
+test scan-6.8 {disallow diget separator in floating-point} -setup {
+ set a {}; set b {}; set c {};
+} -body {
+ list [scan "3.14_2.35_98.6" %f_%f_%f a b c ] $a $b $c
+} -result {3 3.14 2.35 98.6}
test scan-7.1 {string and character scanning} -setup {
set a {}; set b {}; set c {}; set d {}
diff --git a/tests/security.test b/tests/security.test
index eeabc9c..3235a1f 100644
--- a/tests/security.test
+++ b/tests/security.test
@@ -11,7 +11,7 @@
# All rights reserved.
if {"::tcltest" ni [namespace children]} {
- package require tcltest
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/set-old.test b/tests/set-old.test
index ea5155b..e29b93b 100644
--- a/tests/set-old.test
+++ b/tests/set-old.test
@@ -13,8 +13,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/set.test b/tests/set.test
index 3c87000..303c2d7 100644
--- a/tests/set.test
+++ b/tests/set.test
@@ -10,8 +10,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/socket.test b/tests/socket.test
index fbaade9..868c17a 100644
--- a/tests/socket.test
+++ b/tests/socket.test
@@ -60,8 +60,8 @@
# listening at port 2048. If all fails, a message is printed and the tests
# using the remote server are not performed.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -248,7 +248,7 @@ if {$doTestsWithRemoteServer} {
# Some tests are run only if we are doing testing against a remote server.
testConstraint doTestsWithRemoteServer $doTestsWithRemoteServer
if {!$doTestsWithRemoteServer} {
- if {[string first s $::tcltest::verbose] != -1} {
+ if {[string first s $::tcltest::verbose] >= 0} {
puts "Skipping tests with remote server. See tests/socket.test for"
puts "information on how to run remote server."
puts "Reason for not doing remote tests: $noRemoteTestReason"
@@ -291,6 +291,9 @@ proc getPort sock {
lindex [fconfigure $sock -sockname] 2
}
+# Some tests in this file are known to hang *occasionally* on OSX; stop the
+# worst offenders.
+testConstraint notOSX [expr {$::tcl_platform(os) ne "Darwin"}]
# ----------------------------------------------------------------------
@@ -933,7 +936,7 @@ test socket_$af-5.1 {byte order problems, socket numbers, htons} -body {
return {htons problem, should be disallowed, are you running as SU?}
}
return {couldn't open socket: not owner}
-} -constraints [list socket supported_$af unix notRoot] -result {couldn't open socket: not owner}
+} -constraints [list socket supported_$af unix notRoot notOSX] -result {couldn't open socket: not owner}
test socket_$af-5.2 {byte order problems, socket numbers, htons} -body {
if {![catch {socket -server dodo 0x10000} msg]} {
close $msg
@@ -947,7 +950,7 @@ test socket_$af-5.3 {byte order problems, socket numbers, htons} -body {
return {htons problem, should be disallowed, are you running as SU?}
}
return {couldn't open socket: not owner}
-} -constraints [list socket supported_$af unix notRoot] -result {couldn't open socket: not owner}
+} -constraints [list socket supported_$af unix notRoot notOSX] -result {couldn't open socket: not owner}
test socket_$af-6.1 {accept callback error} -constraints [list socket supported_$af stdio] -setup {
proc myHandler {msg options} {
@@ -1864,12 +1867,12 @@ proc transf_test {{testmode transfer} {maxIter 1000} {maxTime 10000}} {
}
}
tcltest::DebugPuts 1 "== test \[$::localhost\]:$port $testmode =="
- set ::master [thread::id]
- # helper thread creating async connection and initiating transfer (detach) to master:
+ set ::parent [thread::id]
+ # helper thread creating async connection and initiating transfer (detach) to parent:
set ::helper [thread::create]
thread::send -async $::helper [list \
- lassign [list $::master $::localhost $port $testmode] \
- ::master ::localhost ::port ::testmode
+ lassign [list $::parent $::localhost $port $testmode] \
+ ::parent ::localhost ::port ::testmode
]
thread::send -async $::helper {
set ::helper [thread::id]
@@ -1878,29 +1881,29 @@ proc transf_test {{testmode transfer} {maxIter 1000} {maxTime 10000}} {
if {"helper-writable" in $::testmode} {;# to test both sides during connect
fileevent $fd writable [list apply {{fd} {
if {[thread::id] ne $::helper} {
- thread::send -async $::master {set ::count "ERROR: invalid thread, $::helper is expecting"}
+ thread::send -async $::parent {set ::count "ERROR: invalid thread, $::helper is expecting"}
close $fd
return
}
}} $fd]
};#
thread::detach $fd
- thread::send -async $::master [list transf_master $fd {*}$args]
+ thread::send -async $::parent [list transf_parent $fd {*}$args]
}
iteration first
}
- # master proc commiting transfer attempt (attach) and checking acquire was successful:
- proc transf_master {fd args} {
+ # parent proc commiting transfer attempt (attach) and checking acquire was successful:
+ proc transf_parent {fd args} {
tcltest::DebugPuts 1 "** trma / $::count ** $args **"
thread::attach $fd
- if {"master-close" in $::testmode} {;# to test close during connect
+ if {"parent-close" in $::testmode} {;# to test close during connect
set ::count $::count
close $fd
return
};#
fileevent $fd writable [list apply {{fd} {
- if {[thread::id] ne $::master} {
- thread::send -async $::master {set ::count "ERROR: invalid thread, $::master is expecting"}
+ if {[thread::id] ne $::parent} {
+ thread::send -async $::parent {set ::count "ERROR: invalid thread, $::parent is expecting"}
close $fd
return
}
@@ -1928,7 +1931,7 @@ proc transf_test {{testmode transfer} {maxIter 1000} {maxTime 10000}} {
if {$srvsock ne {}} {close $srvsock}
if {[info exists ::helper]} {thread::release -wait $::helper}
tcltest::DebugPuts 1 "== stop / $::count =="
- unset -nocomplain ::count ::testmode ::master ::helper
+ unset -nocomplain ::count ::testmode ::parent ::helper
}
}
test socket_$af-13.2.tr1 {Testing socket transfer between threads during async connect} -body {
@@ -1938,12 +1941,12 @@ test socket_$af-13.2.tr2 {Testing socket transfer between threads during async c
transf_test {transfer helper-writable} 100
} -result 100 -constraints [list socket supported_$af thread]
test socket_$af-13.2.cl1 {Testing socket transfer between threads during async connect} -body {
- transf_test {master-close} 100
+ transf_test {parent-close} 100
} -result 100 -constraints [list socket supported_$af thread]
test socket_$af-13.2.cl2 {Testing socket transfer between threads during async connect} -body {
- transf_test {master-close helper-writable} 100
+ transf_test {parent-close helper-writable} 100
} -result 100 -constraints [list socket supported_$af thread]
-catch {rename transf_master {}}
+catch {rename transf_parent {}}
rename transf_test {}
# ----------------------------------------------------------------------
diff --git a/tests/split.test b/tests/split.test
index d00c452..9c95b81 100644
--- a/tests/split.test
+++ b/tests/split.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/stack.test b/tests/stack.test
index 4c50f74..77cb69f 100644
--- a/tests/stack.test
+++ b/tests/stack.test
@@ -9,8 +9,10 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
-namespace import ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
# Note that a failure in this test may result in a crash of the executable.
diff --git a/tests/string.test b/tests/string.test
index cddd506..47aec29 100644
--- a/tests/string.test
+++ b/tests/string.test
@@ -12,8 +12,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -131,11 +131,11 @@ test string-2.11.3.$noComp {string compare, unicode} {
run {string compare \334\334\334\374\374 \334\334\334\334\334}
} 1
test string-2.12.$noComp {string compare, high bit} {
- # This test will fail if the underlying comparaison
+ # This test will fail if the underlying comparison
# is using signed chars instead of unsigned chars.
# (like SunOS's default memcmp thus the compat/memcmp.c)
run {string compare "\x80" "@"}
- # Nb this tests works also in utf8 space because \x80 is
+ # Nb this tests works also in utf-8 space because \x80 is
# translated into a 2 or more bytelength but whose first byte has
# the high bit set.
} 1
@@ -1506,6 +1506,20 @@ test string-12.22.$noComp {string range, shimmering binary/index} {
test string-12.23.$noComp {string range, surrogates, bug [11ae2be95dac9417]} utf16 {
run {list [string range a\U100000b 1 1] [string range a\U100000b 2 2] [string range a\U100000b 3 3]}
} [list \U100000 {} b]
+test string-12.24.$noComp {bignum index arithmetic} -setup {
+ proc demo {i j} {string range fubar $i $j}
+} -cleanup {
+ rename demo {}
+} -body {
+ demo 2 0+0x10000000000000000
+} -result bar
+test string-12.25.$noComp {bignum index arithmetic} -setup {
+ proc demo {i j} {string range fubar $i $j}
+} -cleanup {
+ rename demo {}
+} -body {
+ demo 0x10000000000000000-0xffffffffffffffff 3
+} -result uba
test string-13.1.$noComp {string repeat} {
list [catch {run {string repeat}} msg] $msg
@@ -1651,6 +1665,9 @@ test stringComp-14.24.$noComp {Bug 1af8de570511} {
test stringComp-14.25.$noComp {} {
string length [string replace [string repeat a\xFE 2] 3 end {}]
} 3
+test stringComp-14.26.$noComp {} {
+ run {string replace abcd 0x10000000000000000-0xffffffffffffffff 2 e}
+} aed
test string-15.1.$noComp {string tolower too few args} {
list [catch {run {string tolower}} msg] $msg
@@ -2298,7 +2315,7 @@ test string-28.12.$noComp {tcl::prefix longest} {
tcl::prefix longest {apa {} appa} {}
} {}
test string-28.13.$noComp {tcl::prefix longest} {
- # Test UTF8 handling
+ # Test utf-8 handling
tcl::prefix longest {ax\x90 bep ax\x91} a
} ax
diff --git a/tests/stringObj.test b/tests/stringObj.test
index 3779bca..ca6c323 100644
--- a/tests/stringObj.test
+++ b/tests/stringObj.test
@@ -12,8 +12,8 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -29,8 +29,8 @@ testConstraint nodep [info exists tcl_precision]
test stringObj-1.1 {string type registration} testobj {
set t [testobj types]
set first [string first "string" $t]
- set result [expr {$first != -1}]
-} {1}
+ set result [expr {$first >= 0}]
+} 1
test stringObj-2.1 {Tcl_NewStringObj} testobj {
set result ""
diff --git a/tests/subst.test b/tests/subst.test
index 1f3c22a..42d1bec 100644
--- a/tests/subst.test
+++ b/tests/subst.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2.1
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
::tcltest::loadTestedCommands
@@ -282,18 +282,18 @@ test subst-13.1 {Bug 3081065} -setup {
demo name2
} subst13.tcl]
} -body {
- interp create slave
- slave eval [list source $script]
- interp delete slave
- interp create slave
- slave eval {
+ interp create child
+ child eval [list source $script]
+ interp delete child
+ interp create child
+ child eval {
set count 400
while {[incr count -1]} {
lappend bloat [expr {rand()}]
}
}
- slave eval [list source $script]
- interp delete slave
+ child eval [list source $script]
+ interp delete child
} -cleanup {
removeFile subst13.tcl
}
diff --git a/tests/switch.test b/tests/switch.test
index 4d204bb..8ca049c 100644
--- a/tests/switch.test
+++ b/tests/switch.test
@@ -12,7 +12,7 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/tailcall.test b/tests/tailcall.test
index 9174167..3704333 100644
--- a/tests/tailcall.test
+++ b/tests/tailcall.test
@@ -9,8 +9,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/tcltest.test b/tests/tcltest.test
index c856209..b2debe7 100644
--- a/tests/tcltest.test
+++ b/tests/tcltest.test
@@ -13,13 +13,13 @@
# testing to run the test itself. Ditto on things like [verbose].
#
# It would be better to have the -body of the tests run the tcltest
-# commands in a slave interp so the [test] being tested would not
+# commands in a child interp so the [test] being tested would not
# interfere with the [test] doing the testing.
#
-if {[catch {package require tcltest 2.1}]} {
- puts stderr "Skipping tests in [info script]. tcltest 2.1 required."
- return
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
}
namespace eval ::tcltest::test {
@@ -27,7 +27,7 @@ namespace eval ::tcltest::test {
namespace import ::tcltest::*
makeFile {
- package require tcltest
+ package require tcltest 2.5
namespace import ::tcltest::test
test a-1.0 {test a} {
list 0
@@ -63,11 +63,11 @@ test tcltest-1.3 {tcltest -h} {exec} {
} {1 0}
# -verbose, implicit & explicit testing of [verbose]
-proc slave {msgVar args} {
+proc child {msgVar args} {
upvar 1 $msgVar msg
interp create [namespace current]::i
- # Fake the slave interp into dumping output to a file
+ # Fake the child interp into dumping output to a file
i eval {namespace eval ::tcltest {}}
i eval "set tcltest::outputChannel\
\[[list open [set of [makeFile {} output]] w]]"
@@ -99,44 +99,44 @@ proc slave {msgVar args} {
return $code
}
test tcltest-2.0 {tcltest (verbose default - 'b')} {unixOrWin} {
- set result [slave msg test.tcl]
+ set result [child msg test.tcl]
list $result [regexp "Contents of test case" $msg] [regexp a-1.0 $msg] \
[regexp c-1.0 $msg] \
[regexp "Total.+4.+Passed.+1.+Skipped.+1.+Failed.+2" $msg]
} {0 1 0 0 1}
test tcltest-2.1 {tcltest -verbose 'b'} {unixOrWin} {
- set result [slave msg test.tcl -verbose 'b']
+ set result [child msg test.tcl -verbose 'b']
list $result [regexp "Contents of test case" $msg] [regexp a-1.0 $msg] \
[regexp c-1.0 $msg] \
[regexp "Total.+4.+Passed.+1.+Skipped.+1.+Failed.+2" $msg]
} {0 1 0 0 1}
test tcltest-2.2 {tcltest -verbose 'p'} {unixOrWin} {
- set result [slave msg test.tcl -verbose 'p']
+ set result [child msg test.tcl -verbose 'p']
list $result [regexp "Contents of test case" $msg] [regexp a-1.0 $msg] \
[regexp c-1.0 $msg] \
[regexp "Total.+4.+Passed.+1.+Skipped.+1.+Failed.+2" $msg]
} {0 0 1 0 1}
test tcltest-2.3 {tcltest -verbose 's'} {unixOrWin} {
- set result [slave msg test.tcl -verbose 's']
+ set result [child msg test.tcl -verbose 's']
list $result [regexp "Contents of test case" $msg] [regexp a-1.0 $msg] \
[regexp c-1.0 $msg] \
[regexp "Total.+4.+Passed.+1.+Skipped.+1.+Failed.+2" $msg]
} {0 0 0 1 1}
test tcltest-2.4 {tcltest -verbose 'ps'} {unixOrWin} {
- set result [slave msg test.tcl -verbose 'ps']
+ set result [child msg test.tcl -verbose 'ps']
list $result [regexp "Contents of test case" $msg] [regexp a-1.0 $msg] \
[regexp c-1.0 $msg] \
[regexp "Total.+4.+Passed.+1.+Skipped.+1.+Failed.+2" $msg]
} {0 0 1 1 1}
test tcltest-2.5 {tcltest -verbose 'psb'} {unixOrWin} {
- set result [slave msg test.tcl -verbose 'psb']
+ set result [child msg test.tcl -verbose 'psb']
list $result [regexp "Contents of test case" $msg] [regexp a-1.0 $msg] \
[regexp c-1.0 $msg] \
[regexp "Total.+4.+Passed.+1.+Skipped.+1.+Failed.+2" $msg]
} {0 1 1 1 1}
test tcltest-2.5a {tcltest -verbose 'pass skip body'} {unixOrWin} {
- set result [slave msg test.tcl -verbose "pass skip body"]
+ set result [child msg test.tcl -verbose "pass skip body"]
list $result [regexp "Contents of test case" $msg] [regexp a-1.0 $msg] \
[regexp c-1.0 $msg] \
[regexp "Total.+4.+Passed.+1.+Skipped.+1.+Failed.+2" $msg]
@@ -145,7 +145,7 @@ test tcltest-2.5a {tcltest -verbose 'pass skip body'} {unixOrWin} {
test tcltest-2.6 {tcltest -verbose 't'} {
-constraints {unixOrWin}
-body {
- set result [slave msg test.tcl -verbose 't']
+ set result [child msg test.tcl -verbose 't']
list $result $msg
}
-result {^0 .*a-1.0 start.*b-1.0 start}
@@ -155,7 +155,7 @@ test tcltest-2.6 {tcltest -verbose 't'} {
test tcltest-2.6a {tcltest -verbose 'start'} {
-constraints {unixOrWin}
-body {
- set result [slave msg test.tcl -verbose start]
+ set result [child msg test.tcl -verbose start]
list $result $msg
}
-result {^0 .*a-1.0 start.*b-1.0 start}
@@ -178,7 +178,7 @@ test tcltest-2.7 {tcltest::verbose} {
test tcltest-2.8 {tcltest -verbose 'error'} {
-constraints {unixOrWin}
-body {
- set result [slave msg test.tcl -verbose error]
+ set result [child msg test.tcl -verbose error]
list $result $msg
}
-result {errorInfo: foo.*errorCode: 9}
@@ -186,22 +186,22 @@ test tcltest-2.8 {tcltest -verbose 'error'} {
}
# -match, [match]
test tcltest-3.1 {tcltest -match 'a*'} {unixOrWin} {
- set result [slave msg test.tcl -match a* -verbose 'ps']
+ set result [child msg test.tcl -match a* -verbose 'ps']
list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \
[regexp "Total.+4.+Passed.+1.+Skipped.+3.+Failed.+0" $msg]
} {0 1 0 0 1}
test tcltest-3.2 {tcltest -match 'b*'} {unixOrWin} {
- set result [slave msg test.tcl -match b* -verbose 'ps']
+ set result [child msg test.tcl -match b* -verbose 'ps']
list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \
[regexp "Total.+4.+Passed.+0.+Skipped.+3.+Failed.+1" $msg]
} {0 0 1 0 1}
test tcltest-3.3 {tcltest -match 'c*'} {unixOrWin} {
- set result [slave msg test.tcl -match c* -verbose 'ps']
+ set result [child msg test.tcl -match c* -verbose 'ps']
list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \
[regexp "Total.+4.+Passed.+0.+Skipped.+4.+Failed.+0" $msg]
} {0 0 0 1 1}
test tcltest-3.4 {tcltest -match 'a* b*'} {unixOrWin} {
- set result [slave msg test.tcl -match {a* b*} -verbose 'ps']
+ set result [child msg test.tcl -match {a* b*} -verbose 'ps']
list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \
[regexp "Total.+4.+Passed.+1.+Skipped.+2.+Failed.+1" $msg]
} {0 1 1 0 1}
@@ -221,27 +221,27 @@ test tcltest-3.5 {tcltest::match} {
# -skip, [skip]
test tcltest-4.1 {tcltest -skip 'a*'} {unixOrWin} {
- set result [slave msg test.tcl -skip a* -verbose 'ps']
+ set result [child msg test.tcl -skip a* -verbose 'ps']
list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \
[regexp "Total.+4.+Passed.+0.+Skipped.+2.+Failed.+1" $msg]
} {0 0 1 1 1}
test tcltest-4.2 {tcltest -skip 'b*'} {unixOrWin} {
- set result [slave msg test.tcl -skip b* -verbose 'ps']
+ set result [child msg test.tcl -skip b* -verbose 'ps']
list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \
[regexp "Total.+4.+Passed.+1.+Skipped.+2.+Failed.+1" $msg]
} {0 1 0 1 1}
test tcltest-4.3 {tcltest -skip 'c*'} {unixOrWin} {
- set result [slave msg test.tcl -skip c* -verbose 'ps']
+ set result [child msg test.tcl -skip c* -verbose 'ps']
list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \
[regexp "Total.+4.+Passed.+1.+Skipped.+1.+Failed.+2" $msg]
} {0 1 1 0 1}
test tcltest-4.4 {tcltest -skip 'a* b*'} {unixOrWin} {
- set result [slave msg test.tcl -skip {a* b*} -verbose 'ps']
+ set result [child msg test.tcl -skip {a* b*} -verbose 'ps']
list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \
[regexp "Total.+4.+Passed.+0.+Skipped.+3.+Failed.+1" $msg]
} {0 0 0 1 1}
test tcltest-4.5 {tcltest -match 'a* b*' -skip 'b*'} {unixOrWin} {
- set result [slave msg test.tcl -match {a* b*} -skip b* -verbose 'ps']
+ set result [child msg test.tcl -match {a* b*} -skip b* -verbose 'ps']
list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \
[regexp "Total.+4.+Passed.+1.+Skipped.+3.+Failed.+0" $msg]
} {0 1 0 0 1}
@@ -262,12 +262,12 @@ test tcltest-4.6 {tcltest::skip} {
# -constraints, -limitconstraints, [testConstraint],
# $constraintsSpecified, [limitConstraints]
test tcltest-5.1 {tcltest -constraints 'knownBug'} {unixOrWin} {
- set result [slave msg test.tcl -constraints knownBug -verbose 'ps']
+ set result [child msg test.tcl -constraints knownBug -verbose 'ps']
list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \
[regexp "Total.+4.+Passed.+2.+Skipped.+0.+Failed.+2" $msg]
} {0 1 1 1 1}
test tcltest-5.2 {tcltest -constraints 'knownBug' -limitconstraints 1} {unixOrWin} {
- set result [slave msg test.tcl -constraints knownBug -verbose 'p' -limitconstraints 1]
+ set result [child msg test.tcl -constraints knownBug -verbose 'p' -limitconstraints 1]
list $result [regexp a-1.0 $msg] [regexp b-1.0 $msg] [regexp c-1.0 $msg] \
[regexp "Total.+4.+Passed.+1.+Skipped.+3.+Failed.+0" $msg]
} {0 0 0 1 1}
@@ -340,7 +340,7 @@ test tcltest-5.5 {InitConstraints: list of built-in constraints} \
# -outfile, -errfile, [outputChannel], [outputFile], [errorChannel], [errorFile]
set printerror [makeFile {
- package require tcltest
+ package require tcltest 2.5
namespace import ::tcltest::*
puts [outputChannel] "a test"
::tcltest::PrintError "a really short string"
@@ -357,28 +357,28 @@ set printerror [makeFile {
test tcltest-6.1 {tcltest -outfile, -errfile defaults} {
-constraints unixOrWin
-body {
- slave msg $printerror
+ child msg $printerror
return $msg
}
-result {a test.*a really}
-match regexp
}
test tcltest-6.2 {tcltest -outfile a.tmp} {unixOrWin unixExecs} {
- slave msg $printerror -outfile a.tmp
+ child msg $printerror -outfile a.tmp
set result1 [catch {exec grep "a test" a.tmp}]
set result2 [catch {exec grep "a really" a.tmp}]
list [regexp "a test" $msg] [regexp "a really" $msg] \
$result1 $result2 [file exists a.tmp] [file delete a.tmp]
} {0 1 0 1 1 {}}
test tcltest-6.3 {tcltest -errfile a.tmp} {unixOrWin unixExecs} {
- slave msg $printerror -errfile a.tmp
+ child msg $printerror -errfile a.tmp
set result1 [catch {exec grep "a test" a.tmp}]
set result2 [catch {exec grep "a really" a.tmp}]
list [regexp "a test" $msg] [regexp "a really" $msg] \
$result1 $result2 [file exists a.tmp] [file delete a.tmp]
} {1 0 1 0 1 {}}
test tcltest-6.4 {tcltest -outfile a.tmp -errfile b.tmp} {unixOrWin unixExecs} {
- slave msg $printerror -outfile a.tmp -errfile b.tmp
+ child msg $printerror -outfile a.tmp -errfile b.tmp
set result1 [catch {exec grep "a test" a.tmp}]
set result2 [catch {exec grep "a really" b.tmp}]
list [regexp "a test" $msg] [regexp "a really" $msg] \
@@ -463,7 +463,7 @@ test tcltest-6.8 {tcltest::outputFile (implicit outputFile)} {
# -debug, [debug]
# Must use child processes to test -debug because it always writes
# messages to stdout, and we have no way to capture stdout of a
-# slave interp
+# child interp
test tcltest-7.1 {tcltest test.tcl -debug 0} {unixOrWin} {
catch {exec [interpreter] test.tcl -debug 0} msg
regexp "Flags passed into tcltest" $msg
@@ -510,7 +510,7 @@ removeFile test.tcl
# directory tests
set a [makeFile {
- package require tcltest
+ package require tcltest 2.5
tcltest::makeFile {} a.tmp
puts [tcltest::outputChannel] "testdir: [tcltest::testsDirectory]"
exit
@@ -525,7 +525,7 @@ normalizePath normaldirectory
test tcltest-8.1 {tcltest a.tcl -tmpdir a} -constraints unixOrWin -setup {
file delete -force thisdirectorydoesnotexist
} -body {
- slave msg $a -tmpdir thisdirectorydoesnotexist
+ child msg $a -tmpdir thisdirectorydoesnotexist
file exists [file join thisdirectorydoesnotexist a.tmp]
} -cleanup {
file delete -force thisdirectorydoesnotexist
@@ -533,7 +533,7 @@ test tcltest-8.1 {tcltest a.tcl -tmpdir a} -constraints unixOrWin -setup {
test tcltest-8.2 {tcltest a.tcl -tmpdir thisdirectoryisafile} {
-constraints unixOrWin
-body {
- slave msg $a -tmpdir $tdiaf
+ child msg $a -tmpdir $tdiaf
return $msg
}
-result {*not a directory*}
@@ -558,7 +558,7 @@ switch -- $::tcl_platform(platform) {
test tcltest-8.3 {tcltest a.tcl -tmpdir notReadableDir} {
-constraints {unix notRoot}
-body {
- slave msg $a -tmpdir $notReadableDir
+ child msg $a -tmpdir $notReadableDir
return $msg
}
-result {*not readable*}
@@ -574,7 +574,7 @@ testConstraint notFAT [expr {
test tcltest-8.4 {tcltest a.tcl -tmpdir notWriteableDir} {
-constraints {unixOrWin notRoot notFAT}
-body {
- slave msg $a -tmpdir $notWriteableDir
+ child msg $a -tmpdir $notWriteableDir
return $msg
}
-result {*not writeable*}
@@ -583,7 +583,7 @@ test tcltest-8.4 {tcltest a.tcl -tmpdir notWriteableDir} {
test tcltest-8.5 {tcltest a.tcl -tmpdir normaldirectory} {
-constraints unixOrWin
-body {
- slave msg $a -tmpdir $normaldirectory
+ child msg $a -tmpdir $normaldirectory
# The join is necessary because the message can be split on multiple
# lines
file exists [file join $normaldirectory a.tmp]
@@ -629,7 +629,7 @@ test tcltest-8.10 {tcltest a.tcl -testdir thisdirectorydoesnotexist} {
file delete -force thisdirectorydoesnotexist
}
-body {
- slave msg $a -testdir thisdirectorydoesnotexist
+ child msg $a -testdir thisdirectorydoesnotexist
return $msg
}
-match glob
@@ -638,7 +638,7 @@ test tcltest-8.10 {tcltest a.tcl -testdir thisdirectorydoesnotexist} {
test tcltest-8.11 {tcltest a.tcl -testdir thisdirectoryisafile} {
-constraints unixOrWin
-body {
- slave msg $a -testdir $tdiaf
+ child msg $a -testdir $tdiaf
return $msg
}
-match glob
@@ -647,7 +647,7 @@ test tcltest-8.11 {tcltest a.tcl -testdir thisdirectoryisafile} {
test tcltest-8.12 {tcltest a.tcl -testdir notReadableDir} {
-constraints {unix notRoot}
-body {
- slave msg $a -testdir $notReadableDir
+ child msg $a -testdir $notReadableDir
return $msg
}
-match glob
@@ -656,7 +656,7 @@ test tcltest-8.12 {tcltest a.tcl -testdir notReadableDir} {
test tcltest-8.13 {tcltest a.tcl -testdir normaldirectory} {
-constraints unixOrWin
-body {
- slave msg $a -testdir $normaldirectory
+ child msg $a -testdir $normaldirectory
# The join is necessary because the message can be split on multiple
# lines
list [string first "testdir: $normaldirectory" [join $msg]] \
@@ -735,7 +735,7 @@ test tcltest-9.1 {-file d*.tcl} -constraints {unixOrWin} -setup {
set old [testsDirectory]
testsDirectory [file dirname [info script]]
} -body {
- slave msg [file join [testsDirectory] all.tcl] -file d*.test
+ child msg [file join [testsDirectory] all.tcl] -file d*.test
return $msg
} -cleanup {
testsDirectory $old
@@ -745,7 +745,7 @@ test tcltest-9.2 {-file d*.tcl} -constraints {unixOrWin} -setup {
set old [testsDirectory]
testsDirectory [file dirname [info script]]
} -body {
- slave msg [file join [testsDirectory] all.tcl] \
+ child msg [file join [testsDirectory] all.tcl] \
-file d*.test -notfile dstring*
regexp {dstring\.test} $msg
} -cleanup {
@@ -784,7 +784,7 @@ test tcltest-9.5 {GetMatchingFiles: Bug 1119798} -setup {
makeFile {} fee $d
file copy [file join [file dirname [info script]] all.tcl] $d
} -body {
- slave msg [file join [temporaryDirectory] all.tcl] -file f*
+ child msg [file join [temporaryDirectory] all.tcl] -file f*
regexp {exiting with errors:} $msg
} -cleanup {
file delete [file join $d all.tcl]
@@ -795,7 +795,7 @@ test tcltest-9.5 {GetMatchingFiles: Bug 1119798} -setup {
# -preservecore, [preserveCore]
set mc [makeFile {
- package require tcltest
+ package require tcltest 2.5
namespace import ::tcltest::test
test makecore {make a core file} {
set f [open core w]
@@ -807,23 +807,23 @@ set mc [makeFile {
cd [temporaryDirectory]
test tcltest-10.1 {-preservecore 0} {unixOrWin} {
- slave msg $mc -preservecore 0
+ child msg $mc -preservecore 0
file delete core
regexp "Core file produced" $msg
} {0}
test tcltest-10.2 {-preservecore 1} {unixOrWin} {
- slave msg $mc -preservecore 1
+ child msg $mc -preservecore 1
file delete core
regexp "Core file produced" $msg
} {1}
test tcltest-10.3 {-preservecore 2} {unixOrWin} {
- slave msg $mc -preservecore 2
+ child msg $mc -preservecore 2
file delete core
list [regexp "Core file produced" $msg] [regexp "Moving file to" $msg] \
[regexp "core-" $msg] [file delete core-makecore]
} {1 1 1 {}}
test tcltest-10.4 {-preservecore 3} {unixOrWin} {
- slave msg $mc -preservecore 3
+ child msg $mc -preservecore 3
file delete core
list [regexp "Core file produced" $msg] [regexp "Moving file to" $msg] \
[regexp "core-" $msg] [file delete core-makecore]
@@ -846,7 +846,7 @@ removeFile makecore.tcl
# -load, -loadfile, [loadScript], [loadFile]
set contents {
- package require tcltest
+ package require tcltest 2.5
namespace import tcltest::*
puts [outputChannel] $::tcltest::loadScript
exit
@@ -854,7 +854,7 @@ set contents {
set loadfile [makeFile $contents load.tcl]
test tcltest-12.1 {-load xxx} {unixOrWin} {
- slave msg $loadfile -load xxx
+ child msg $loadfile -load xxx
return $msg
} {xxx}
@@ -942,7 +942,7 @@ makeFile {
} single2.test $spd
set allfile [makeFile {
- package require tcltest
+ package require tcltest 2.5
namespace import tcltest::*
testsDirectory [file join [temporaryDirectory] singleprocdir]
runAllTests
@@ -952,7 +952,7 @@ cd [workingDirectory]
test tcltest-14.1 {-singleproc - single process} {
-constraints {unixOrWin}
-body {
- slave msg $allfile -singleproc 0 -tmpdir [temporaryDirectory]
+ child msg $allfile -singleproc 0 -tmpdir [temporaryDirectory]
return $msg
}
-result {Test file error: can't unset .foo.: no such variable}
@@ -962,7 +962,7 @@ test tcltest-14.1 {-singleproc - single process} {
test tcltest-14.2 {-singleproc - multiple process} {
-constraints {unixOrWin}
-body {
- slave msg $allfile -singleproc 1 -tmpdir [temporaryDirectory]
+ child msg $allfile -singleproc 1 -tmpdir [temporaryDirectory]
return $msg
}
-result {single1.test.*single2.test.*all\-single.tcl:.*Total.*0.*Passed.*0.*Skipped.*0.*Failed.*0}
@@ -999,25 +999,25 @@ set dtd1 [makeDirectory dirtestdir2.1 $dtd]
set dtd2 [makeDirectory dirtestdir2.2 $dtd]
set dtd3 [makeDirectory dirtestdir2.3 $dtd]
makeFile {
- package require tcltest
+ package require tcltest 2.5
namespace import -force tcltest::*
testsDirectory [file join [temporaryDirectory] dirtestdir]
runAllTests
} all.tcl $dtd
makeFile {
- package require tcltest
+ package require tcltest 2.5
namespace import -force tcltest::*
testsDirectory [file join [temporaryDirectory] dirtestdir dirtestdir2.1]
runAllTests
} all.tcl $dtd1
makeFile {
- package require tcltest
+ package require tcltest 2.5
namespace import -force tcltest::*
testsDirectory [file join [temporaryDirectory] dirtestdir dirtestdir2.2]
runAllTests
} all.tcl $dtd2
makeFile {
- package require tcltest
+ package require tcltest 2.5
namespace import -force tcltest::*
testsDirectory [file join [temporaryDirectory] dirtestdir dirtestdir2.3]
runAllTests
@@ -1026,7 +1026,7 @@ makeFile {
test tcltest-15.1 {basic directory walking} {
-constraints {unixOrWin}
-body {
- if {[slave msg \
+ if {[child msg \
[file join $dtd all.tcl] \
-tmpdir [temporaryDirectory]] == 1} {
error $msg
@@ -1040,7 +1040,7 @@ test tcltest-15.1 {basic directory walking} {
test tcltest-15.2 {-asidefromdir} {
-constraints {unixOrWin}
-body {
- if {[slave msg \
+ if {[child msg \
[file join $dtd all.tcl] \
-asidefromdir dirtestdir2.3 \
-tmpdir [temporaryDirectory]] == 1} {
@@ -1058,7 +1058,7 @@ Error: No test files remain after applying your match and skip patterns!$}
test tcltest-15.3 {-relateddir, non-existent dir} {
-constraints {unixOrWin}
-body {
- if {[slave msg \
+ if {[child msg \
[file join $dtd all.tcl] \
-relateddir [file join [temporaryDirectory] dirtestdir0] \
-tmpdir [temporaryDirectory]] == 1} {
@@ -1073,7 +1073,7 @@ test tcltest-15.3 {-relateddir, non-existent dir} {
test tcltest-15.4 {-relateddir, subdir} {
-constraints {unixOrWin}
-body {
- if {[slave msg \
+ if {[child msg \
[file join $dtd all.tcl] \
-relateddir dirtestdir2.1 -tmpdir [temporaryDirectory]] == 1} {
error $msg
@@ -1086,7 +1086,7 @@ test tcltest-15.4 {-relateddir, subdir} {
test tcltest-15.5 {-relateddir, -asidefromdir} {
-constraints {unixOrWin}
-body {
- if {[slave msg \
+ if {[child msg \
[file join $dtd all.tcl] \
-relateddir "dirtestdir2.1 dirtestdir2.2" \
-asidefromdir dirtestdir2.2 \
@@ -1147,25 +1147,25 @@ test tcltest-19.1 {TCLTEST_OPTIONS default} -setup {
# set this to { } instead of just {} to get around quirk in
# Windows env handling that removes empty elements from env array.
set ::env(TCLTEST_OPTIONS) { }
- interp create slave1
- slave1 eval [list set argv {-debug 2}]
- slave1 alias puts puts
- interp create slave2
- slave2 alias puts puts
+ interp create child1
+ child1 eval [list set argv {-debug 2}]
+ child1 alias puts puts
+ interp create child2
+ child2 alias puts puts
} -cleanup {
- interp delete slave2
- interp delete slave1
+ interp delete child2
+ interp delete child1
if {$oldoptions eq "none"} {
unset ::env(TCLTEST_OPTIONS)
} else {
set ::env(TCLTEST_OPTIONS) $oldoptions
}
} -body {
- slave1 eval [package ifneeded tcltest [package provide tcltest]]
- slave1 eval tcltest::debug
+ child1 eval [package ifneeded tcltest [package provide tcltest]]
+ child1 eval tcltest::debug
set ::env(TCLTEST_OPTIONS) "-debug 3"
- slave2 eval [package ifneeded tcltest [package provide tcltest]]
- slave2 eval tcltest::debug
+ child2 eval [package ifneeded tcltest [package provide tcltest]]
+ child2 eval tcltest::debug
} -result {^3$} -match regexp -output\
{tcltest::debug\s+= 2.*tcltest::debug\s+= 3}
@@ -1174,7 +1174,7 @@ test tcltest-19.1 {TCLTEST_OPTIONS default} -setup {
cd [temporaryDirectory]
# PrintError
test tcltest-20.1 {PrintError} {unixOrWin} {
- set result [slave msg $printerror]
+ set result [child msg $printerror]
list $result [regexp "Error: a really short string" $msg] \
[regexp " \"quotes\"" $msg] [regexp " \"Path" $msg] \
[regexp " \"Really" $msg] [regexp Problem $msg]
@@ -1385,7 +1385,7 @@ test tcltest-21.12 {
set atd [makeDirectory alltestdir]
makeFile {
- package require tcltest
+ package require tcltest 2.5
namespace import -force tcltest::*
testsDirectory [file join [temporaryDirectory] alltestdir]
runAllTests
@@ -1397,7 +1397,7 @@ makeFile {
error "throw an error"
} error.test $atd
makeFile {
- package require tcltest
+ package require tcltest 2.5
namespace import -force tcltest::*
test foo-1.1 {foo} {
-body { return 1 }
@@ -1407,7 +1407,7 @@ makeFile {
} test.test $atd
# Must use a child process because stdout/stderr parsing can't be
-# duplicated in slave interp.
+# duplicated in child interp.
test tcltest-22.1 {runAllTests} {
-constraints {unixOrWin}
-body {
@@ -1796,7 +1796,7 @@ test tcltest-25.3 {
test tcltest-26.1 {Bug/RFE 1017151} -setup {
makeFile {
- package require tcltest
+ package require tcltest 2.5
set ::errorInfo "Should never see this"
tcltest::test tcltest-26.1.0 {
no errorInfo when only return code mismatch
@@ -1806,7 +1806,7 @@ test tcltest-26.1 {Bug/RFE 1017151} -setup {
tcltest::cleanupTests
} test.tcl
} -body {
- slave msg [file join [temporaryDirectory] test.tcl]
+ child msg [file join [temporaryDirectory] test.tcl]
return $msg
} -cleanup {
removeFile test.tcl
@@ -1816,7 +1816,7 @@ test tcltest-26.1 {Bug/RFE 1017151} -setup {
test tcltest-26.2 {Bug/RFE 1017151} -setup {
makeFile {
- package require tcltest
+ package require tcltest 2.5
set ::errorInfo "Should never see this"
tcltest::test tcltest-26.2.0 {do not mask body errorInfo} -body {
error "body error"
@@ -1826,7 +1826,7 @@ test tcltest-26.2 {Bug/RFE 1017151} -setup {
tcltest::cleanupTests
} test.tcl
} -body {
- slave msg [file join [temporaryDirectory] test.tcl]
+ child msg [file join [temporaryDirectory] test.tcl]
return $msg
} -cleanup {
removeFile test.tcl
diff --git a/tests/tcltests.tcl b/tests/tcltests.tcl
index b0aa054..193ba0a 100644
--- a/tests/tcltests.tcl
+++ b/tests/tcltests.tcl
@@ -1,6 +1,6 @@
#! /usr/bin/env tclsh
-package require tcltest 2.2
+package require tcltest 2.5
namespace import ::tcltest::*
testConstraint exec [llength [info commands exec]]
testConstraint fcopy [llength [info commands fcopy]]
diff --git a/tests/thread.test b/tests/thread.test
index 2524911..0a35d1b 100644
--- a/tests/thread.test
+++ b/tests/thread.test
@@ -12,7 +12,7 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -39,11 +39,11 @@ set threadSuperKillScript {
proc getThreadErrorFromInfo { info } {
set list [split $info \n]
set idx [lsearch -glob $list "*eval*unwound*"]
- if {$idx != -1} then {
+ if {$idx >= 0} then {
return [lindex $list $idx]
}
set idx [lsearch -glob $list "*eval*canceled*"]
- if {$idx != -1} then {
+ if {$idx >= 0} then {
return [lindex $list $idx]
}
return ""; # some other error we do not care about.
@@ -805,7 +805,7 @@ test thread-7.21 {cancel: subst -unwind} -constraints {thread drainEventQueue} -
} -cleanup {
unset -nocomplain ::threadSawError ::threadError ::threadId ::threadIdStarted
} -result {{} 1 1 {eval unwound}}
-test thread-7.22 {cancel: slave interp} -constraints {thread drainEventQueue} -setup {
+test thread-7.22 {cancel: child interp} -constraints {thread drainEventQueue} -setup {
unset -nocomplain ::threadSawError ::threadError ::threadId ::threadIdStarted
} -body {
set serverthread [thread::create -joinable \
@@ -835,7 +835,7 @@ test thread-7.22 {cancel: slave interp} -constraints {thread drainEventQueue} -s
} -cleanup {
unset -nocomplain ::threadSawError ::threadError ::threadId ::threadIdStarted
} -result {{} 1 1 {eval canceled}}
-test thread-7.23 {cancel: slave interp -unwind} -constraints {thread drainEventQueue} -setup {
+test thread-7.23 {cancel: child interp -unwind} -constraints {thread drainEventQueue} -setup {
unset -nocomplain ::threadSawError ::threadError ::threadId ::threadIdStarted
} -body {
set serverthread [thread::create -joinable \
diff --git a/tests/timer.test b/tests/timer.test
index 740d05e..48d88b6 100644
--- a/tests/timer.test
+++ b/tests/timer.test
@@ -13,8 +13,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -568,15 +568,15 @@ test timer-9.1 {AfterCleanupProc procedure} -setup {
} -result {before after2 after4}
test timer-10.1 {Bug 1016167: [after] overwrites imports} -setup {
- interp create slave
- slave eval namespace export after
- slave eval namespace eval foo namespace import ::after
+ interp create child
+ child eval namespace export after
+ child eval namespace eval foo namespace import ::after
} -body {
- slave eval foo::after 1
- slave eval namespace origin foo::after
+ child eval foo::after 1
+ child eval namespace origin foo::after
} -cleanup {
# Bug will cause crash here; would cause failure otherwise
- interp delete slave
+ interp delete child
} -result ::after
test timer-11.1 {Bug 1350291: [after] overflowing 32-bit field} -body {
diff --git a/tests/tm.test b/tests/tm.test
index 001b73e..65629ad 100644
--- a/tests/tm.test
+++ b/tests/tm.test
@@ -6,9 +6,8 @@
# Copyright (c) 2004 by Donal K. Fellows.
# All rights reserved.
-package require Tcl 8.5-
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/trace.test b/tests/trace.test
index 1099f48..3703216 100644
--- a/tests/trace.test
+++ b/tests/trace.test
@@ -11,8 +11,10 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest
-namespace import ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
@@ -2197,11 +2199,11 @@ foo {if {[catch {bar}]} {
}} 2 error leavestep
foo foo 0 error leave}}
-test trace-28.4 {exec traces in slave with 'return -code error'} {
- interp create slave
- interp alias slave traceExecute {} traceExecute
+test trace-28.4 {exec traces in child with 'return -code error'} {
+ interp create child
+ interp alias child traceExecute {} traceExecute
set info {}
- set res [interp eval slave {
+ set res [interp eval child {
set info {}
set res {}
@@ -2229,7 +2231,7 @@ test trace-28.4 {exec traces in slave with 'return -code error'} {
list $res
}]
- interp delete slave
+ interp delete child
lappend res [join $info \n]
} {{error error} {foo foo enter
foo {if {[catch {bar}]} {
diff --git a/tests/unixFCmd.test b/tests/unixFCmd.test
index 08eb664..1ecaeef 100644
--- a/tests/unixFCmd.test
+++ b/tests/unixFCmd.test
@@ -9,8 +9,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/unixFile.test b/tests/unixFile.test
index 8147f48..492e5d0 100644
--- a/tests/unixFile.test
+++ b/tests/unixFile.test
@@ -9,8 +9,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/unixForkEvent.test b/tests/unixForkEvent.test
index d7b86fd..5233496 100644
--- a/tests/unixForkEvent.test
+++ b/tests/unixForkEvent.test
@@ -8,8 +8,10 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
-namespace import -force ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
testConstraint testfork [llength [info commands testfork]]
diff --git a/tests/unixInit.test b/tests/unixInit.test
index ab00b4e..26d4130 100644
--- a/tests/unixInit.test
+++ b/tests/unixInit.test
@@ -10,8 +10,10 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2.2
-namespace import ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
unset -nocomplain path
catch {set oldlang $env(LANG)}
set env(LANG) C
diff --git a/tests/unixNotfy.test b/tests/unixNotfy.test
index 0bd8c69..cdf0519 100644
--- a/tests/unixNotfy.test
+++ b/tests/unixNotfy.test
@@ -10,8 +10,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/unknown.test b/tests/unknown.test
index 6c31c3d..4cad132 100644
--- a/tests/unknown.test
+++ b/tests/unknown.test
@@ -11,8 +11,10 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest 2
-namespace import ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
unset -nocomplain x
catch {rename unknown unknown.old}
diff --git a/tests/unload.test b/tests/unload.test
index 73f1091..815ff31 100644
--- a/tests/unload.test
+++ b/tests/unload.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -156,14 +156,14 @@ test unload-3.3 {unloading of a package that has never been loaded from a safe i
unload [file join $testDir pkga$ext] {} child
} -result {file "*" has never been loaded in this interpreter}
test unload-3.4 {basic unloading of a non-unloadable package from a safe interpreter, with guess for package name} -setup {
- if {[lsearch -index 1 [info loaded child] Pkgb] == -1} {
+ if {[lsearch -index 1 [info loaded child] Pkgb] < 0} {
load [file join $testDir pkgb$ext] pKgB child
}
} -constraints [list $dll $loaded] -returnCodes error -match glob -body {
unload [file join $testDir pkgb$ext] {} child
} -result {file "*" cannot be unloaded under a safe interpreter}
test unload-3.5 {basic unloading of an unloadable package from a safe interpreter, with guess for package name} -setup {
- if {[lsearch -index 1 [info loaded child] Pkgua] == -1} {
+ if {[lsearch -index 1 [info loaded child] Pkgua] < 0} {
load [file join $testDir pkgua$ext] pkgua child
}
} -constraints [list $dll $loaded] -body {
diff --git a/tests/uplevel.test b/tests/uplevel.test
index 2cbea1a..4ee6a34 100644
--- a/tests/uplevel.test
+++ b/tests/uplevel.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -304,7 +304,24 @@ test uplevel-7.3 {var access, LVT in upper level} -setup {
rename foo {}
rename moo {}
} -result {3 3 3}
+
+
+test uplevel-8.0 {
+ string representation isn't generated when there is only one argument
+} -body {
+ set res {}
+ set script [list lindex 5]
+ lappend res [apply {script {
+ uplevel $script
+ }} $script]
+ lappend res [string match {value is a list *no string representation*} [
+ ::tcl::unsupported::representation $script]]
+} -cleanup {
+ unset script
+ unset res
+} -result {5 1}
+
# cleanup
::tcltest::cleanupTests
return
diff --git a/tests/upvar.test b/tests/upvar.test
index a483569..9e44a79 100644
--- a/tests/upvar.test
+++ b/tests/upvar.test
@@ -11,8 +11,8 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/utf.test b/tests/utf.test
index 4112308..3a75726 100644
--- a/tests/utf.test
+++ b/tests/utf.test
@@ -8,8 +8,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest 2
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/util.test b/tests/util.test
index 1d8162c..d8e5507 100644
--- a/tests/util.test
+++ b/tests/util.test
@@ -7,8 +7,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -476,7 +476,7 @@ test util-7.4 {TclPrecTraceProc - write traces, bogus values} -constraints preci
} -result {1 {can't set "tcl_precision": improper value for precision} 12}
# This test always succeeded in the C locale anyway...
-test util-8.1 {TclNeedSpace - correct UTF8 handling} {
+test util-8.1 {TclNeedSpace - correct utf-8 handling} {
# Bug 411825
# Note that this test relies on the fact that
# [interp target] calls on Tcl_AppendElement()
@@ -490,7 +490,7 @@ test util-8.1 {TclNeedSpace - correct UTF8 handling} {
interp delete \u5420
set result
} "\u5420 foo"
-test util-8.2 {TclNeedSpace - correct UTF8 handling} testdstring {
+test util-8.2 {TclNeedSpace - correct utf-8 handling} testdstring {
# Bug 411825
# This tests the same bug as the previous test, but
# should be more future-proof, as the DString
@@ -500,14 +500,14 @@ test util-8.2 {TclNeedSpace - correct UTF8 handling} testdstring {
testdstring element foo
llength [testdstring get]
} 2
-test util-8.3 {TclNeedSpace - correct UTF8 handling} testdstring {
+test util-8.3 {TclNeedSpace - correct utf-8 handling} testdstring {
# Bug 411825 - new variant reported by Dossy Shiobara
testdstring free
testdstring append \u00A0 -1
testdstring element foo
llength [testdstring get]
} 2
-test util-8.4 {TclNeedSpace - correct UTF8 handling} testdstring {
+test util-8.4 {TclNeedSpace - correct utf-8 handling} testdstring {
# Another bug uncovered while fixing 411825
testdstring free
testdstring append {\ } -1
@@ -515,13 +515,13 @@ test util-8.4 {TclNeedSpace - correct UTF8 handling} testdstring {
testdstring element foo
llength [testdstring get]
} 2
-test util-8.5 {TclNeedSpace - correct UTF8 handling} testdstring {
+test util-8.5 {TclNeedSpace - correct utf-8 handling} testdstring {
testdstring free
testdstring append {\\ } -1
testdstring element foo
list [llength [testdstring get]] [string length [testdstring get]]
} {2 6}
-test util-8.6 {TclNeedSpace - correct UTF8 handling} testdstring {
+test util-8.6 {TclNeedSpace - correct utf-8 handling} testdstring {
testdstring free
testdstring append {\\ } -1
testdstring append \{ -1
@@ -818,6 +818,9 @@ test util-9.57 {Tcl_GetIntForIndex} {
test util-9.58 {Tcl_GetIntForIndex} -body {
string index abcd end--0x8000000000000000
} -result {}
+test util-9.59 {Tcl_GetIntForIndex} {
+ string index abcd 0-0x10000000000000000
+} {}
test util-10.1 {Tcl_PrintDouble - rounding} {ieeeFloatingPoint} {
convertDouble 0x0000000000000000
diff --git a/tests/var.test b/tests/var.test
index a5b91f8..72873b7 100644
--- a/tests/var.test
+++ b/tests/var.test
@@ -15,7 +15,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2.2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -1040,15 +1040,15 @@ test var-22.0 {leak in array element unset: Bug a3309d01db} -setup {
} -result 0
test var-22.1 {leak in localVarName intrep: Bug 80304238ac} -setup {
proc doit {} {
- interp create slave
- slave eval {
+ interp create child
+ child eval {
proc doit script {
eval $script
set foo bar
}
doit {foreach foo baz {}}
}
- interp delete slave
+ interp delete child
}
} -constraints memory -body {
set end [getbytes]
diff --git a/tests/while-old.test b/tests/while-old.test
index ee17d0b..eddc025 100644
--- a/tests/while-old.test
+++ b/tests/while-old.test
@@ -13,8 +13,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/while.test b/tests/while.test
index 642ec93..30aff4b 100644
--- a/tests/while.test
+++ b/tests/while.test
@@ -11,7 +11,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/winConsole.test b/tests/winConsole.test
index fdde41c..9075ff3 100644
--- a/tests/winConsole.test
+++ b/tests/winConsole.test
@@ -9,8 +9,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/winDde.test b/tests/winDde.test
index acba304..99ac8af 100644
--- a/tests/winDde.test
+++ b/tests/winDde.test
@@ -10,8 +10,7 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2
- #tcltest::configure -verbose {pass start}
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -43,7 +42,7 @@ proc createChildProcess {ddeServerName args} {
# DDE child server -
#
if {"::tcltest" ni [namespace children]} {
- package require tcltest
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -154,8 +153,8 @@ test winDde-3.5 {DDE request locally} -constraints dde -body {
dde request -binary TclEval self \xe1
} -result "foo\x00"
# Set variable a to A with diaeresis (unicode C4) by relying on the fact
-# that utf8 is sent (e.g. "c3 84" on the wire)
-test winDde-3.6 {DDE request utf8} -constraints dde -body {
+# that utf-8 is sent (e.g. "c3 84" on the wire)
+test winDde-3.6 {DDE request utf-8} -constraints dde -body {
set \xe1 "not set"
dde execute TclEval self "set \xe1 \xc4"
scan [set \xe1] %c
@@ -279,19 +278,19 @@ test winDde-6.6 {DDE remote servername collision force} -constraints {dde stdio}
# -------------------------------------------------------------------------
-test winDde-7.1 {Load DDE in slave interpreter} -constraints dde -setup {
- interp create slave
+test winDde-7.1 {Load DDE in child interpreter} -constraints dde -setup {
+ interp create child
} -body {
- slave eval [list load $::ddelib Dde]
- slave eval [list dde servername -- dde-interp-7.1]
+ child eval [list load $::ddelib Dde]
+ child eval [list dde servername -- dde-interp-7.1]
} -cleanup {
- interp delete slave
+ interp delete child
} -result {dde-interp-7.1}
-test winDde-7.2 {DDE slave cleanup} -constraints dde -setup {
- interp create slave
- slave eval [list load $::ddelib Dde]
- slave eval [list dde servername -- dde-interp-7.5]
- interp delete slave
+test winDde-7.2 {DDE child cleanup} -constraints dde -setup {
+ interp create child
+ child eval [list load $::ddelib Dde]
+ child eval [list dde servername -- dde-interp-7.5]
+ interp delete child
} -body {
dde services TclEval {}
set s [dde services TclEval {}]
@@ -300,128 +299,128 @@ test winDde-7.2 {DDE slave cleanup} -constraints dde -setup {
set s
}
} -result {}
-test winDde-7.3 {DDE present in slave interp} -constraints dde -setup {
- interp create slave
- slave eval [list load $::ddelib Dde]
- slave eval [list dde servername -- dde-interp-7.3]
+test winDde-7.3 {DDE present in child interp} -constraints dde -setup {
+ interp create child
+ child eval [list load $::ddelib Dde]
+ child eval [list dde servername -- dde-interp-7.3]
} -body {
dde services TclEval dde-interp-7.3
} -cleanup {
- interp delete slave
+ interp delete child
} -result {{TclEval dde-interp-7.3}}
test winDde-7.4 {interp name collision with -force} -constraints dde -setup {
- interp create slave
- slave eval [list load $::ddelib Dde]
- slave eval [list dde servername -- dde-interp-7.4]
+ interp create child
+ child eval [list load $::ddelib Dde]
+ child eval [list dde servername -- dde-interp-7.4]
} -body {
dde servername -force -- dde-interp-7.4
} -cleanup {
- interp delete slave
+ interp delete child
} -result {dde-interp-7.4}
test winDde-7.5 {interp name collision without -force} -constraints dde -setup {
- interp create slave
- slave eval [list load $::ddelib Dde]
- slave eval [list dde servername -- dde-interp-7.5]
+ interp create child
+ child eval [list load $::ddelib Dde]
+ child eval [list dde servername -- dde-interp-7.5]
} -body {
dde servername -- dde-interp-7.5
} -cleanup {
- interp delete slave
+ interp delete child
} -result "dde-interp-7.5 #2"
# -------------------------------------------------------------------------
test winDde-8.1 {Safe DDE load} -constraints dde -setup {
- interp create -safe slave
- slave invokehidden load $::ddelib Dde
+ interp create -safe child
+ child invokehidden load $::ddelib Dde
} -body {
- slave eval dde servername slave
+ child eval dde servername child
} -cleanup {
- interp delete slave
+ interp delete child
} -returnCodes error -result {invalid command name "dde"}
test winDde-8.2 {Safe DDE set servername} -constraints dde -setup {
- interp create -safe slave
- slave invokehidden load $::ddelib Dde
+ interp create -safe child
+ child invokehidden load $::ddelib Dde
} -body {
- slave invokehidden dde servername slave
-} -cleanup {interp delete slave} -result {slave}
+ child invokehidden dde servername child
+} -cleanup {interp delete child} -result {child}
test winDde-8.3 {Safe DDE check handler required for eval} -constraints dde -setup {
- interp create -safe slave
- slave invokehidden load $::ddelib Dde
- slave invokehidden dde servername slave
+ interp create -safe child
+ child invokehidden load $::ddelib Dde
+ child invokehidden dde servername child
} -body {
- catch {dde eval slave set a 1} msg
-} -cleanup {interp delete slave} -result {1}
+ catch {dde eval child set a 1} msg
+} -cleanup {interp delete child} -result {1}
test winDde-8.4 {Safe DDE check that execute is denied} -constraints dde -setup {
- interp create -safe slave
- slave invokehidden load $::ddelib Dde
- slave invokehidden dde servername slave
+ interp create -safe child
+ child invokehidden load $::ddelib Dde
+ child invokehidden dde servername child
} -body {
- slave eval set a 1
- dde execute TclEval slave {set a 2}
- slave eval set a
-} -cleanup {interp delete slave} -result 1
+ child eval set a 1
+ dde execute TclEval child {set a 2}
+ child eval set a
+} -cleanup {interp delete child} -result 1
test winDde-8.5 {Safe DDE check that request is denied} -constraints dde -setup {
- interp create -safe slave
- slave invokehidden load $::ddelib Dde
- slave invokehidden dde servername slave
+ interp create -safe child
+ child invokehidden load $::ddelib Dde
+ child invokehidden dde servername child
} -body {
- slave eval set a 1
- dde request TclEval slave a
+ child eval set a 1
+ dde request TclEval child a
} -cleanup {
- interp delete slave
+ interp delete child
} -returnCodes error -result {remote server cannot handle this command}
test winDde-8.6 {Safe DDE assign handler procedure} -constraints dde -setup {
- interp create -safe slave
- slave invokehidden load $::ddelib Dde
- slave eval {proc DDEACCEPT {cmd} {set ::DDECMD $cmd}}
+ interp create -safe child
+ child invokehidden load $::ddelib Dde
+ child eval {proc DDEACCEPT {cmd} {set ::DDECMD $cmd}}
} -body {
- slave invokehidden dde servername -handler DDEACCEPT slave
-} -cleanup {interp delete slave} -result slave
+ child invokehidden dde servername -handler DDEACCEPT child
+} -cleanup {interp delete child} -result child
test winDde-8.7 {Safe DDE check simple command} -constraints dde -setup {
- interp create -safe slave
- slave invokehidden load $::ddelib Dde
- slave eval {proc DDEACCEPT {cmd} {set ::DDECMD $cmd}}
- slave invokehidden dde servername -handler DDEACCEPT slave
+ interp create -safe child
+ child invokehidden load $::ddelib Dde
+ child eval {proc DDEACCEPT {cmd} {set ::DDECMD $cmd}}
+ child invokehidden dde servername -handler DDEACCEPT child
} -body {
- dde eval slave set x 1
-} -cleanup {interp delete slave} -result {set x 1}
+ dde eval child set x 1
+} -cleanup {interp delete child} -result {set x 1}
test winDde-8.8 {Safe DDE check non-list command} -constraints dde -setup {
- interp create -safe slave
- slave invokehidden load $::ddelib Dde
- slave eval {proc DDEACCEPT {cmd} {set ::DDECMD $cmd}}
- slave invokehidden dde servername -handler DDEACCEPT slave
+ interp create -safe child
+ child invokehidden load $::ddelib Dde
+ child eval {proc DDEACCEPT {cmd} {set ::DDECMD $cmd}}
+ child invokehidden dde servername -handler DDEACCEPT child
} -body {
set s "c:\\Program Files\\Microsoft Visual Studio\\"
- dde eval slave $s
- string equal [slave eval set DDECMD] $s
-} -cleanup {interp delete slave} -result 1
+ dde eval child $s
+ string equal [child eval set DDECMD] $s
+} -cleanup {interp delete child} -result 1
test winDde-8.9 {Safe DDE check command evaluation} -constraints dde -setup {
- interp create -safe slave
- slave invokehidden load $::ddelib Dde
- slave eval {proc DDEACCEPT {cmd} {set ::DDECMD [uplevel \#0 $cmd]}}
- slave invokehidden dde servername -handler DDEACCEPT slave
+ interp create -safe child
+ child invokehidden load $::ddelib Dde
+ child eval {proc DDEACCEPT {cmd} {set ::DDECMD [uplevel \#0 $cmd]}}
+ child invokehidden dde servername -handler DDEACCEPT child
} -body {
- dde eval slave set \xe1 1
- slave eval set \xe1
-} -cleanup {interp delete slave} -result 1
+ dde eval child set \xe1 1
+ child eval set \xe1
+} -cleanup {interp delete child} -result 1
test winDde-8.10 {Safe DDE check command evaluation (2)} -constraints dde -setup {
- interp create -safe slave
- slave invokehidden load $::ddelib Dde
- slave eval {proc DDEACCEPT {cmd} {set ::DDECMD [uplevel \#0 $cmd]}}
- slave invokehidden dde servername -handler DDEACCEPT slave
+ interp create -safe child
+ child invokehidden load $::ddelib Dde
+ child eval {proc DDEACCEPT {cmd} {set ::DDECMD [uplevel \#0 $cmd]}}
+ child invokehidden dde servername -handler DDEACCEPT child
} -body {
- dde eval slave [list set x 1]
- slave eval set x
-} -cleanup {interp delete slave} -result 1
+ dde eval child [list set x 1]
+ child eval set x
+} -cleanup {interp delete child} -result 1
test winDde-8.11 {Safe DDE check command evaluation (3)} -constraints dde -setup {
- interp create -safe slave
- slave invokehidden load $::ddelib Dde
- slave eval {proc DDEACCEPT {cmd} {set ::DDECMD [uplevel \#0 $cmd]}}
- slave invokehidden dde servername -handler DDEACCEPT slave
+ interp create -safe child
+ child invokehidden load $::ddelib Dde
+ child eval {proc DDEACCEPT {cmd} {set ::DDECMD [uplevel \#0 $cmd]}}
+ child invokehidden dde servername -handler DDEACCEPT child
} -body {
- dde eval slave [list [list set x 1]]
- slave eval set x
-} -cleanup {interp delete slave} -returnCodes error -result {invalid command name "set x 1"}
+ dde eval child [list [list set x 1]]
+ child eval set x
+} -cleanup {interp delete child} -returnCodes error -result {invalid command name "set x 1"}
# -------------------------------------------------------------------------
@@ -481,7 +480,7 @@ test winDde-9.4 {External safe DDE check null data passing} -constraints {dde st
# -------------------------------------------------------------------------
#cleanup
-#catch {interp delete $slave}; # ensure we clean up the slave.
+#catch {interp delete $child}; # ensure we clean up the child.
file delete -force $::scriptName
::tcltest::cleanupTests
return
diff --git a/tests/winFCmd.test b/tests/winFCmd.test
index 2bce77c..ef62cec 100644
--- a/tests/winFCmd.test
+++ b/tests/winFCmd.test
@@ -10,8 +10,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -384,7 +384,7 @@ proc MakeFiles {dirname} {
set f [open $filename w]
close $f
file stat $filename stat
- if {[set n [lsearch -exact -integer $inodes $stat(ino)]] != -1} {
+ if {[set n [lsearch -exact -integer $inodes $stat(ino)]] >= 0} {
return [list [file join $dirname Test$n] $filename]
}
lappend inodes $stat(ino)
diff --git a/tests/winFile.test b/tests/winFile.test
index b288063..d8d1b7c 100644
--- a/tests/winFile.test
+++ b/tests/winFile.test
@@ -10,11 +10,10 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[catch {package require tcltest 2.0.2}]} {
- puts stderr "Skipping tests in [info script]. tcltest 2.0.2 required."
- return
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
}
-namespace import -force ::tcltest::*
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
diff --git a/tests/winNotify.test b/tests/winNotify.test
index 3e9aa29..0433b4a 100644
--- a/tests/winNotify.test
+++ b/tests/winNotify.test
@@ -10,8 +10,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/winPipe.test b/tests/winPipe.test
index 7e01c5f..0263823 100644
--- a/tests/winPipe.test
+++ b/tests/winPipe.test
@@ -12,8 +12,10 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
-package require tcltest
-namespace import -force ::tcltest::*
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
+ namespace import -force ::tcltest::*
+}
unset -nocomplain path
catch {
diff --git a/tests/winTime.test b/tests/winTime.test
index dbaa14c..19e4c58 100644
--- a/tests/winTime.test
+++ b/tests/winTime.test
@@ -10,8 +10,8 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
-if {[lsearch [namespace children] ::tcltest] == -1} {
- package require tcltest
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/zipfs.test b/tests/zipfs.test
index 2ecbdfa..017193b 100644
--- a/tests/zipfs.test
+++ b/tests/zipfs.test
@@ -11,7 +11,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2.1
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
diff --git a/tests/zlib.test b/tests/zlib.test
index c2f7825..1461c43 100644
--- a/tests/zlib.test
+++ b/tests/zlib.test
@@ -11,7 +11,7 @@
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
if {"::tcltest" ni [namespace children]} {
- package require tcltest 2.1
+ package require tcltest 2.5
namespace import -force ::tcltest::*
}
@@ -920,7 +920,7 @@ test zlib-10.2 "bug #2818131 (mismatch gets)" -constraints {
rename zlibRead {}
} -result {error {invalid block type}}
-test zlib-11.1 "Bug #3390073: mis-appled gzip filtering" -setup {
+test zlib-11.1 "Bug #3390073: mis-applied gzip filtering" -setup {
set file [makeFile {} test.input]
} -constraints zlib -body {
set f [open $file wb]
@@ -934,7 +934,7 @@ test zlib-11.1 "Bug #3390073: mis-appled gzip filtering" -setup {
} -cleanup {
removeFile $file
} -result {1000 0}
-test zlib-11.2 "Bug #3390073: mis-appled gzip filtering" -setup {
+test zlib-11.2 "Bug #3390073: mis-applied gzip filtering" -setup {
set file [makeFile {} test.input]
} -constraints zlib -body {
set f [open $file wb]
@@ -1005,6 +1005,86 @@ test zlib-12.2 {Patrick Dunnigan's issue} -constraints zlib -setup {
removeFile $filesrc
removeFile $filedst
} -result 56
+
+set zlibbinf ""
+proc _zlibbinf {} {
+ # inlined zlib.bin file creator:
+ variable zlibbinf
+ if {$zlibbinf eq ""} {
+ set zlibbinf [makeFile {} test-zlib-13.bin]
+ set f [open $zlibbinf wb]
+ puts -nonewline $f [zlib decompress [binary decode base64 {
+ eJx7e+6s1+EAgYaLjK3ratptGmOck0vT/y/ZujHAd0qJelDBXfUPJ3tfrtLbpX+wOOFHmtn03/tizm
+ /+tXROXU3d203b79p5X6/0cvUyFzTsqOj4sa9r8SrZI5zT7265e2Xzq595Fb9LbpgffVy7cZaJ/d15
+ 4U9L7LLM2vdqut8+aSU/r6q9Ltv6+T9mBhTgIK97bH33m/O1C1eBwf9FDKNgaIDaj9wA+5hToA==
+ }]]
+ close $f
+ }
+ return $zlibbinf
+}
+test zlib-13.1 {Ticket [8af92dfb66] - zlib stream mis-expansion} -constraints zlib -setup {
+ set pathin [_zlibbinf]
+ set chanin [open $pathin rb]
+ set pathout [makeFile {} test-zlib-13.deflated]
+ set chanout [open $pathout wb]
+ zlib push inflate $chanin
+ fcopy $chanin $chanout
+ close $chanin
+ close $chanout
+} -body {
+ file size $pathout
+} -cleanup {
+ removeFile $pathout
+ unset chanin pathin chanout pathout
+} -result 458752
+
+test zlib-13.2 {Ticket [f70ce1fead] - zlib multi-stream expansion} -constraints zlib -setup {
+ # Start from the basic asset
+ set pathin [_zlibbinf]
+ set chanin [open $pathin rb]
+ # Create a multi-stream by copying the asset twice into it.
+ set pathout [makeFile {} test-zlib-13.multi]
+ set chanout [open $pathout wb]
+ fcopy $chanin $chanout
+ seek $chanin 0 start
+ fcopy $chanin $chanout
+ close $chanin
+ close $chanout
+ # The multi-stream file shall be our input
+ set pathin $pathout
+ set chanin [open $pathin rb]
+ # And our destinations
+ set pathout1 [makeFile {} test-zlib-13.multi-1]
+ set pathout2 [makeFile {} test-zlib-13.multi-2]
+} -body {
+ # Decode first stream
+ set chanout [open $pathout1 wb]
+ zlib push inflate $chanin
+ fcopy $chanin $chanout
+ chan pop $chanin
+ close $chanout
+ # Decode second stream
+ set chanout [open $pathout2 wb]
+ zlib push inflate $chanin
+ fcopy $chanin $chanout
+ chan pop $chanin
+ close $chanout
+ #
+ list [file size $pathout1] [file size $pathout2]
+} -cleanup {
+ close $chanin
+ removeFile $pathout
+ removeFile $pathout1
+ removeFile $pathout2
+ unset chanin pathin chanout pathout pathout1 pathout2
+} -result {458752 458752}
+
+if {$zlibbinf ne ""} {
+ removeFile $zlibbinf
+}
+unset zlibbinf
+rename _zlibbinf {}
+
::tcltest::cleanupTests
return