summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2022-11-18 17:53:54 (GMT)
committerdgp <dgp@users.sourceforge.net>2022-11-18 17:53:54 (GMT)
commit3e4ac217aab55243d9096d19d611bfd368a4aa9b (patch)
treef369b7566af49c61906930b6df7dfd74d8dde5db /tests
parent2a1443e0e07d217161b094cf6e550f63ef2cab54 (diff)
downloadtcl-3e4ac217aab55243d9096d19d611bfd368a4aa9b.zip
tcl-3e4ac217aab55243d9096d19d611bfd368a4aa9b.tar.gz
tcl-3e4ac217aab55243d9096d19d611bfd368a4aa9b.tar.bz2
Bring back the common facilities of the tcltests "package", but use a less
fragile method to gain access to them.
Diffstat (limited to 'tests')
-rw-r--r--tests/chanio.test1
-rw-r--r--tests/env.test2
-rw-r--r--tests/exec.test4
-rw-r--r--tests/fileSystemEncoding.test15
-rw-r--r--tests/io.test1
-rw-r--r--tests/ioCmd.test1
-rw-r--r--tests/platform.test1
-rw-r--r--tests/tcltests.tcl3
-rw-r--r--tests/thread.test2
9 files changed, 12 insertions, 18 deletions
diff --git a/tests/chanio.test b/tests/chanio.test
index 0f45819..1c689fb 100644
--- a/tests/chanio.test
+++ b/tests/chanio.test
@@ -34,6 +34,7 @@ namespace eval ::tcl::test::io {
package require -exact Tcltest [info patchlevel]
set ::tcltestlib [lindex [package ifneeded Tcltest [info patchlevel]] 1]
}
+ source [file join [file dirname [info script]] tcltests.tcl]
testConstraint testbytestring [llength [info commands testbytestring]]
testConstraint testchannel [llength [info commands testchannel]]
diff --git a/tests/env.test b/tests/env.test
index 6c46532..bc1d7e9 100644
--- a/tests/env.test
+++ b/tests/env.test
@@ -16,6 +16,8 @@ if {"::tcltest" ni [namespace children]} {
namespace import -force ::tcltest::*
}
+source [file join [file dirname [info script]] tcltests.tcl]
+
# [exec] is required here to see the actual environment received by child
# processes.
proc getenv {} {
diff --git a/tests/exec.test b/tests/exec.test
index 4cc4a05..3c445e8 100644
--- a/tests/exec.test
+++ b/tests/exec.test
@@ -18,10 +18,8 @@ if {"::tcltest" ni [namespace children]} {
package require tcltest 2.5
namespace import -force ::tcltest::*
}
+source [file join [file dirname [info script]] tcltests.tcl]
-# All tests require the "exec" command.
-# Skip them if exec is not defined.
-testConstraint exec [llength [info commands exec]]
# Some skips when running in a macOS CI environment
testConstraint noosxCI [expr {![info exists ::env(MAC_CI)]}]
diff --git a/tests/fileSystemEncoding.test b/tests/fileSystemEncoding.test
index 6561bef..24003b8 100644
--- a/tests/fileSystemEncoding.test
+++ b/tests/fileSystemEncoding.test
@@ -15,20 +15,7 @@ namespace eval ::tcl::test::fileSystemEncoding {
variable fname1 \u767b\u9e1b\u9d72\u6a13
- proc autopath {} {
- global auto_path
- set scriptpath [info script]
- set scriptpathnorm [file dirname [file normalize $scriptpath/...]]
- set dirnorm [file dirname $scriptpathnorm]
- set idx [lsearch -exact $auto_path $dirnorm]
- if {$idx >= 0} {
- set auto_path [lreplace $auto_path[set auto_path {}] $idx $idx {}]
- }
- set auto_path [linsert $auto_path[set auto_path {}] 0 0 $dirnorm]
- }
- autopath
-
- package require tcltests
+ source [file join [file dirname [info script]] tcltests.tcl]
test filesystemEncoding-1.0 {
issue bcd100410465
diff --git a/tests/io.test b/tests/io.test
index cd4c954..ca7bd0c 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -34,6 +34,7 @@ namespace eval ::tcl::test::io {
package require -exact Tcltest [info patchlevel]
set ::tcltestlib [lindex [package ifneeded Tcltest [info patchlevel]] 1]
}
+ source [file join [file dirname [info script]] tcltests.tcl]
testConstraint testbytestring [llength [info commands testbytestring]]
testConstraint testchannel [llength [info commands testchannel]]
diff --git a/tests/ioCmd.test b/tests/ioCmd.test
index 99bb464..d17dce3 100644
--- a/tests/ioCmd.test
+++ b/tests/ioCmd.test
@@ -17,6 +17,7 @@ if {"::tcltest" ni [namespace children]} {
package require tcltest 2.5
namespace import -force ::tcltest::*
}
+source [file join [file dirname [info script]] tcltests.tcl]
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]
diff --git a/tests/platform.test b/tests/platform.test
index 6b775cf..faab6d9 100644
--- a/tests/platform.test
+++ b/tests/platform.test
@@ -10,6 +10,7 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
package require tcltest 2.5
+source [file join [file dirname [info script]] tcltests.tcl]
namespace eval ::tcl::test::platform {
namespace import ::tcltest::testConstraint
diff --git a/tests/tcltests.tcl b/tests/tcltests.tcl
index 58e6bfb..1a473e9 100644
--- a/tests/tcltests.tcl
+++ b/tests/tcltests.tcl
@@ -1,5 +1,8 @@
#! /usr/bin/env tclsh
+# Don't overwrite tcltests facilities already present
+if {[package provide tcltests] ne {}} return
+
package require tcltest 2.5
namespace import ::tcltest::*
diff --git a/tests/thread.test b/tests/thread.test
index 28934a2..92f3a06 100644
--- a/tests/thread.test
+++ b/tests/thread.test
@@ -16,7 +16,7 @@
# be fully finalized, which avoids valgrind "still reachable" reports.
package require tcltest 2.5
-namespace import ::tcltest::*
+source [file join [file dirname [info script]] tcltests.tcl]
::tcltest::loadTestedCommands
catch [list package require -exact Tcltest [info patchlevel]]