diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-11-20 17:51:42 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2022-11-20 17:51:42 (GMT) |
| commit | a1a443ef1d639bba76f8e66f8fa9aae4b4802e4f (patch) | |
| tree | f14659ed7bad541414714dedd7495931b47ebfaa /tests | |
| parent | 797aa89a3070e3e505f1761759a3264ce1628101 (diff) | |
| parent | 66386bc18bd9bde161513ff164561c0e052d35b5 (diff) | |
| download | tcl-a1a443ef1d639bba76f8e66f8fa9aae4b4802e4f.zip tcl-a1a443ef1d639bba76f8e66f8fa9aae4b4802e4f.tar.gz tcl-a1a443ef1d639bba76f8e66f8fa9aae4b4802e4f.tar.bz2 | |
Merge 8.7
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/chanio.test | 1 | ||||
| -rw-r--r-- | tests/dstring.test | 39 | ||||
| -rw-r--r-- | tests/env.test | 2 | ||||
| -rw-r--r-- | tests/exec.test | 4 | ||||
| -rw-r--r-- | tests/fileSystemEncoding.test | 15 | ||||
| -rw-r--r-- | tests/io.test | 1 | ||||
| -rw-r--r-- | tests/ioCmd.test | 1 | ||||
| -rw-r--r-- | tests/platform.test | 2 | ||||
| -rw-r--r-- | tests/regexp.test | 2 | ||||
| -rw-r--r-- | tests/string.test | 3 | ||||
| -rw-r--r-- | tests/tcltests.tcl | 3 | ||||
| -rw-r--r-- | tests/thread.test | 3 | ||||
| -rw-r--r-- | tests/winDde.test | 2 |
13 files changed, 55 insertions, 23 deletions
diff --git a/tests/chanio.test b/tests/chanio.test index 691a2c0..49ac471 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -39,6 +39,7 @@ namespace eval ::tcl::test::io { package require -exact tcl::test [info patchlevel] set ::tcltestlib [info loaded {} Tcltest] } + 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/dstring.test b/tests/dstring.test index 11c5754..314cee8 100644 --- a/tests/dstring.test +++ b/tests/dstring.test @@ -473,6 +473,45 @@ test dstring-6.5 {Tcl_DStringGetResult} -constraints testdstring -body { } -cleanup { testdstring free } -result {{} {This is a specially-allocated stringz}} + +test dstring-7.1 {copying to Tcl_Obj} -constraints testdstring -setup { + testdstring free +} -body { + testdstring append xyz -1 + list [testdstring toobj] [testdstring length] +} -cleanup { + testdstring free +} -result {xyz 0} +test dstring-7.2 {copying to a Tcl_Obj} -constraints testdstring -setup { + testdstring free + unset -nocomplain a +} -body { + foreach l {a b c d e f g h i j k l m n o p} { + testdstring append $l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l$l\n -1 + } + set a [testdstring toobj] + testdstring append abc -1 + list $a [testdstring get] +} -cleanup { + testdstring free +} -result {{aaaaaaaaaaaaaaaaaaaaa +bbbbbbbbbbbbbbbbbbbbb +ccccccccccccccccccccc +ddddddddddddddddddddd +eeeeeeeeeeeeeeeeeeeee +fffffffffffffffffffff +ggggggggggggggggggggg +hhhhhhhhhhhhhhhhhhhhh +iiiiiiiiiiiiiiiiiiiii +jjjjjjjjjjjjjjjjjjjjj +kkkkkkkkkkkkkkkkkkkkk +lllllllllllllllllllll +mmmmmmmmmmmmmmmmmmmmm +nnnnnnnnnnnnnnnnnnnnn +ooooooooooooooooooooo +ppppppppppppppppppppp +} abc} + # cleanup if {[testConstraint testdstring]} { diff --git a/tests/env.test b/tests/env.test index b36b049..bf3d9a1 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 e8ba6b2..3e25360 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 c9d36d2..f47635d 100644 --- a/tests/fileSystemEncoding.test +++ b/tests/fileSystemEncoding.test @@ -15,20 +15,7 @@ namespace eval ::tcl::test::fileSystemEncoding { variable fname1 登鸛鵲樓 - 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 d5a39c7..497c6ba 100644 --- a/tests/io.test +++ b/tests/io.test @@ -34,6 +34,7 @@ namespace eval ::tcl::test::io { package require -exact tcl::test [info patchlevel] set ::tcltestlib [info loaded {} Tcltest] } + 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 0e6a8e9..690b196 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 tcl::test [info patchlevel]] diff --git a/tests/platform.test b/tests/platform.test index b5fd405..33aea3a 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 @@ -22,7 +23,6 @@ namespace eval ::tcl::test::platform { ::tcltest::loadTestedCommands catch [list package require -exact tcl::test [info patchlevel]] -package require tcltests testConstraint testCPUID [llength [info commands testcpuid]] testConstraint testlongsize [llength [info commands testlongsize]] diff --git a/tests/regexp.test b/tests/regexp.test index 2737583..b06c163 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -17,7 +17,7 @@ if {"::tcltest" ni [namespace children]} { } unset -nocomplain foo -package require tcltests +source [file join [file dirname [info script]] tcltests.tcl] testConstraint exec [llength [info commands exec]] # Used for constraining memory leak tests diff --git a/tests/string.test b/tests/string.test index 8769556..045d466 100644 --- a/tests/string.test +++ b/tests/string.test @@ -19,7 +19,8 @@ if {"::tcltest" ni [namespace children]} { ::tcltest::loadTestedCommands catch [list package require -exact tcl::test [info patchlevel]] -package require tcltests +source [file join [file dirname [info script]] tcltests.tcl] + # Helper commands to test various optimizations, code paths, and special cases. proc makeByteArray {s} {binary format a* $s} diff --git a/tests/tcltests.tcl b/tests/tcltests.tcl index cc0d6a7..a2251bf 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::* testConstraint exec [llength [info commands exec]] diff --git a/tests/thread.test b/tests/thread.test index 22c1a4f..636d7a8 100644 --- a/tests/thread.test +++ b/tests/thread.test @@ -20,11 +20,10 @@ if {"::tcltest" ni [namespace children]} { # 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 tcl::test [info patchlevel]] -package require tcltests # Some tests require the testthread command diff --git a/tests/winDde.test b/tests/winDde.test index ad21426..c56d27d 100644 --- a/tests/winDde.test +++ b/tests/winDde.test @@ -13,7 +13,7 @@ if {"::tcltest" ni [namespace children]} { package require tcltest 2.5 namespace import -force ::tcltest::* } -package require tcltests +source [file join [file dirname [info script]] tcltests.tcl] testConstraint dde 0 if {[testConstraint win]} { |
