summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/appendComp.test2
-rw-r--r--tests/bigdata.test1089
-rw-r--r--tests/chanio.test39
-rw-r--r--tests/clock.test2
-rw-r--r--tests/cmdAH.test4
-rw-r--r--tests/cmdIL.test3
-rw-r--r--tests/cmdMZ.test4
-rw-r--r--tests/compile.test2
-rw-r--r--tests/dict.test2
-rw-r--r--tests/encoding.test48
-rw-r--r--tests/env.test8
-rw-r--r--tests/error.test2
-rw-r--r--tests/eval.test4
-rw-r--r--tests/event.test2
-rw-r--r--tests/exec.test4
-rw-r--r--tests/fCmd.test34
-rw-r--r--tests/fileName.test60
-rw-r--r--tests/fileSystem.test10
-rw-r--r--tests/for.test4
-rw-r--r--tests/http.test2
-rw-r--r--tests/indexObj.test11
-rw-r--r--tests/internals.tcl2
-rw-r--r--tests/interp.test8
-rw-r--r--tests/io.test322
-rw-r--r--tests/ioCmd.test21
-rw-r--r--tests/ioTrans.test6
-rw-r--r--tests/iogt.test4
-rw-r--r--tests/listObj.test9
-rw-r--r--tests/lsearch.test3
-rw-r--r--tests/lseq.test72
-rw-r--r--tests/mathop.test2
-rw-r--r--tests/msgcat.test8
-rw-r--r--tests/ooNext2.test2
-rw-r--r--tests/pkgMkIndex.test4
-rw-r--r--tests/remote.tcl2
-rw-r--r--tests/resolver.test2
-rw-r--r--tests/safe-stock.test4
-rw-r--r--tests/safe.test4
-rw-r--r--tests/scan.test8
-rw-r--r--tests/socket.test16
-rw-r--r--tests/stringObj.test28
-rw-r--r--tests/tcltest.test28
-rw-r--r--tests/tcltests.tcl12
-rw-r--r--tests/unixFCmd.test6
-rw-r--r--tests/unixForkEvent.test2
-rw-r--r--tests/winConsole.test2
-rw-r--r--tests/winDde.test6
-rw-r--r--tests/winFCmd.test2
-rw-r--r--tests/zlib.test4
49 files changed, 1661 insertions, 264 deletions
diff --git a/tests/appendComp.test b/tests/appendComp.test
index 66f2a5c..121b704 100644
--- a/tests/appendComp.test
+++ b/tests/appendComp.test
@@ -384,7 +384,7 @@ test appendComp-8.1 {defer error to runtime} -setup {
# patch (no read traces run for lappend, append). The compiled tests are
# failing for lappend (9.0/1) before the patch, showing how it invokes read
# traces in the compiled path. The append tests are good (9.2/3). After the
-# patch the failues are gone.
+# patch the failures are gone.
test appendComp-9.0 {bug 3057639, lappend compiled, read trace on non-existing array variable element} -setup {
unset -nocomplain myvar
diff --git a/tests/bigdata.test b/tests/bigdata.test
new file mode 100644
index 0000000..a1ccd32
--- /dev/null
+++ b/tests/bigdata.test
@@ -0,0 +1,1089 @@
+# Test cases for large sized data
+#
+# Copyright © 2023 Ashok P. Nadkarni
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+
+# These are very rudimentary tests for large size arguments to commands.
+# They do not exercise all possible code paths such as shared/unshared Tcl_Objs,
+# literal/variable arguments etc.
+# They do however test compiled and uncompiled execution.
+
+if {"::tcltest" ni [namespace children]} {
+ package require tcltest
+
+ namespace import -force ::tcltest::*
+}
+
+::tcltest::loadTestedCommands
+catch [list package require -exact tcl::test [info patchlevel]]
+source [file join [file dirname [info script]] tcltests.tcl]
+
+#
+# bigtest and bigtestRO (RO->read only) generate compiled and uncompiled
+# versions of the given test script. The difference between the two is
+# that bigtest generates separate test instances for the two cases while
+# bigtestRO generates a single test case covering both. The latter can
+# only be used when operands are not modified and when combining tests
+# does not consume too much additional memory.
+
+# Wrapper to generate compiled and uncompiled cases for a test. If $args does
+# not contain a -body key, $comment is treated as the test body
+proc bigtest {id comment result args} {
+ if {[dict exists $args -body]} {
+ set body [dict get $args -body]
+ dict unset args -body
+ } else {
+ set body $comment
+ }
+ dict lappend args -constraints bigdata
+
+ uplevel 1 [list test $id.uncompiled "$comment (uncompiled)" \
+ -body [list testevalex $body] \
+ -result $result \
+ {*}$args]
+
+ uplevel 1 [list test $id.compiled-script "$comment (compiled script)" \
+ -body [list try $body] \
+ -result $result \
+ {*}$args]
+
+ return
+
+ # TODO - is this proc compilation required separately from the compile-script above?
+ dict append args -setup \n[list proc testxproc {} $body]
+ dict append args -cleanup "\nrename testxproc {}"
+ uplevel 1 [list test $id.compiled-proc "$comment (compiled proc)" \
+ -body {testxproc} \
+ -result $result \
+ {*}$args]
+}
+
+# Like bigtest except that both compiled and uncompiled are combined into one
+# test using the same inout argument. This saves time but for obvious reasons
+# should only be used when the input argument is not modified.
+proc bigtestRO {id comment result args} {
+ if {[dict exists $args -body]} {
+ set body [dict get $args -body]
+ dict unset args -body
+ } else {
+ set body $comment
+ }
+ dict lappend args -constraints bigdata
+
+ set wrapper ""
+ set body "{$body}"
+ append wrapper "set uncompiled_result \[testevalex $body]" \n
+ append wrapper "set compiled_result \[try $body]" \n
+ append wrapper {list $uncompiled_result $compiled_result}
+ uplevel 1 [list test $id.uncompiled,compiled {$comment} \
+ -body $wrapper \
+ -result [list $result $result] \
+ {*}$args]
+ return
+}
+
+interp alias {} bigClean {} unset -nocomplain s s1 s2 bin bin1 bin2 l l1 l2
+
+interp alias {} bigString {} testbigdata string
+interp alias {} bigBinary {} testbigdata bytearray
+interp alias {} bigList {} testbigdata list
+proc bigPatLen {} {
+ proc bigPatLen {} "return [string length [testbigdata string]]"
+ bigPatLen
+}
+
+# Returns list of expected elements at the indices specified
+proc bigStringIndices {indices} {
+ set pat [testbigdata string]
+ set patlen [string length $pat]
+ lmap idx $indices {
+ string index $pat [expr {$idx%$patlen}]
+ }
+}
+
+# Returns the largest multiple of the pattern length that is less than $limit
+proc bigPatlenMultiple {limit} {
+ set patlen [bigPatLen]
+ return [expr {($limit/$patlen)*$patlen}]
+}
+
+set ::bigLengths(intmax) 0x7fffffff
+set ::bigLengths(uintmax) 0xffffffff
+# Some tests are more convenient if operands are multiple of pattern length
+set ::bigLengths(patlenmultiple) [bigPatlenMultiple $::bigLengths(intmax)]
+set ::bigLengths(upatlenmultiple) [bigPatlenMultiple $::bigLengths(uintmax)]
+
+#
+# string cat
+bigtest string-cat-bigdata-1 "string cat large small result > INT_MAX" 1 -body {
+ string equal \
+ [string cat [bigString $::bigLengths(patlenmultiple)] [bigString]] \
+ [bigString [expr {[bigPatLen]+$::bigLengths(patlenmultiple)}]]
+}
+bigtest string-cat-bigdata-2 "string cat small large result > INT_MAX" 1 -body {
+ string equal \
+ [string cat [bigString] [bigString $::bigLengths(patlenmultiple)]] \
+ [bigString [expr {[bigPatLen]+$::bigLengths(patlenmultiple)}]]
+}
+bigtest string-cat-bigdata-3 "string cat result > UINT_MAX" 1 -body {
+ set s [bigString $::bigLengths(patlenmultiple)]
+ string equal \
+ [string cat $s [bigString] $s] \
+ [bigString [expr {[bigPatLen]+2*$::bigLengths(patlenmultiple)}]]
+}
+
+#
+# string compare/equal
+bigtestRO string-equal/compare-bigdata-1 "string compare/equal equal strings" {0 1} -body {
+ list [string compare $s1 $s2] [string equal $s1 $s2]
+} -setup {
+ set s1 [bigString 0x100000000]
+ set s2 [bigString 0x100000000]; # Separate so Tcl_Obj is not the same
+} -cleanup {
+ bigClean
+}
+bigtestRO string-equal/compare-bigdata-2 "string compare/equal -length unequal strings" {-1 0 0 1} -body {
+ # Also tests lengths do not wrap
+ set result {}
+ lappend result [string compare $s1 $s2]
+ lappend result [string equal $s1 $s2]
+ # Check lengths > UINT_MAX
+ # Also that lengths do not truncate to sizeof(int)
+ lappend result [string compare -length 0x100000000 $s1 $s2]
+ lappend result [string equal -length 0x100000000 $s1 $s2]
+} -setup {
+ set s1 [bigString 0x100000001]
+ set s2 [bigString 0x100000001 0x100000000]; # Differs in last char
+} -cleanup {
+ bigClean
+}
+# -constraints bug-a814ee5bbd
+
+#
+# string first
+bigtestRO string-first-bigdata-1 "string first > INT_MAX" {2147483648 -1 2147483650 1} -body {
+ list \
+ [string first X $s] \
+ [string first Y $s] \
+ [string first 0 $s 0x80000000] \
+ [string first 1 $s end-0x80000010]
+} -setup {
+ set s [bigString 0x8000000a 0x80000000]
+} -cleanup {
+ bigClean
+} -constraints bug-a814ee5bbd
+
+bigtestRO string-first-bigdata-2 "string first > UINT_MAX" {4294967296 -1 4294967300 1} -body {
+ list \
+ [string first X $s] \
+ [string first Y $s] \
+ [string first 0 $s 0x100000000] \
+ [string first 1 $s end-0x100000010]
+} -setup {
+ set s [bigString 0x10000000a 0x100000000]
+} -cleanup {
+ bigClean
+} -constraints bug-a814ee5bbd
+
+bigtestRO string-first-bigdata-3 "string first - long needle" 10 -body {
+ string first $needle $s
+} -setup {
+ set s [bigString 0x10000000a 0]
+ set needle [bigString 0x100000000]
+} -cleanup {
+ bigClean needle
+} -constraints bug-a814ee5bbd
+
+#
+# string index
+bigtestRO string-index-bigdata-1 "string index" {6 7 5 {} 5 4 {} 9 {}} -body {
+ list \
+ [string index $s 0x100000000] \
+ [string index $s 0x100000000+1] \
+ [string index $s 0x100000000-1] \
+ [string index $s 0x10000000a] \
+ [string index $s end] \
+ [string index $s end-1] \
+ [string index $s end+1] \
+ [string index $s end-0x100000000] \
+ [string index $s end-0x10000000a]
+} -setup {
+ set s [bigString 0x10000000a]
+} -cleanup {
+ bigClean
+}
+
+#
+# string insert
+bigtestRO string-insert-bigdata-1 "string insert" 1 -body {
+ # Note insert at multiple of 10 to enable comparison against generated string
+ string equal [string insert [bigString 4294967312] 4294967310 "0123456789"] [bigString 4294967322]
+}
+bigtestRO string-insert-bigdata-2 "string insert" 1 -body {
+ string equal [string insert [bigString 4294967312] 10 "0123456789"] [bigString 4294967322]
+}
+
+#
+# string is
+bigtestRO string-is-bigdata-1 "string is" {1 0 0 4294967296} -body {
+ # TODO - add the other "is" classes
+ unset -nocomplain failat result
+ lappend result [string is alnum -failindex failat $s] [info exists failat]
+ lappend result [string is digit -failindex failat $s] $failat
+} -setup {
+ set s [bigString 0x10000000a 0x100000000]
+} -cleanup {
+ bigClean failat
+}
+
+#
+# string last
+bigtestRO string-last-bigdata-1 "string last > INT_MAX" {2 -1 2147483640 11} -body {
+ set s [bigString 0x80000010 2]
+ list \
+ [string last X $s] \
+ [string last Y $s] \
+ [string last 0 $s 0x80000000] \
+ [string last 1 $s end-0x80000000]
+} -setup {
+ set s [bigString 0x80000010 2]
+} -cleanup {
+ bigClean
+} -constraints bug-a814ee5bbd
+
+bigtestRO string-last-bigdata-2 "string last > UINT_MAX" {4294967300 -1 4294967290 1} -body {
+ list \
+ [string last 0 $s] \
+ [string last Y $s] \
+ [string last 0 $s 0x100000000] \
+ [string last 1 $s end-0x100000010]
+} -setup {
+ set s [bigString 0x10000000a 2]
+} -cleanup {
+ bigClean
+} -constraints bug-a814ee5bbd
+
+bigtestRO string-last-bigdata-3 "string last - long needle" 0 -body {
+ string last $needle $s
+} -setup {
+ set s [bigString 0x10000000a 0x10000000a]
+ set needle [bigString 0x100000000]
+} -cleanup {
+ bigClean needle
+} -constraints bug-a814ee5bbd
+
+#
+# string length
+bigtestRO string-length-bigdata-1 {string length $s} 4294967296 -setup {
+ set s [bigString 0x100000000]
+} -cleanup {
+ bigClean
+}
+
+#
+# string map
+bigtestRO string-map-bigdata-1 {string map} {5 0 0 5} -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain s2
+ set s2 [string map {0 5 5 0} $s]
+ list \
+ [string index $s2 0] \
+ [string index $s2 5] \
+ [string index $s2 end] \
+ [string index $s2 end-5]
+} -setup {
+ set s [bigString 0x100000000]
+} -cleanup {
+ bigClean
+} -constraints bug-takesTooLong
+
+#
+# string match
+bigtestRO string-match-bigdata-1 {string match} {1 0 1} -body {
+ list \
+ [string match 0*5 $s] \
+ [string match 0*4 $s] \
+ [string match $s $s]
+} -setup {
+ set s [bigString 0x100000000]
+} -cleanup {
+ bigClean
+}
+
+#
+# string range
+bigtestRO string-range-bigdata-1 "string range" {6 7 5 {} 5 4 {} 9 {}} -body {
+ list \
+ [string range $s 0x100000000 0x100000000] \
+ [string range $s 0x100000000+1 0x100000000+1] \
+ [string range $s 0x100000000-1 0x100000000-1] \
+ [string range $s 0x10000000a 0x10000000a] \
+ [string range $s end end] \
+ [string range $s end-1 end-1] \
+ [string range $s end+1 end+1] \
+ [string range $s end-0x100000000 end-0x100000000] \
+ [string range $s end-0x10000000a end-0x10000000a]
+} -setup {
+ set s [bigString 0x10000000a]
+} -cleanup {
+ bigClean
+} -constraints bug-ad9361fd20f0
+# TODO - once above bug is fixed, add tests for large result range
+
+#
+# string repeat - use bigtest, not bigtestRO !!
+bigtest string-repeat-bigdata-1 "string repeat single char length > UINT_MAX" 4294967296 -body {
+ string length [string repeat x 0x100000000]
+}
+bigtest string-repeat-bigdata-2 "string repeat multiple char" {4294967296 0123456789abcdef 0123456789abcdef} -body {
+ set s [string repeat 0123456789abcdef [expr 0x100000000/16]]
+ list \
+ [string length $s] \
+ [string range $s 0 15] \
+ [string range $s end-15 end]
+} -cleanup {
+ bigClean
+}
+
+#
+# string replace
+bigtestRO string-replace-bigdata-1 "string replace" {789012345 012345678 XYZ789012345 012345678XYZ} -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain result
+ lappend result [string replace $s 0 0x100000000]
+ lappend result [string replace $s end-0x100000000 end]
+ lappend result [string replace $s 0 0x100000000 XYZ]
+ lappend result [string replace $s end-0x100000000 end XYZ]
+} -setup {
+ set s [bigString 0x10000000a]
+} -cleanup {
+ bigClean
+}
+# TODO -
+# - replacements string is large
+# - replace in the middle - string length grows, shrinks
+# - last < first
+
+#
+# string reverse
+bigtestRO string-reverse-bigdata-1 "string reverse" {5432109876 9876543210} -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain s2 result
+ set s2 [string reverse $s]
+ list [string range $s2 0 9] [string range $s2 end-9 end]
+} -setup {
+ set s [bigString 0x10000000a]
+} -cleanup {
+ bigClean
+}
+
+#
+# string tolower
+bigtestRO string-tolower-bigdata-1 "string tolower" 1 -body {
+ string equal [string tolower $s] [string repeat abcd $repts]
+} -setup {
+ set repts [expr 0x100000010/4]
+ set s [string repeat ABCD $repts]
+} -cleanup {
+ bigClean repts
+}
+bigtestRO string-tolower-bigdata-2 "string tolower first last" {4294967312 ABCDabcdABCD 4294967312 ABCDabcdABCD 4294967312 ABCDabcdABCD} -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain s2 result
+ set s2 [string tolower $s 4 7]
+ lappend result [string length $s2] [string range $s2 0 11]
+
+ unset s2; #Explicit free to reduce total memory
+ set s2 [string tolower $s 0x100000008 0x10000000b]
+ lappend result [string length $s2] [string range $s2 0x100000004 end]
+
+ unset s2; #Explicit free to reduce total memory
+ set s2 [string tolower $s end-7 end-4]
+ lappend result [string length $s2] [string range $s2 0x100000004 end]
+} -setup {
+ set repts [expr 0x100000010/4]
+ set s [string repeat ABCD $repts]
+} -cleanup {
+ bigClean repts
+}
+
+#
+# string totitle
+bigtestRO string-totitle-bigdata-1 "string totitle first last" {4294967312 aBcDAbcdaBcD 4294967312 aBcDAbcdaBcD 4294967312 aBcDAbcdaBcD} -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain s2 result
+ set s2 [string totitle $s 4 7]
+ lappend result [string length $s2] [string range $s2 0 11]
+ unset s2; #Explicit free to reduce total memory
+ set s2 [string totitle $s 0x100000008 0x10000000b]
+ lappend result [string length $s2] [string range $s2 0x100000004 0x10000000f]
+ unset s2; #Explicit free to reduce total memory
+ set s2 [string totitle $s end-7 end-4]
+ lappend result [string length $s2] [string range $s2 0x100000004 0x10000000f]
+} -setup {
+ set repts [expr 0x100000010/4]
+ set s [string repeat aBcD $repts]
+} -cleanup {
+ bigClean repts
+}
+
+#
+# string toupper
+bigtestRO string-toupper-bigdata-1 "string toupper" 1 -body {
+ string equal [string toupper $s] [string repeat ABCD $repts]
+} -setup {
+ set repts [expr 0x100000010/4]
+ set s [string repeat abcd $repts]
+} -cleanup {
+ bigClean repts
+}
+bigtestRO string-toupper-bigdata-2 "string toupper first last" {4294967312 abcdABCDabcd 4294967312 abcdABCDabcd 4294967312 abcdABCDabcd} -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain s2 result
+ set s2 [string toupper $s 4 7]
+ lappend result [string length $s2] [string range $s2 0 11]
+ unset s2; #Explicit free to reduce total memory
+ set s2 [string toupper $s 0x100000008 0x10000000b]
+ lappend result [string length $s2] [string range $s2 0x100000004 0x10000000f]
+ unset s2; #Explicit free to reduce total memory
+ set s2 [string toupper $s end-7 end-4]
+ lappend result [string length $s2] [string range $s2 0x100000004 0x10000000f]
+} -setup {
+ set repts [expr 0x100000010/4]
+ set s [string repeat abcd $repts]
+} -cleanup {
+ bigClean repts
+}
+
+#
+# string trim
+bigtestRO string-trim-bigdata-1 "string trim" {abcdyxxy yxxyabcd} -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain s2
+ set s2 [string trim $s xy]
+ list [string range $s2 0 7] [string range $s2 end-7 end]
+} -setup {
+ set repts [expr 0x100000010/8]
+ set s [string repeat xyabcdyx $repts]
+} -cleanup {
+ bigClean
+}
+
+#
+# string trimleft
+bigtestRO string-trimleft-bigdata-1 "string trimleft" {abcdyxxy xyabcdyx} -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain s2
+ set s2 [string trimleft $s xy]
+ list [string range $s2 0 7] [string range $s2 end-7 end]
+} -setup {
+ set repts [expr 0x100000010/8]
+ set s [string repeat xyabcdyx $repts]
+} -cleanup {
+ bigClean
+}
+
+#
+# string trimright
+bigtestRO string-trimright-bigdata-1 "string trimright" {xyabcdyx yxxyabcd} -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain s2
+ set s2 [string trimright $s xy]
+ list [string range $s2 0 7] [string range $s2 end-7 end]
+} -setup {
+ set repts [expr 0x100000010/8]
+ set s [string repeat xyabcdyx $repts]
+} -cleanup {
+ bigClean
+}
+
+#
+# append
+bigtestRO append-bigdata-1 "append large to small" 1 -body {
+ set s 0123456789
+ append s [bigString 0x100000000]
+ string equal $s [bigString 0x10000000a]
+} -cleanup {
+ bigClean
+}
+bigtest append-bigdata-2 "append small to cross UINT_MAX boundary" 1 -body {
+ append s 0123456789
+ string equal $s [bigString 4294967300]
+} -setup {
+ set s [bigString 4294967290]
+} -cleanup {
+ bigClean
+}
+bigtest append-bigdata-3 "append small to cross UINT_MAX boundary" 1 -body {
+ set s2 ""
+ append s2 $s $s $s $s
+ string equal $s2 [bigString 4294967320]
+} -setup {
+ # Make length multiple of 4 AND 10 since the bigString pattern length is 10
+ set len [expr 4294967320/4]
+ set s [bigString $len]
+} -cleanup {
+ bigClean
+}
+
+#
+# format
+bigtestRO format-bigdata-1 "format %s" 1 -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain s2
+ set s2 [format %s $s]
+ string equal $s $s2
+} -setup {
+ set s [bigString 0x100000000]
+} -cleanup {
+ bigClean
+}
+bigtest format-bigdata-2 "format bigstring%s" 1 -body {
+ set s [format $s X]
+ string equal $s [bigString 0x100000001 0x100000000]
+} -setup {
+ set s [bigString 0x100000000]
+ append s %s
+} -cleanup {
+ bigClean
+}
+bigtest format-bigdata-3 "format big width" {4294967300 { } { a}} -body {
+ set s [format %4294967300s a]
+ list [string length $s] [string range $s 0 3] [string range $s end-3 end]
+} -cleanup {
+ bigClean
+}
+bigtest format-bigdata-4 "format big negative width" {4294967300 {a } { }} -body {
+ set s [format %-4294967300s a]
+ list [string length $s] [string range $s 0 3] [string range $s end-3 end]
+} -cleanup {
+ bigClean
+}
+bigtest format-bigdata-5 "format big * width" {4294967300 { } { a}} -body {
+ set s [format %*s 4294967300 a]
+ list [string length $s] [string range $s 0 3] [string range $s end-3 end]
+} -cleanup {
+ bigClean
+}
+bigtest format-bigdata-6 "format big negative * width" {4294967300 {a } { }} -body {
+ set s [format %*s -4294967300 a]
+ list [string length $s] [string range $s 0 3] [string range $s end-3 end]
+} -cleanup {
+ bigClean
+}
+bigtestRO format-bigdata-7 "format big precision" {4294967300 0123 6789} -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain s2
+ set s2 [format %.4294967300s $s]
+ list [string length $s2] [string range $s2 0 3] [string range $s2 end-3 end]
+} -setup {
+ set s [testbigdata string 4294967310]
+} -cleanup {
+ bigClean
+}
+bigtestRO format-bigdata-8 "format big * precision" {4294967300 0123 6789} -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain s2
+ set s2 [format %.*s 4294967300 $s]
+ list [string length $s2] [string range $s2 0 3] [string range $s2 end-3 end]
+} -setup {
+ set s [testbigdata string 4294967310]
+} -cleanup {
+ bigClean
+}
+
+#
+# scan
+bigtestRO scan-bigdata-1 "scan %s" {1 1 2 X 1 2 4294967300 01234X} -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain result digits x
+ lappend result [string equal [scan $s %s] $s]
+ lappend result [string equal [scan $s {%[0-9X]}] $s]
+ lappend result [scan $s {%[0-9]%s} digits x] $x
+ lappend result [string equal $digits [bigString 0x100000009]]
+ lappend result [scan $s %4294967300s%s x y]
+ lappend result [string length $x] $y
+} -setup {
+ set s [bigString 0x10000000a 0x100000009]
+} -cleanup {
+ bigClean digits
+}
+
+#
+# regexp
+bigtestRO regexp-bigdata-1 "regexp" 1 -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain result digits
+ lappend result [regexp {[[:digit:]]*X} $s]
+} -setup {
+ set s [bigString 0x100000000 0x100000000]
+} -cleanup {
+ bigClean digits
+}
+bigtestRO regexp-bigdata-2 "regexp with capture" 1 -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain result digits match
+ lappend result [regexp {([[:digit:]])*X} $s match digits] [string equal $match $s]
+ puts B
+ unset match; # Free up memory
+ lappend result [string equal $digits [bigString 0x100000009]]
+} -setup {
+ set s [bigString 0x10000000a 0x100000009]
+} -cleanup {
+ bigClean digits match
+} -constraints bug-takesTooLong
+
+#
+# regsub
+bigtestRO regsub-bigdata-1 "regsub" X -body {
+ regsub -all \\d $s {}
+} -setup {
+ set s [bigString 0x100000001 0x100000000]
+} -cleanup {
+ bigClean
+} -constraints bug-takesTooLong
+bigtestRO regsub-bigdata-2 "regsub" 1 -body {
+ string equal [regsub -all \\d $s x] [string cat [string repeat x 0x100000000] X]
+} -setup {
+ set s [bigString 0x100000001 0x100000000]
+} -cleanup {
+ bigClean
+} -constraints bug-takesTooLong
+
+#
+# subst
+bigtestRO subst-bigdata-1 "subst" {1 1} -body {
+ unset -nocomplain result
+ lappend result [string equal [subst $s] $s]
+ lappend result [string equal [subst {$s}] $s]
+} -setup {
+ set s [bigString 0x10000000a]
+} -cleanup {
+ bigClean
+}
+
+#
+# binary format
+bigtestRO binary-format-bigdata-1 "binary format aN" [list 4294967296 X\0\0\0 \0\0\0\0] -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain bin
+ set bin [binary format a4294967296 X]
+ list [string length $bin] [string range $bin 0 3] [string range $bin end-3 end]
+} -cleanup {
+ bigClean
+}
+# -constraints bug-9369f83649
+# TODO - do string compare and add other format specifiers
+
+bigtestRO binary-format-bigdata-2 "binary format a*" 1 -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain bin2
+ set bin2 [binary format a* $bin]
+ string equal $bin $bin2
+} -setup {
+ set bin [bigBinary 4294967296]
+} -cleanup {
+ bigClean
+}
+
+#
+# binary scan
+bigtestRO binary-scan-bigdata-1 "binary scan aN" {4294967296 0123 2345} -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain bin2
+ binary scan $bin a4294967296 bin2
+ list [string length $bin2] [string range $bin2 0 3] [string range $bin2 end-3 end]
+} -setup {
+ set bin [bigBinary 4294967296]
+} -cleanup {
+ bigClean
+}
+# -constraints bug-9369f83649
+# TODO - do string compare and add other format specifiers once above bug is fixed
+
+bigtestRO binary-scan-bigdata-2 "binary scan a*" 1 -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain bin2
+ binary scan $bin a* bin2
+ string equal $bin $bin2
+} -setup {
+ set bin [bigBinary 4294967296]
+} -cleanup {
+ bigClean
+}
+# TODO - do string compare and add other format specifiers once above bug is fixed
+
+#
+# binary encode / decode base64
+bigtestRO binary-encode/decode-base64-bigdata-1 "binary encode/decode base64" 1 -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ string equal $bin [binary decode base64 [binary encode base64 $bin]]
+} -setup {
+ set bin [bigBinary 4294967296]
+} -cleanup {
+ bigClean
+}
+
+#
+# binary encode / decode hex
+bigtestRO binary-encode/decode-hex-bigdata-1 "binary encode/decode hex" 1 -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ string equal $bin [binary decode hex [binary encode hex $bin]]
+} -setup {
+ set bin [bigBinary 4294967296]
+} -cleanup {
+ bigClean
+}
+
+#
+# binary encode / decode uuencode
+bigtestRO binary-encode/decode-uuencode-bigdata-1 "binary encode/decode uuencode" 1 -body {
+ string equal $bin [binary decode uuencode [binary encode uuencode $bin]]
+} -setup {
+ set bin [bigBinary 4294967296]
+} -cleanup {
+ bigClean
+}
+
+################################################################
+# List commands
+
+#
+# foreach
+bigtestRO foreach-bigdata-1 "foreach" 1 -body {
+ # Unset explicitly before setting as bigtestRO runs the script twice.
+ unset -nocomplain l2
+ foreach x $l {
+ lappend l2 $x
+ }
+ testlutil equal $l $l2
+} -setup {
+ set l [bigList 0x100000000]
+} -cleanup {
+ bigClean
+}
+
+#
+# lappend
+bigtest lappend-bigdata-1 "lappend" {4294967300 4294967300 {1 2 3 4 5 a b c d}} -body {
+ # Do NOT initialize l in a -setup block. That requires more memory and fails.
+ # Do not have enough memory for a full compare.
+ # Just check end
+ set l [bigList 0x100000000]
+ list [llength [lappend l a b c d]] [llength $l] [lrange $l end-8 end]
+} -cleanup {
+ bigClean
+}
+
+#
+# lassign
+bigtestRO lassign-bigdata-1 "lassign" {0 1 2 3 4 5 6 7 8 {9 0 1 2 3 4 5 6 7 8} {6 7 8 9 0 1 2 3 4 5}} -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain l2
+ set l2 [lassign $l a b c d e f g h i]
+ list $a $b $c $d $e $f $g $h $i [lrange $l2 0 9] [lrange $l2 end-9 end]
+} -setup {
+ set l [bigList 0x10000000a]
+} -cleanup {
+ bigClean
+}
+
+#
+# ledit
+bigtest ledit-bigdata-1 "ledit - small result" {{0 X Y Z 8} {0 X Y Z 8}} -body {
+ list [ledit l 1 0x100000001 X Y Z] $l
+} -setup {
+ set l [bigList 0x100000003]
+} -cleanup {
+ bigClean
+}
+
+bigtest ledit-bigdata-2 "ledit - large result" {4294967304 4294967304 {a b c d e f g 7}} -body {
+ # Do NOT initialize l in a -setup block. That requires more memory and fails.
+ set l [bigList 0x100000002]
+ list [llength [ledit l 0x100000000 0x100000000 a b c d e f g]] [llength $l] [lrange $l 0x100000000 end]
+} -cleanup {
+ bigClean
+}
+
+bigtest ledit-bigdata-3 "ledit - small -> large result" {2147483651 2147483651} -body {
+ set l2 {a b c x y z}
+ list [llength [ledit l2 2 3 {*}$l]] [llength $l2]
+} -setup {
+ set l [bigList 2147483647]
+} -cleanup {
+ bigClean
+} -constraints bug-7cddd2845c
+
+#
+# lindex
+bigtestRO lindex-bigdata-1 "lindex" {6 7 5 {} 5 4 {} 9 {}} -body {
+ list \
+ [lindex $l 0x100000000] \
+ [lindex $l 0x100000000+1] \
+ [lindex $l 0x100000000-1] \
+ [lindex $l 0x10000000a] \
+ [lindex $l end] \
+ [lindex $l end-1] \
+ [lindex $l end+1] \
+ [lindex $l end-0x100000000] \
+ [lindex $l end-0x10000000a]
+} -setup {
+ set l [bigList 0x10000000a]
+} -cleanup {
+ bigClean
+} -constraints bug-dcac54a685
+# TODO after bug fix - nested index
+
+#
+# linsert
+# Cannot use bigtestRO here because 16GB memory not enough to have two 4G sized lists
+# Have to throw away source list every time. Also means we cannot compare entire lists
+# and instead just compare the affected range
+bigtest linsert-bigdata-1 "linsert" {4294967330 1} -body {
+ # Note insert at multiple of 10 to enable comparison against generated string
+ set ins [split abcdefghij ""]
+ set pat [split 0123456789 ""]
+ set insidx 2000000000
+ set l [linsert [bigList 4294967320] $insidx {*}$ins]
+ list \
+ [llength $l] \
+ [testlutil equal [lrange $l $insidx-10 $insidx+19] [concat $pat $ins $pat]]
+} -cleanup {
+ bigClean
+}
+
+#
+# list and {*}
+bigtestRO list-bigdata-1 {list {*} } {4294967296 0 4294967295} -body {
+ unset -nocomplain l2
+ set l2 [list {*}$l]
+ list [llength $l2] [lindex $l2 0] [lindex $l2 end]
+} -setup {
+ set l [bigList 0x100000000]
+} -cleanup {
+ bigClean
+} -constraints bug-7cddd2845c
+
+#
+# llength
+bigtestRO llength-bigdata-1 {llength} 4294967296 -body {
+ llength $l
+} -setup {
+ set l [bigList 0x100000000]
+} -cleanup {
+ bigClean
+}
+
+#
+# lmap
+bigtestRO lmap-bigdata-1 "lmap" 4294967296 -body {
+ set n 0
+ if {0} {
+ # TODO - This is the right test but runs out of memory
+ testlutil equal $l [lmap e $l {set e}]
+ } else {
+ lmap e $l {incr n; continue}
+ }
+ set n
+} -setup {
+ set l [bigList 0x100000000]
+} -cleanup {
+ bigClean
+ puts ""
+}
+
+#
+# lrange
+bigtestRO lrange-bigdata-1 "lrange" {6 7 5 {} 5 4 {} 9 {}} -body {
+ list \
+ [lrange $l 0x100000000 0x100000000] \
+ [lrange $l 0x100000000+1 0x100000000+1] \
+ [lrange $l 0x100000000-1 0x100000000-1] \
+ [lrange $l 0x10000000a 0x10000000a] \
+ [lrange $l end end] \
+ [lrange $l end-1 end-1] \
+ [lrange $l end+1 end+1] \
+ [lrange $l end-0x100000000 end-0x100000000] \
+ [lrange $l end-0x10000000a end-0x10000000a]
+} -setup {
+ set l [bigList 0x10000000a]
+} -cleanup {
+ bigClean
+} -constraints bug-dcac54a685
+# TODO - once above bug is fixed, add tests for large result range
+
+#
+# lrepeat - use bigtest, not bigtestRO !!
+bigtest lrepeat-bigdata-1 "lrepeat single element length > UINT_MAX" 4294967296 -body {
+ # Just to test long lengths are accepted as arguments
+ llength [lrepeat 0x100000000 x]
+}
+
+bigtest lrepeat-bigdata-2 "string repeat multiple char" {4294967400 {0 1 2 3 4 5 6 7}} -body {
+ set len [expr 4294967400/8]
+ set l [lrepeat $len 0 1 2 3 4 5 6 7]
+ list [llength $l] [lrange $l end-7 end]
+} -cleanup {
+ bigClean
+}
+
+#
+# lreplace
+bigtestRO lreplace-bigdata-1 "lreplace - small result" [list \
+ [split 789012345 ""] \
+ [split 012345678 ""] \
+ [split XYZ789012345 ""] \
+ [split 012345678XYZ ""] \
+ ] -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain result
+ lappend result [lreplace $l 0 0x100000000]
+ lappend result [lreplace $l end-0x100000000 end]
+ lappend result [lreplace $l 0 0x100000000 X Y Z]
+ lappend result [lreplace $l end-0x100000000 end X Y Z]
+} -setup {
+ set l [bigList 0x10000000a]
+} -cleanup {
+ bigClean
+}
+
+bigtest lreplace-bigdata-2 "lreplace - large result" {4294967301 {a b c d e 0 1 2 3 4 5 6}} -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain l2
+ set l2 [lreplace [bigList 4294967296] 4294967290 0 a b c d e]
+ lrange $l2 4294967290 end
+} -setup {
+ #set l [bigList 4294967296]
+} -cleanup {
+ bigClean
+} -constraints bug-outofmemorypanic
+
+#
+# lsearch
+bigtestRO lsearch-bigdata-1 "lsearch" {4294967300 4294967310 -1} -body {
+ list \
+ [lsearch -exact $l X] \
+ [lsearch -exact -start 4294967291 $l 0] \
+ [lsearch -exact $l Y]
+} -setup {
+ set l [bigList 0x100000010 4294967300]
+} -cleanup {
+ bigClean
+}
+# TODO - stride, inline, all
+
+#
+# lseq
+bigtest lseq-bigdata-1 "lseq" {4294967297 4294967296} -body {
+ list [llength $l] [lindex $l 0x100000000]
+} -setup {
+ set l [lseq 0x100000001]
+} -cleanup {
+ bigClean
+}
+bigtest lseq-bigdata-2 "lseq" {9223372036854775807 9223372036854775799} -body {
+ list [llength $l] [lindex $l 9223372036854775800]
+} -setup {
+ set l [lseq 0x7fffffffffffffff]; llength $l
+} -cleanup {
+ bigClean
+} -constraints bug-fa00fbbbab
+
+#
+# lset
+bigtest lset-bigdata-1 "lset" {4294967297 4294967297 {1 2 3 4 5 X}} -body {
+ # Do NOT initialize l in a -setup block. That requires more memory and fails.
+ set l [bigList 0x100000001]
+ list [llength [lset l 0x100000000 X]] [llength $l] [lrange $l end-5 end]
+} -cleanup {
+ bigClean
+}
+
+#
+# lsort
+bigtestRO lsort-bigdata-1 "lsort" [list 4294967296 [lrepeat 10 0] [lrepeat 10 9]] -body {
+ # Unset explicitly before setting to save memory as bigtestRO runs the
+ # script below twice.
+ unset -nocomplain l2
+ set l2 [lsort $l]
+ list [llength $l2] [lrange $l2 0 9] [lrange $l2 end-9 end]
+} -setup {
+ set l [bigList 0x100000000]
+} -cleanup {
+ bigClean
+} -constraints notenoughmemoryexception
+
+#
+# join
+bigtestRO join-bigdata-1 "join" [list 0123456789 6789012345] -body {
+ set s [join $l ""]
+ list [string range $s 0 9] [string range $s end-9 end]
+} -setup {
+ set l [bigList 0x100000000]
+} -cleanup {
+ bigClean
+}
+
+bigtest split-bigdata-1 "split" {4294967296 {0 1 2 3 4} {1 2 3 4 5}} -body {
+ # Fill list compare needs too much memory
+ set l [split $s ""]
+ list [llength $l] [lrange 0 4] [lrange end-4 end]
+} -setup {
+ set s [bigString 0x100000000]
+} -cleanup {
+ bigClean
+} -constraints bug-takesTooLong
+
+bigtestRO concat-bigdata-1 "concat" {4294967296 {0 1 2 3 4} {6 7 0 1 2} {3 4 5 6 7}} -body {
+ unset -nocomplain l2
+ set l2 [concat $l $l]
+ list [llength $l2] [lrange $l2 0 4] [lrange $l2 0x80000000-2 0x80000000+2] [lrange $l2 end-4 end]
+} -setup {
+ set l [bigList 0x80000000]
+}
+
+#
+# TODO
+# lremove
+# lreverse
+# encoding convertfrom
+# encoding convertto
+# dict *
+
+
+
+# cleanup
+::tcltest::cleanupTests
+return
+
+# Local Variables:
+# mode: tcl
+# fill-column: 78
+# End:
diff --git a/tests/chanio.test b/tests/chanio.test
index ee6133e..29ef1e7 100644
--- a/tests/chanio.test
+++ b/tests/chanio.test
@@ -3572,7 +3572,7 @@ test chan-io-31.13 {binary mode is synonym of lf mode} -setup {
} -result lf
#
# Test chan-io-9.14 has been removed because "auto" output translation mode is
-# not supoprted.
+# not supported.
#
test chan-io-31.14 {Tcl_Write mixed, Tcl_Gets auto} -setup {
file delete $path(test1)
@@ -5310,8 +5310,10 @@ test chan-io-39.22a {Tcl_SetChannelOption, invariance} -constraints deprecated -
} -cleanup {
chan close $f1
} -result {O D {1 {bad value for -eofchar: must be non-NUL ASCII character}}}
-test chan-io-39.23 {Tcl_GetChannelOption, server socket is not readable or\
- writeable, it should still have valid -eofchar and -translation options} -setup {
+test chan-io-39.23 {
+ Tcl_GetChannelOption, server socket is not readable or writable, but should
+ still have valid -eofchar and -translation options.
+} -setup {
set l [list]
} -body {
set sock [socket -server [namespace code accept] -myaddr 127.0.0.1 0]
@@ -6868,8 +6870,7 @@ test chan-io-52.9 {TclCopyChannel & encodings} {fcopy} {
[file size $path(utf8-fcopy.txt)] \
[file size $path(utf8-rp.txt)]
} {3 5 5}
-test chan-io-52.10 {TclCopyChannel & encodings} {fcopy} {
- # encoding to binary (=> implies that the internal utf-8 is written)
+test chan-io-52.10 {TclCopyChannel & encodings} -constraints {fcopy} -body {
set in [open $path(kyrillic.txt) r]
set out [open $path(utf8-fcopy.txt) w]
chan configure $in -encoding koi8-r -translation lf
@@ -6879,25 +6880,31 @@ test chan-io-52.10 {TclCopyChannel & encodings} {fcopy} {
chan close $in
chan close $out
file size $path(utf8-fcopy.txt)
-} 5
+} -returnCodes 1 -match glob -result {error writing "*":\
+ invalid or incomplete multibyte or wide character}
test chan-io-52.11 {TclCopyChannel & encodings} -setup {
set f [open $path(utf8-fcopy.txt) w]
fconfigure $f -encoding utf-8 -translation lf
puts $f АА
close $f
} -constraints {fcopy} -body {
- # binary to encoding => the input has to be in utf-8 to make sense to the
- # encoder
set in [open $path(utf8-fcopy.txt) r]
set out [open $path(kyrillic.txt) w]
# -translation binary is also -encoding binary
chan configure $in -translation binary
- chan configure $out -encoding koi8-r -translation lf
- chan copy $in $out
- chan close $in
- chan close $out
- file size $path(kyrillic.txt)
-} -result 3
+ chan configure $out -encoding koi8-r -translation lf -profile strict
+ catch {chan copy $in $out} cres copts
+ return $cres
+} -cleanup {
+ if {$in in [chan names]} {
+ close $in
+ }
+ if {$out in [chan names]} {
+ close $out
+ }
+ catch {unset cres}
+} -match glob -result {error writing "*": invalid or incomplete\
+ multibyte or wide character}
test chan-io-53.1 {CopyData} -setup {
file delete $path(test1)
@@ -7580,7 +7587,7 @@ test chan-io-60.1 {writing illegal utf sequences} {fileevent testbytestring} {
# cut of the remainder of the error stack, especially the filename
set result [lreplace $result 3 3 [lindex [split [lindex $result 3] \n] 0]]
list $x $result
-} {1 {gets {} catch {error writing "stdout": illegal byte sequence}}}
+} {1 {gets {} catch {error writing "stdout": invalid or incomplete multibyte or wide character}}}
test chan-io-61.1 {Reset eof state after changing the eof char} -setup {
set datafile [makeFile {} eofchar]
@@ -7608,7 +7615,7 @@ test chan-io-61.1 {Reset eof state after changing the eof char} -setup {
removeFile eofchar
} -result {77 = 23431}
-# Test the cutting and splicing of channels, this is incidentially the
+# Test the cutting and splicing of channels, this is incidentally the
# attach/detach facility of package Thread, but __without any safeguards__. It
# can also be used to emulate transfer of channels between threads, and is
# used for that here.
diff --git a/tests/clock.test b/tests/clock.test
index 2a53259..0b385c9 100644
--- a/tests/clock.test
+++ b/tests/clock.test
@@ -36043,7 +36043,7 @@ test clock-42.1 {regression test - %z in :localtime when west of Greenwich } \
} \
-result {-0500}
-# 43.1 was a bad test - mktime returning -1 is an error according to posix.
+# 43.1 was a bad test - mktime returning -1 is an error according to Posix.
test clock-44.1 {regression test - time zone name containing hyphen } \
-setup {
diff --git a/tests/cmdAH.test b/tests/cmdAH.test
index c9606bf..cc0af64 100644
--- a/tests/cmdAH.test
+++ b/tests/cmdAH.test
@@ -1724,7 +1724,7 @@ test cmdAH-24.14.1 {
file mtime [file join [temporaryDirectory] CON.txt]
} -match regexp -result {could not (?:get modification time|read)} -returnCodes error
-# 3155760000 is 64-bit unix time, Wed Jan 01 00:00:00 GMT 2070:
+# 3155760000 is 64-bit Unix time, Wed Jan 01 00:00:00 GMT 2070:
test cmdAH-24.20.1 {Tcl_FileObjCmd: atime 64-bit time_t, bug [4718b41c56]} -setup {
set filename [makeFile "" foo.text]
} -body {
@@ -2130,7 +2130,7 @@ test cmdAH-32.5 {file tempfile - templates} -constraints unix -body {
} -cleanup {
catch {file delete $name}
} -result ok
-# Not portable; not all unix systems have mkstemps()
+# Not portable; not all Unix systems have mkstemps()
test cmdAH-32.6 {file tempfile - templates} -body {
set template [file join $dirfile foo]
close [file tempfile name $template.bar]
diff --git a/tests/cmdIL.test b/tests/cmdIL.test
index 5a68925..b24b10c 100644
--- a/tests/cmdIL.test
+++ b/tests/cmdIL.test
@@ -168,6 +168,9 @@ test cmdIL-1.41 {lsort -stride and -index} -body {
test cmdIL-1.42 {lsort -stride and-index} -body {
lsort -stride 2 -index -1-1 {a 2 b 1}
} -returnCodes error -result {index "-1-1" out of range}
+test cmdIL-1.43 {lsort -stride errors} -returnCodes error -body {
+ lsort -stride 4294967296 bar
+} -result {list size must be a multiple of the stride length}
# Can't think of any good tests for the MergeSort and MergeLists procedures,
# except a bunch of random lists to sort.
diff --git a/tests/cmdMZ.test b/tests/cmdMZ.test
index a7aa36c..89947bb 100644
--- a/tests/cmdMZ.test
+++ b/tests/cmdMZ.test
@@ -55,8 +55,8 @@ test cmdMZ-1.4 {Tcl_PwdObjCmd: failure} -setup {
file delete -force $foodir
file mkdir $foodir
cd $foodir
-} -constraints {unix nonPortable} -body {
- # This test fails on various unix platforms (eg Linux) where permissions
+} -constraints {Unix nonPortable} -body {
+ # This test fails on various Unix platforms (eg Linux) where permissions
# caching causes this to fail. The caching is strictly incorrect, but we
# have no control over that.
file attr . -permissions 0
diff --git a/tests/compile.test b/tests/compile.test
index 06ebb10..cf552e2 100644
--- a/tests/compile.test
+++ b/tests/compile.test
@@ -520,7 +520,7 @@ test compile-13.3 {TclCompileScript: testing check of max depth by nested script
#puts $errors
# all of nested calls exceed the limit, so must end with "too many nested compilations"
# (or evaluations, depending on compile method/instruction and "mixed" compile within
- # evaliation), so no one succeeds, the result must be empty:
+ # evaluation), so no one succeeds, the result must be empty:
ti eval {set result}
} -result {}
#
diff --git a/tests/dict.test b/tests/dict.test
index 9513d89..f0e11fb 100644
--- a/tests/dict.test
+++ b/tests/dict.test
@@ -1123,7 +1123,7 @@ test dict-19.2 {dict: testing for leaks} -constraints memory -body {
# This test is made to stress object reference management
memtest {
apply {{} {
- # A shared invalid dictinary
+ # A shared invalid dictionary
set apa {a {}b c d}
set bepa $apa
catch {dict replace $apa e f}
diff --git a/tests/encoding.test b/tests/encoding.test
index 35340a6..09f3e42 100644
--- a/tests/encoding.test
+++ b/tests/encoding.test
@@ -465,7 +465,7 @@ test encoding-15.25 {UtfToUtfProc CESU-8} {
encoding convertfrom cesu-8 \x00
} \x00
test encoding-15.26 {UtfToUtfProc CESU-8} {
- encoding convertfrom cesu-8 \xC0\x80
+ encoding convertfrom -profile tcl8 cesu-8 \xC0\x80
} \x00
test encoding-15.27 {UtfToUtfProc -profile strict CESU-8} {
encoding convertfrom -profile strict cesu-8 \x00
@@ -492,7 +492,7 @@ test encoding-16.2 {Utf16ToUtfProc} -body {
list $val [format %x [scan $val %c]]
} -result "\U460DC 460dc"
test encoding-16.3 {Utf16ToUtfProc} -body {
- set val [encoding convertfrom utf-16 "\xDC\xDC"]
+ set val [encoding convertfrom -profile tcl8 utf-16 "\xDC\xDC"]
list $val [format %x [scan $val %c]]
} -result "\uDCDC dcdc"
test encoding-16.4 {Ucs2ToUtfProc} -body {
@@ -504,11 +504,11 @@ test encoding-16.5 {Ucs2ToUtfProc} -body {
list $val [format %x [scan $val %c]]
} -result "\U460DC 460dc"
test encoding-16.6 {Utf32ToUtfProc} -body {
- set val [encoding convertfrom utf-32le NN\0\0]
+ set val [encoding convertfrom -profile strict utf-32le NN\0\0]
list $val [format %x [scan $val %c]]
} -result "乎 4e4e"
test encoding-16.7 {Utf32ToUtfProc} -body {
- set val [encoding convertfrom utf-32be \0\0NN]
+ set val [encoding convertfrom -profile strict utf-32be \0\0NN]
list $val [format %x [scan $val %c]]
} -result "乎 4e4e"
test encoding-16.8 {Utf32ToUtfProc} -body {
@@ -516,28 +516,28 @@ test encoding-16.8 {Utf32ToUtfProc} -body {
list $val [format %x [scan $val %c]]
} -result "\uFFFD fffd"
test encoding-16.9 {Utf32ToUtfProc} -constraints utf32 -body {
- encoding convertfrom utf-32le \x00\xD8\x00\x00
+ encoding convertfrom -profile tcl8 utf-32le \x00\xD8\x00\x00
} -result \uD800
test encoding-16.10 {Utf32ToUtfProc} -body {
- encoding convertfrom utf-32le \x00\xDC\x00\x00
+ encoding convertfrom -profile tcl8 utf-32le \x00\xDC\x00\x00
} -result \uDC00
test encoding-16.11 {Utf32ToUtfProc} -body {
- encoding convertfrom utf-32le \x00\xD8\x00\x00\x00\xDC\x00\x00
+ encoding convertfrom -profile tcl8 utf-32le \x00\xD8\x00\x00\x00\xDC\x00\x00
} -result \uD800\uDC00
test encoding-16.12 {Utf32ToUtfProc} -constraints utf32 -body {
- encoding convertfrom utf-32le \x00\xDC\x00\x00\x00\xD8\x00\x00
+ encoding convertfrom -profile tcl8 utf-32le \x00\xDC\x00\x00\x00\xD8\x00\x00
} -result \uDC00\uD800
test encoding-16.13 {Utf16ToUtfProc} -body {
- encoding convertfrom utf-16le \x00\xD8
+ encoding convertfrom -profile tcl8 utf-16le \x00\xD8
} -result \uD800
test encoding-16.14 {Utf16ToUtfProc} -body {
- encoding convertfrom utf-16le \x00\xDC
+ encoding convertfrom -profile tcl8 utf-16le \x00\xDC
} -result \uDC00
test encoding-16.15 {Utf16ToUtfProc} -body {
encoding convertfrom utf-16le \x00\xD8\x00\xDC
} -result \U010000
test encoding-16.16 {Utf16ToUtfProc} -body {
- encoding convertfrom utf-16le \x00\xDC\x00\xD8
+ encoding convertfrom -profile tcl8 utf-16le \x00\xDC\x00\xD8
} -result \uDC00\uD800
test encoding-16.17 {Utf32ToUtfProc} -body {
list [encoding convertfrom -profile strict -failindex idx utf-32le \x41\x00\x00\x00\x00\xD8\x00\x00\x42\x00\x00\x00] [set idx]
@@ -563,13 +563,13 @@ test encoding-16.18 {
} [namespace current]]
} -result done
test encoding-16.19 {Utf16ToUtfProc, bug [d19fe0a5b]} -body {
- encoding convertfrom utf-16 "\x41\x41\x41"
+ encoding convertfrom -profile tcl8 utf-16 "\x41\x41\x41"
} -result \u4141\uFFFD
test encoding-16.20 {Utf16ToUtfProc, bug [d19fe0a5b]} -constraints deprecated -body {
encoding convertfrom utf-16 "\xD8\xD8"
} -result \uD8D8
-test encoding-16.21 {Utf16ToUtfProc, bug [d19fe0a5b]} -body {
- encoding convertfrom utf-32 "\x00\x00\x00\x00\x41\x41"
+test encoding-16.21 {Utf32ToUtfProc, bug [d19fe0a5b]} -body {
+ encoding convertfrom -profile tcl8 utf-32 "\x00\x00\x00\x00\x41\x41"
} -result \x00\uFFFD
test encoding-16.22 {Utf16ToUtfProc, strict, bug [db7a085bd9]} -body {
encoding convertfrom -profile strict utf-16le \x00\xD8
@@ -578,10 +578,10 @@ test encoding-16.23 {Utf16ToUtfProc, strict, bug [db7a085bd9]} -body {
encoding convertfrom -profile strict utf-16le \x00\xDC
} -returnCodes 1 -result {unexpected byte sequence starting at index 0: '\x00'}
test encoding-16.24 {Utf32ToUtfProc} -body {
- encoding convertfrom utf-32 "\xFF\xFF\xFF\xFF"
+ encoding convertfrom -profile tcl8 utf-32 "\xFF\xFF\xFF\xFF"
} -result \uFFFD
test encoding-16.25 {Utf32ToUtfProc} -body {
- encoding convertfrom utf-32 "\x01\x00\x00\x01"
+ encoding convertfrom -profile tcl8 utf-32 "\x01\x00\x00\x01"
} -result \uFFFD
test encoding-17.1 {UtfToUtf16Proc} -body {
@@ -596,10 +596,10 @@ test encoding-17.3 {UtfToUtf16Proc} -body {
test encoding-17.4 {UtfToUtf16Proc} -body {
encoding convertto -profile tcl8 utf-16le "\uD8D8"
} -result "\xD8\xD8"
-test encoding-17.5 {UtfToUtf16Proc} -body {
+test encoding-17.5 {UtfToUtf32Proc} -body {
encoding convertto utf-32le "\U460DC"
} -result "\xDC\x60\x04\x00"
-test encoding-17.6 {UtfToUtf16Proc} -body {
+test encoding-17.6 {UtfToUtf32Proc} -body {
encoding convertto utf-32be "\U460DC"
} -result "\x00\x04\x60\xDC"
test encoding-17.7 {UtfToUtf16Proc} -body {
@@ -622,7 +622,7 @@ test encoding-17.12 {Utf32ToUtfProc} -body {
} -returnCodes error -result {unexpected byte sequence starting at index 0: '\x00'}
test encoding-18.1 {TableToUtfProc on invalid input} -body {
- list [catch {encoding convertto jis0208 \\} res] $res
+ list [catch {encoding convertto -profile tcl8 jis0208 \\} res] $res
} -result {0 !)}
test encoding-18.2 {TableToUtfProc on invalid input with -profile strict} -body {
list [catch {encoding convertto -profile strict jis0208 \\} res] $res
@@ -634,14 +634,14 @@ test encoding-18.4 {TableToUtfProc on invalid input with -failindex -profile str
list [catch {encoding convertto -failindex pos -profile strict jis0208 \\} res] $res $pos
} -result {0 {} 0}
test encoding-18.5 {TableToUtfProc on invalid input with -failindex} -body {
- list [catch {encoding convertto -failindex pos jis0208 \\} res] $res $pos
+ list [catch {encoding convertto -profile tcl8 -failindex pos jis0208 \\} res] $res $pos
} -result {0 !) -1}
test encoding-18.6 {TableToUtfProc on invalid input with -profile tcl8} -body {
list [catch {encoding convertto -profile tcl8 jis0208 \\} res] $res
} -result {0 !)}
test encoding-19.1 {TableFromUtfProc} -body {
- encoding convertfrom ascii AÁ
+ encoding convertfrom -profile tcl8 ascii AÁ
} -result AÁ
test encoding-19.2 {TableFromUtfProc} -body {
encoding convertfrom -profile tcl8 ascii AÁ
@@ -650,7 +650,7 @@ test encoding-19.3 {TableFromUtfProc} -body {
encoding convertfrom -profile strict ascii AÁ
} -returnCodes 1 -result {unexpected byte sequence starting at index 1: '\xC1'}
test encoding-19.4 {TableFromUtfProc} -body {
- list [encoding convertfrom -failindex idx ascii AÁ] [set idx]
+ list [encoding convertfrom -profile tcl8 -failindex idx ascii AÁ] [set idx]
} -result [list A\xC1 -1]
test encoding-19.5 {TableFromUtfProc} -body {
list [encoding convertfrom -failindex idx -profile strict ascii A\xC1] [set idx]
@@ -799,7 +799,7 @@ test encoding-24.14 {Parse valid or invalid utf-8} {
string length [encoding convertfrom utf-8 "\xC2\x80"]
} 1
test encoding-24.15 {Parse valid or invalid utf-8} -body {
- encoding convertfrom utf-8 "Z\xE0\x80"
+ encoding convertfrom -profile tcl8 utf-8 "Z\xE0\x80"
} -result Z\xE0\u20AC
test encoding-24.16 {Parse valid or invalid utf-8} -constraints testbytestring -body {
encoding convertto utf-8 [testbytestring "Z\u4343\x80"]
@@ -862,7 +862,7 @@ test encoding-24.34 {Try to generate invalid utf-8 with -profile tcl8} -body {
encoding convertto -profile tcl8 utf-8 \uFFFF
} -result \xEF\xBF\xBF
test encoding-24.35 {Parse invalid utf-8} -constraints utf32 -body {
- encoding convertfrom utf-8 \xED\xA0\x80
+ encoding convertfrom -profile tcl8 utf-8 \xED\xA0\x80
} -result \uD800
test encoding-24.36 {Parse invalid utf-8 with -profile strict} -body {
encoding convertfrom -profile strict utf-8 \xED\xA0\x80
diff --git a/tests/env.test b/tests/env.test
index bf3d9a1..7debb2f 100644
--- a/tests/env.test
+++ b/tests/env.test
@@ -221,9 +221,9 @@ NAME2=more
XYZZY=garbage}
test env-2.5 {different encoding (wide chars)} -constraints {win exec} -setup {
- # be sure set of (unicode) environment occurs if single-byte encoding is used:
+ # be sure set of (Unicode) environment occurs if single-byte encoding is used:
encodingswitch cp1252
- # german (cp1252) and russian (cp1251) characters together encoded as utf-8:
+ # German (cp1252) and Russian (cp1251) characters together encoded as utf-8:
set val 2d2dc3a4c3b6c3bcc39f2dd182d0b5d181d1822d2d
set env(XYZZY) [encoding convertfrom utf-8 [binary decode hex $val]]
# now switch to utf-8 (to see correct values from test):
@@ -303,7 +303,7 @@ test env-5.1 {
corner cases - remove one elem at a time
} -setup setup1 -body {
# When no environment variables exist, the env var will contain no
- # entries. The "array names" call synchs up the C-level environ array with
+ # entries. The "array names" call syncs up the C-level environ array with
# the Tcl level env array. Make sure an empty Tcl array is created.
foreach e [array names env] {
unset env($e)
@@ -347,7 +347,7 @@ test env-5.4 {corner cases - unset the env array} -setup {
setup1
interp create i
} -body {
- # The info exists command should be in synch with the env array.
+ # The info exists command should be in sync with the env array.
# Know Bug: 1737
i eval {set env(THIS_SHOULD_EXIST) a}
set result [info exists env(THIS_SHOULD_EXIST)]
diff --git a/tests/error.test b/tests/error.test
index 4ce7709..5bed039 100644
--- a/tests/error.test
+++ b/tests/error.test
@@ -924,7 +924,7 @@ test error-18.12 {variable assignment unaffected by exception in finally} {
list $em [dict get $opts -errorcode]
} {bar FOO}
-# try tests - fallthough body cases
+# try tests - fall-through body cases
test error-19.1 {try with fallthrough body #1} {
set RES {}
diff --git a/tests/eval.test b/tests/eval.test
index 5ffe309..9b8eccd 100644
--- a/tests/eval.test
+++ b/tests/eval.test
@@ -64,7 +64,7 @@ test eval-3.2 {concatenating eval and pure lists} {
} {1 2 3 4 5}
test eval-3.3 {eval and canonical lists} {
set cmd [list list 1 2 3 4 5]
- # Force existance of utf-8 rep
+ # Force existence of utf-8 rep
set dummy($cmd) $cmd
unset dummy
eval $cmd
@@ -72,7 +72,7 @@ test eval-3.3 {eval and canonical lists} {
test eval-3.4 {concatenating eval and canonical lists} {
set cmd [list list 1]
set cmd2 [list 2 3 4 5]
- # Force existance of utf-8 rep
+ # Force existence of utf-8 rep
set dummy($cmd) $cmd
set dummy($cmd2) $cmd2
unset dummy
diff --git a/tests/event.test b/tests/event.test
index 16cbc24..d62d08e 100644
--- a/tests/event.test
+++ b/tests/event.test
@@ -427,7 +427,7 @@ foo
# someday : add a test checking that when there is no bgerror, an error msg
# goes to stderr ideally one would use sub interp and transfer a fake stderr
-# to it, unfortunatly the current interp tcl API does not allow that. The
+# to it, unfortunately the current interp tcl API does not allow that. The
# other option would be to use fork a test but it then becomes more a
# file/exec test than a bgerror test.
diff --git a/tests/exec.test b/tests/exec.test
index 3e25360..5a640b0 100644
--- a/tests/exec.test
+++ b/tests/exec.test
@@ -25,7 +25,7 @@ testConstraint noosxCI [expr {![info exists ::env(MAC_CI)]}]
unset -nocomplain path
-# Utilities that are like bourne shell stalwarts, but cross-platform.
+# Utilities that are like Bourne shell stalwarts, but cross-platform.
set path(echo) [makeFile {
puts -nonewline [lindex $argv 0]
foreach str [lrange $argv 1 end] {
@@ -437,7 +437,7 @@ close $f
test exec-10.20.1 {errors in exec invocation} -constraints {unix exec notValgrind} -body {
exec ~non_existent_user/foo/bar
} -returnCodes error -result {couldn't execute "~non_existent_user/foo/bar": no such file or directory}
-test exec-10.20.1 {errors in exec invocation} -constraints {win exec notValgrind} -body {
+test exec-10.20.2 {errors in exec invocation} -constraints {win exec notValgrind} -body {
exec ~non_existent_user/foo/bar
} -returnCodes error -result {couldn't execute "~non_existent_user\foo\bar": no such file or directory}
test exec-10.21.1 {errors in exec invocation} -constraints {unix exec notValgrind} -body {
diff --git a/tests/fCmd.test b/tests/fCmd.test
index 532b5c3..9940192 100644
--- a/tests/fCmd.test
+++ b/tests/fCmd.test
@@ -87,7 +87,7 @@ testConstraint notFileSharing 1
testConstraint linkFile 1
testConstraint linkDirectory 1
-# Several tests require need to match results against the unix username
+# Several tests require need to match results against the Unix username
set user {}
if {[testConstraint unix]} {
catch {
@@ -410,7 +410,7 @@ test fCmd-3.15 {FileCopyRename: source[0] == '\x00'} -setup {
} -constraints {notRoot unixOrWin} -returnCodes error -body {
file mkdir td1
file rename / td1
-} -result {error renaming "/" to "td1": file already exists}
+} -result {error renaming "/" to "td1": file exists}
test fCmd-3.16 {FileCopyRename: break on first error} -setup {
cleanup
} -constraints {notRoot} -returnCodes error -body {
@@ -421,7 +421,7 @@ test fCmd-3.16 {FileCopyRename: break on first error} -setup {
file mkdir td1
createfile [file join td1 tf3]
file rename tf1 tf2 tf3 tf4 td1
-} -result [subst {error renaming "tf3" to "[file join td1 tf3]": file already exists}]
+} -result [subst {error renaming "tf3" to "[file join td1 tf3]": file exists}]
test fCmd-4.1 {TclFileMakeDirsCmd: make each dir: 1 dir} -setup {
cleanup
@@ -483,7 +483,7 @@ test fCmd-4.9 {TclFileMakeDirsCmd: exists, not dir} -setup {
} -constraints {notRoot} -returnCodes error -body {
createfile tf1
file mkdir tf1
-} -result [subst {can't create directory "[file join tf1]": file already exists}]
+} -result [subst {can't create directory "[file join tf1]": file exists}]
test fCmd-4.10 {TclFileMakeDirsCmd: exists, is dir} -setup {
cleanup
} -constraints {notRoot} -body {
@@ -659,14 +659,14 @@ test fCmd-6.10 {CopyRenameOneFile: lstat(target) == 0} -setup {
createfile tf1
createfile tf2
file rename tf1 tf2
-} -result {error renaming "tf1" to "tf2": file already exists}
+} -result {error renaming "tf1" to "tf2": file exists}
test fCmd-6.11 {CopyRenameOneFile: force == 0} -setup {
cleanup
} -constraints {notRoot} -returnCodes error -body {
createfile tf1
createfile tf2
file rename tf1 tf2
-} -result {error renaming "tf1" to "tf2": file already exists}
+} -result {error renaming "tf1" to "tf2": file exists}
test fCmd-6.12 {CopyRenameOneFile: force != 0} -setup {
cleanup
} -constraints {notRoot} -body {
@@ -806,7 +806,7 @@ test fCmd-6.27 {CopyRenameOneFile: TclpCopyDirectory failed} -setup {
file mkdir [file join $tmpspace td1]
createfile [file join $tmpspace td1 tf1]
file rename -force td1 $tmpspace
-} -match glob -result {error renaming "td1" to "/tmp/tcl*/td1": file already exists}
+} -match glob -result {error renaming "td1" to "/tmp/tcl*/td1": file exists}
test fCmd-6.28 {CopyRenameOneFile: TclpCopyDirectory failed} -setup {
cleanup $tmpspace
} -constraints {notRoot xdev notWsl} -body {
@@ -883,7 +883,7 @@ test fCmd-7.5 {FileForceOption: multiple times through loop} -setup {
test fCmd-8.1 {FileBasename: basename of ~user: argc == 1 && *path == ~} \
-constraints {unix notRoot knownBug tildeexpansion} -body {
- # Labelled knownBug because it is dangerous [Bug: 3881]
+ # Labeled knownBug because it is dangerous [Bug: 3881]
file mkdir td1
file attr td1 -perm 0o40000
file rename ~$user td1
@@ -979,11 +979,11 @@ test fCmd-9.7 {file rename: comprehensive: file to existing file} -setup {
file rename -force tfs3 tfd3
file rename -force tfs4 tfd4
list [lsort [glob tf*]] $msg [file writable tfd1] [file writable tfd2] [file writable tfd3] [file writable tfd4]
-} -result {{tf1 tf2 tfd1 tfd2 tfd3 tfd4} {1 {error renaming "tf1" to "tf2": file already exists}} 1 1 0 0}
+} -result {{tf1 tf2 tfd1 tfd2 tfd3 tfd4} {1 {error renaming "tf1" to "tf2": file exists}} 1 1 0 0}
test fCmd-9.8 {file rename: comprehensive: dir to empty dir} -setup {
cleanup
} -constraints {notRoot testchmod notNetworkFilesystem} -body {
- # Under unix, you can rename a read-only directory, but you can't move it
+ # Under Unix you can rename a read-only directory, but you can't move it
# into another directory.
file mkdir td1
file mkdir [file join td2 td1]
@@ -1015,7 +1015,7 @@ test fCmd-9.8 {file rename: comprehensive: dir to empty dir} -setup {
}
list [lsort [glob td*]] $msg [file writable [file join tdd1 tds1]] \
[file writable [file join tdd2 tds2]] $w3 $w4
-} -result [subst {{td1 td2 tdd1 tdd2 tdd3 tdd4} {1 {error renaming "td1" to "[file join td2 td1]": file already exists}} 1 1 0 0}]
+} -result [subst {{td1 td2 tdd1 tdd2 tdd3 tdd4} {1 {error renaming "td1" to "[file join td2 td1]": file exists}} 1 1 0 0}]
# Test can hit EEXIST or EBUSY, depending on underlying filesystem
test fCmd-9.9 {file rename: comprehensive: dir to non-empty dir} -setup {
cleanup
@@ -1065,7 +1065,7 @@ test fCmd-9.12 {file rename: comprehensive: target exists} -setup {
[catch {file rename td1 td2} msg] $msg
} -cleanup {
testchmod 0o755 [file join td2 td1]
-} -result [subst {0 1 1 {error renaming "td1" to "[file join td2 td1]": file already exists}}]
+} -result [subst {0 1 1 {error renaming "td1" to "[file join td2 td1]": file exists}}]
# Test can hit EEXIST or EBUSY, depending on underlying filesystem
test fCmd-9.13 {file rename: comprehensive: can't overwrite target} -setup {
cleanup
@@ -1202,7 +1202,7 @@ test fCmd-10.4 {file copy: comprehensive: file to existing file} -setup {
file copy -force tfs3 tfd3
file copy -force tfs4 tfd4
list [lsort [glob tf*]] $msg [file writable tfd1] [file writable tfd2] [file writable tfd3] [file writable tfd4]
-} -result {{tf1 tf2 tfd1 tfd2 tfd3 tfd4 tfs1 tfs2 tfs3 tfs4} {1 {error copying "tf1" to "tf2": file already exists}} 1 1 0 0}
+} -result {{tf1 tf2 tfd1 tfd2 tfd3 tfd4 tfs1 tfs2 tfs3 tfs4} {1 {error copying "tf1" to "tf2": file exists}} 1 1 0 0}
test fCmd-10.5 {file copy: comprehensive: dir to empty dir} -setup {
cleanup
} -constraints {notRoot testchmod} -body {
@@ -1226,7 +1226,7 @@ test fCmd-10.5 {file copy: comprehensive: dir to empty dir} -setup {
set a4 [catch {file copy -force tds3 tdd3}]
set a5 [catch {file copy -force tds4 tdd4}]
list [lsort [glob td*]] $a1 $a2 $a3 $a4 $a5
-} -result [subst {{td1 td2 tdd1 tdd2 tdd3 tdd4 tds1 tds2 tds3 tds4} {1 {error copying "td1" to "[file join td2 td1]": file already exists}} {1 {error copying "tds1" to "[file join tdd1 tds1]": file already exists}} 1 1 1}]
+} -result [subst {{td1 td2 tdd1 tdd2 tdd3 tdd4 tds1 tds2 tds3 tds4} {1 {error copying "td1" to "[file join td2 td1]": file exists}} {1 {error copying "tds1" to "[file join tdd1 tds1]": file exists}} 1 1 1}]
test fCmd-10.6 {file copy: comprehensive: dir to non-empty dir} -setup {
cleanup
} -constraints {notRoot unixOrWin testchmod notWsl} -body {
@@ -1238,7 +1238,7 @@ test fCmd-10.6 {file copy: comprehensive: dir to non-empty dir} -setup {
set a1 [list [catch {file copy -force tds1 tdd1} msg] $msg]
set a2 [list [catch {file copy -force tds2 tdd2} msg] $msg]
list [lsort [glob td*]] $a1 $a2 [file writable tds1] [file writable tds2]
-} -result [subst {{tdd1 tdd2 tds1 tds2} {1 {error copying "tds1" to "[file join tdd1 tds1]": file already exists}} {1 {error copying "tds2" to "[file join tdd2 tds2]": file already exists}} 1 0}]
+} -result [subst {{tdd1 tdd2 tds1 tds2} {1 {error copying "tds1" to "[file join tdd1 tds1]": file exists}} {1 {error copying "tds2" to "[file join tdd2 tds2]": file exists}} 1 0}]
test fCmd-10.7 {file rename: comprehensive: file to new name and dir} -setup {
cleanup
} -constraints {notRoot testchmod} -body {
@@ -2460,7 +2460,7 @@ test fCmd-28.6 {file link: unsupported operation} -setup {
file link -hard abc.link abc.dir
} -returnCodes error -cleanup {
cd [workingDirectory]
-} -result {could not create new link "abc.link" pointing to "abc.dir": illegal operation on a directory}
+} -result {could not create new link "abc.link" pointing to "abc.dir": is a directory}
test fCmd-28.7 {file link: source already exists} -setup {
cd [temporaryDirectory]
} -constraints {linkFile} -body {
@@ -2537,7 +2537,7 @@ test fCmd-28.12 {file link: cd into a link} -setup {
cd $orig
# Now '$up' should be either $orig or [file dirname abc.dir], depending on
# whether 'cd' actually moves to the destination of a link, or simply
- # treats the link as a directory. (On windows the former, on unix the
+ # treats the link as a directory. (On windows the former, on Unix the
# latter, I believe)
if {
([file normalize $up] ne [file normalize $orig]) &&
diff --git a/tests/fileName.test b/tests/fileName.test
index 416c419..be424e2 100644
--- a/tests/fileName.test
+++ b/tests/fileName.test
@@ -18,6 +18,7 @@ if {"::tcltest" ni [namespace children]} {
::tcltest::loadTestedCommands
catch [list package require -exact tcl::test [info patchlevel]]
+source [file join [file dirname [info script]] tcltests.tcl]
testConstraint testsetplatform [llength [info commands testsetplatform]]
testConstraint testtranslatefilename [llength [info commands testtranslatefilename]]
@@ -1346,7 +1347,7 @@ catch {file attributes globTest/a1 -permissions 0o755}
test filename-15.4 {unix specific no complain: no errors, good result} \
{unix nonPortable} {
# test fails because if an error occurs, the interp's result is reset...
- # or you don't run at scriptics where the outser and welch users exists
+ # or you don't run at scriptics where the ouster and welch users exists
glob -nocomplain ~ouster ~foo ~welch
} {/home/ouster /home/welch}
test filename-15.4.1 {no complain: errors, sequencing} {
@@ -1569,7 +1570,7 @@ test fileName-20.6 {Bug 2837800} -setup {
cd $savewd
removeDirectory ./~ $dd
removeDirectory isolate
- removeFile test ~
+ removeFile test [file home]
} -result {}
test fileName-20.7 {Bug 2806250} -setup {
set savewd [pwd]
@@ -1609,6 +1610,61 @@ test fileName-20.10 {globbing for special chars} -setup {
removeFile fileName-20.10 $s
removeDirectory sub [file home]
} -result [file home]/sub/fileName-20.10
+
+
+apply [list {} {
+ test fileName-6d4e9d1af5bf5b7d {
+ memory leak in SetFsPathFromAny
+
+ Runs under both a TCL_DEBUG_MEM build and a -DPURIFY build for
+ valgrind, which is useful since Valgrind provides information about the
+ error location, but [memory] doesn't.
+ } -setup {
+ if {[namespace which ::memory] eq {}} {
+ set memcheckcmd [list ::apply [list script {
+ uplevel 1 $script
+ return 0
+ } [namespace current]]]
+ } else {
+ set memcheckcmd ::tcltests::scriptmemcheck
+ }
+ } -body {
+ {*}$memcheckcmd {
+ set interp [interp create]
+ interp eval $interp {
+ apply [list {} {
+ upvar 1 f f
+
+ # A unique name so that no internal representation of this
+ # literal value has been picked up from any other script
+ # that has alredy been sourced into this interpreter.
+ set variableUniqueInTheEntireTclCodebase a
+ set name variableUniqueInTheEntireTclCodebase
+
+ # give the Tcl_Obj for "var1" an internal representation of
+ # type 'localVarNameType'.
+ set $name
+
+ set f [open variableUniqueInTheEntireTclCodebase w]
+ try {
+ puts $f {some data}
+ } finally {
+ close $f
+ }
+
+ set f [open variableUniqueInTheEntireTclCodebase]
+ try {
+ read $f
+ } finally {
+ catch {file delete variableUniqueInTheEntireTclCodebase}
+ close $f
+ }
+ } [namespace current]]
+ }
+ interp delete $interp
+ }
+ } -result 0
+} [namespace current]]
# cleanup
catch {file delete -force C:/globTest}
diff --git a/tests/fileSystem.test b/tests/fileSystem.test
index d104282..cedabac 100644
--- a/tests/fileSystem.test
+++ b/tests/fileSystem.test
@@ -297,7 +297,7 @@ test filesystem-1.33 {link normalisation: link near filesystem root} {testsetpla
testsetplatform windows
set res [file normalize C:/../bar]
if {[testConstraint unix]} {
- # Some unices go further in normalizing this -- not really a problem
+ # Some Unices go further in normalizing this -- not really a problem
# since this is a Windows test.
regexp {C:/bar$} $res res
}
@@ -694,7 +694,7 @@ test filesystem-7.4 {cross-filesystem file copy with -force} -setup {
file delete -force simplefile
file delete -force file2
cd $dir
-} -result {0 {} 1 {error copying "simplefs:/simplefile" to "file2": file already exists} 0 {} 1}
+} -result {0 {} 1 {error copying "simplefs:/simplefile" to "file2": file exists} 0 {} 1}
test filesystem-7.5 {cross-filesystem file copy with -force} -setup {
set dir [pwd]
cd [tcltest::temporaryDirectory]
@@ -719,7 +719,7 @@ test filesystem-7.5 {cross-filesystem file copy with -force} -setup {
file delete -force simplefile
file delete -force file2
cd $dir
-} -result {0 {} 1 {error copying "simplefs:/simplefile" to "file2": file already exists} 0 {} 1}
+} -result {0 {} 1 {error copying "simplefs:/simplefile" to "file2": file exists} 0 {} 1}
test filesystem-7.6 {cross-filesystem dir copy with -force} -setup {
set dir [pwd]
cd [tcltest::temporaryDirectory]
@@ -747,7 +747,7 @@ test filesystem-7.6 {cross-filesystem dir copy with -force} -setup {
file delete -force simpledir
file delete -force dir2
cd $dir
-} -result {0 {} 1 {error copying "simplefs:/simpledir" to "dir2/simpledir": file already exists} 0 {} 1 1}
+} -result {0 {} 1 {error copying "simplefs:/simpledir" to "dir2/simpledir": file exists} 0 {} 1 1}
test filesystem-7.7 {cross-filesystem dir copy with -force} -setup {
set dir [pwd]
cd [tcltest::temporaryDirectory]
@@ -777,7 +777,7 @@ test filesystem-7.7 {cross-filesystem dir copy with -force} -setup {
file delete -force simpledir
file delete -force dir2
cd $dir
-} -result {0 {} 1 {error copying "simplefs:/simpledir" to "dir2/simpledir": file already exists} 0 {} 1 1}
+} -result {0 {} 1 {error copying "simplefs:/simpledir" to "dir2/simpledir": file exists} 0 {} 1 1}
removeFile gorp.file
test filesystem-7.8 {vfs cd} -setup {
set dir [pwd]
diff --git a/tests/for.test b/tests/for.test
index 8284a09..26300ce 100644
--- a/tests/for.test
+++ b/tests/for.test
@@ -337,7 +337,7 @@ proc formatMail {} {
50 {} \
51 {Binary Releases} \
52 {} \
- 53 {Pre-compiled releases are available for the following platforms: } \
+ 53 {Precompiled releases are available for the following platforms: } \
54 {} \
55 { Windows 3.1, Windows 95, and Windows NT: Fetch} \
56 { ftp://ftp.sunlabs.com/pub/tcl/win42b1.exe, then execute it. The file is a} \
@@ -556,7 +556,7 @@ Obtaining The Releases
Binary Releases
-Pre-compiled releases are available for the following
+Precompiled releases are available for the following
platforms:
Windows 3.1, Windows 95, and Windows NT: Fetch
diff --git a/tests/http.test b/tests/http.test
index 765efa6..73b405d 100644
--- a/tests/http.test
+++ b/tests/http.test
@@ -629,7 +629,7 @@ test http-4.14.$ThreadLevel {http::Event} -body {
lindex [http::error $token] 0
} -cleanup {
catch {http::cleanup $token}
-} -result {connect failed connection refused}
+} -result {connect failed: connection refused}
# Bogus host
test http-4.15.$ThreadLevel {http::Event} -body {
diff --git a/tests/indexObj.test b/tests/indexObj.test
index 26fb81e..4c01210 100644
--- a/tests/indexObj.test
+++ b/tests/indexObj.test
@@ -1,4 +1,4 @@
-# This file is a Tcl script to test out the the procedures in file
+# This file is a Tcl script to test out the procedures in file
# tkIndexObj.c, which implement indexed table lookups. The tests here are
# organized in the standard fashion for Tcl tests.
#
@@ -19,6 +19,7 @@ catch [list package require -exact tcl::test [info patchlevel]]
testConstraint testindexobj [llength [info commands testindexobj]]
testConstraint testgetintforindex [llength [info commands testgetintforindex]]
testConstraint testparseargs [llength [info commands testparseargs]]
+testConstraint has64BitLengths [expr {$tcl_platform(pointerSize) == 8}]
test indexObj-1.1 {exact match} testindexobj {
testindexobj 1 1 xyz abc def xyz alm
@@ -184,7 +185,7 @@ test indexObj-8.4 {Tcl_GetIntForIndex INT_MAX} testgetintforindex {
} 2147483647
test indexObj-8.5 {Tcl_GetIntForIndex INT_MAX+1} testgetintforindex {
testgetintforindex 2147483648 0
-} 2147483648
+} [expr {[testConstraint has64BitLengths] ? 2147483648 : 2147483647}]
test indexObj-8.6 {Tcl_GetIntForIndex end-1} testgetintforindex {
testgetintforindex end-1 2147483646
} 2147483645
@@ -199,16 +200,16 @@ test indexObj-8.9 {Tcl_GetIntForIndex end} testgetintforindex {
} 2147483647
test indexObj-8.10 {Tcl_GetIntForIndex end-1} testgetintforindex {
testgetintforindex end-1 -1
-} -2
+} -1
test indexObj-8.11 {Tcl_GetIntForIndex end-1} testgetintforindex {
testgetintforindex end-1 -2
-} -3
+} -1
test indexObj-8.12 {Tcl_GetIntForIndex end} testgetintforindex {
testgetintforindex end -1
} -1
test indexObj-8.13 {Tcl_GetIntForIndex end} testgetintforindex {
testgetintforindex end -2
-} -2
+} -1
test indexObj-8.14 {Tcl_GetIntForIndex end+1} testgetintforindex {
testgetintforindex end+1 -1
} 0
diff --git a/tests/internals.tcl b/tests/internals.tcl
index ff6c42b..36dbc90 100644
--- a/tests/internals.tcl
+++ b/tests/internals.tcl
@@ -36,7 +36,7 @@ proc testWithLimit args {
# with limited address space:
if {[info exists in(-addmem)] || [info exists in(-maxmem)]} {
if {[info exists in(-addmem)]} {
- # as differnce to normal usage, so try to retrieve current memory usage:
+ # as difference to normal usage, so try to retrieve current memory usage:
if {[catch {
# using ps (vsz is in KB):
incr in(-addmem) [expr {[lindex [exec ps -hq $ppid -o vsz] end] * 1024}]
diff --git a/tests/interp.test b/tests/interp.test
index 3aac4de..5bb5342 100644
--- a/tests/interp.test
+++ b/tests/interp.test
@@ -2419,13 +2419,13 @@ test interp-29.1.5 {interp recursionlimit argument checking} -body {
set result [catch {interp recursionlimit moo 0} msg]
interp delete moo
list $result $msg
-} -match glob -result {1 {recursion limit must be > 0 and < *}}
+} -match glob -result {1 {recursion limit must be > 0}}
test interp-29.1.6 {interp recursionlimit argument checking} -body {
interp create moo
set result [catch {interp recursionlimit moo -1} msg]
interp delete moo
list $result $msg
-} -match glob -result {1 {recursion limit must be > 0 and < *}}
+} -match glob -result {1 {recursion limit must be > 0}}
test interp-29.1.7 {interp recursionlimit argument checking} {
interp create moo
set result [catch {interp recursionlimit moo [expr {wide(1)<<64}]} msg]
@@ -2449,13 +2449,13 @@ test interp-29.1.10 {child recursionlimit argument checking} -body {
set result [catch {moo recursionlimit 0} msg]
interp delete moo
list $result $msg
-} -match glob -result {1 {recursion limit must be > 0 and < *}}
+} -match glob -result {1 {recursion limit must be > 0}}
test interp-29.1.11 {child recursionlimit argument checking} -body {
interp create moo
set result [catch {moo recursionlimit -1} msg]
interp delete moo
list $result $msg
-} -match glob -result {1 {recursion limit must be > 0 and < *}}
+} -match glob -result {1 {recursion limit must be > 0}}
test interp-29.1.12 {child recursionlimit argument checking} {
interp create moo
set result [catch {moo recursionlimit [expr {wide(1)<<64}]} msg]
diff --git a/tests/io.test b/tests/io.test
index 954d4c1..dfa015f 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -1620,7 +1620,7 @@ test io-12.9 {ReadChars: multibyte chars split} -body {
puts -nonewline $f [string repeat a 9]\xC2
close $f
set f [open $path(test1)]
- fconfigure $f -encoding utf-8 -buffersize 10
+ fconfigure $f -encoding utf-8 -profile tcl8 -buffersize 10
set in [read $f]
close $f
scan [string index $in end] %c
@@ -3898,7 +3898,7 @@ test io-31.13 {binary mode is synonym of lf mode} {
} lf
#
# Test io-9.14 has been removed because "auto" output translation mode is
-# not supoprted.
+# not supported.
#
test io-31.14 {Tcl_Write mixed, Tcl_Gets auto} {
file delete $path(test1)
@@ -5855,7 +5855,7 @@ test io-39.22a {Tcl_SetChannelOption, invariance} -constraints deprecated -body
set l
} -result {O D {1 {bad value for -eofchar: must be non-NUL ASCII character}}}
test io-39.23 {Tcl_GetChannelOption, server socket is not readable or
- writeable, it should still have valid -eofchar and -translation options } {
+ writable, it should still have valid -eofchar and -translation options } {
set l [list]
set sock [socket -server [namespace code accept] -myaddr 127.0.0.1 0]
lappend l [fconfigure $sock -eofchar] [fconfigure $sock -translation]
@@ -7500,10 +7500,7 @@ test io-52.9 {TclCopyChannel & encodings} {fcopy} {
[file size $path(utf8-fcopy.txt)] \
[file size $path(utf8-rp.txt)]
} {3 5 5}
-test io-52.10 {TclCopyChannel & encodings} {fcopy} {
- # encoding to binary (=> implies that the
- # internal utf-8 is written)
-
+test io-52.10 {TclCopyChannel & encodings} -constraints fcopy -body {
set in [open $path(kyrillic.txt) r]
set out [open $path(utf8-fcopy.txt) w]
@@ -7516,29 +7513,31 @@ test io-52.10 {TclCopyChannel & encodings} {fcopy} {
close $out
file size $path(utf8-fcopy.txt)
-} 5
+} -returnCodes 1 -match glob -result {error writing "*":\
+ invalid or incomplete multibyte or wide character}
test io-52.11 {TclCopyChannel & encodings} -setup {
set out [open $path(utf8-fcopy.txt) w]
- fconfigure $out -encoding utf-8 -translation lf
- puts $out "АА"
+ fconfigure $out -encoding utf-8 -translation lf -profile strict
+ puts $out АА
close $out
} -constraints {fcopy} -body {
- # binary to encoding => the input has to be
- # in utf-8 to make sense to the encoder
-
set in [open $path(utf8-fcopy.txt) r]
set out [open $path(kyrillic.txt) w]
-
# -translation binary is also -encoding binary
fconfigure $in -translation binary
- fconfigure $out -encoding koi8-r -translation lf
-
- fcopy $in $out
- close $in
- close $out
-
- file size $path(kyrillic.txt)
-} -result 3
+ fconfigure $out -encoding koi8-r -translation lf -profile strict
+ catch {fcopy $in $out} cres copts
+ return $cres
+} -cleanup {
+ if {$in in [chan names]} {
+ close $in
+ }
+ if {$out in [chan names]} {
+ close $out
+ }
+ catch {unset cres}
+} -match glob -result {error writing "*": invalid or incomplete\
+ multibyte or wide character}
test io-52.12 {coverage of -translation auto} {
file delete $path(test1) $path(test2)
@@ -7703,7 +7702,7 @@ test io-52.20 {TclCopyChannel & encodings} -setup {
} -cleanup {
close $in
close $out
-} -returnCodes 1 -match glob -result {error reading "file*": illegal byte sequence}
+} -returnCodes 1 -match glob -result {error reading "file*": invalid or incomplete multibyte or wide character}
test io-52.21 {TclCopyChannel & encodings} -setup {
set out [open $path(utf8-fcopy.txt) w]
fconfigure $out -encoding utf-8 -translation lf
@@ -7724,7 +7723,7 @@ test io-52.21 {TclCopyChannel & encodings} -setup {
} -cleanup {
close $in
close $out
-} -returnCodes 1 -match glob -result {error writing "file*": illegal byte sequence}
+} -returnCodes 1 -match glob -result {error writing "file*": invalid or incomplete multibyte or wide character}
test io-52.22 {TclCopyChannel & encodings} -setup {
set out [open $path(utf8-fcopy.txt) w]
fconfigure $out -encoding utf-8 -translation lf
@@ -7751,7 +7750,7 @@ test io-52.22 {TclCopyChannel & encodings} -setup {
close $in
close $out
unset ::s0
-} -match glob -result {0 {error reading "file*": illegal byte sequence}}
+} -match glob -result {0 {error reading "file*": invalid or incomplete multibyte or wide character}}
test io-52.23 {TclCopyChannel & encodings} -setup {
set out [open $path(utf8-fcopy.txt) w]
fconfigure $out -encoding utf-8 -translation lf
@@ -7778,7 +7777,30 @@ test io-52.23 {TclCopyChannel & encodings} -setup {
close $in
close $out
unset ::s0
-} -match glob -result {0 {error writing "file*": illegal byte sequence}}
+} -match glob -result {0 {error writing "file*": invalid or incomplete multibyte or wide character}}
+
+test io-52.24 {fcopy -size should always be characters} -setup {
+ set out [open utf8-fcopy-52.24.txt w]
+ fconfigure $out -encoding utf-8 -translation lf
+ puts $out "Á"
+ close $out
+} -constraints {fcopy} -body {
+ set in [open utf8-fcopy-52.24.txt r]
+ set out [open utf8-fcopy-52.24.out.txt w+]
+
+ fconfigure $in -encoding utf-8 -profile tcl8
+ fconfigure $out -encoding utf-8 -profile tcl8
+ fcopy $in $out -size 1
+ seek $out 0
+ # a result of \xc3 means that only the first byte of the utf-8 encoding of
+ # Á made it into to the output file.
+ read $out
+} -cleanup {
+ close $in
+ close $out
+ catch {file delete utf8-fcopy-52.24.txt}
+ catch {file delete utf8-fcopy-52.24.out.txt}
+} -result Á
test io-53.1 {CopyData} {fcopy} {
@@ -8276,7 +8298,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 fcopy} {
+test io-53.12.0 {CopyData: foreground short reads, aka bug 3096275} {stdio unix fcopy} {
file delete $path(pipe)
set f1 [open $path(pipe) w]
puts -nonewline $f1 {
@@ -8295,6 +8317,32 @@ test io-53.12 {CopyData: foreground short reads, aka bug 3096275} {stdio unix fc
close $f1
list $::done $ch
} {ok A}
+test io-53.12.1 {
+ Issue 9ca87e6286262a62.
+ CopyData: foreground short reads via ReadChars().
+ Related to report 3096275 for ReadBytes().
+
+ Prior to the fix this test waited forever for read() to return.
+} {stdio unix fcopy} {
+ file delete $path(output)
+ set f1 [open $path(output) w]
+ puts -nonewline $f1 {
+ chan configure stdin -encoding iso8859-1 -translation lf -buffering none
+ fcopy stdin stdout
+ }
+ close $f1
+ set f1 [open "|[list [info nameofexecutable] $path(output)]" r+]
+ try {
+ chan configure $f1 -encoding utf-8 -buffering none
+ puts -nonewline $f1 A
+ set ch [read $f1 1]
+ } finally {
+ if {$f1 in [chan names]} {
+ close $f1
+ }
+ }
+ lindex $ch
+} A
test io-53.13 {TclCopyChannel: read error reporting} -setup {
proc driver {cmd args} {
variable buffer
@@ -8324,7 +8372,7 @@ test io-53.13 {TclCopyChannel: read error reporting} -setup {
catch {close $out}
removeFile out
rename driver {}
-} -result {error reading "*": *} -returnCodes error -match glob
+} -result {error reading "rc*": *} -returnCodes error -match glob
test io-53.14 {TclCopyChannel: write error reporting} -setup {
proc driver {cmd args} {
variable buffer
@@ -8761,7 +8809,7 @@ test io-60.1 {writing illegal utf sequences} {fileevent testbytestring} {
# cut of the remainder of the error stack, especially the filename
set result [lreplace $result 3 3 [lindex [split [lindex $result 3] \n] 0]]
list $x $result
-} {1 {gets ABC catch {error writing "stdout": illegal byte sequence}}}
+} {1 {gets ABC catch {error writing "stdout": invalid or incomplete multibyte or wide character}}}
test io-61.1 {Reset eof state after changing the eof char} -setup {
set datafile [makeFile {} eofchar]
@@ -8791,7 +8839,7 @@ test io-61.1 {Reset eof state after changing the eof char} -setup {
} -result {77 = 23431}
-# Test the cutting and splicing of channels, this is incidentially the
+# Test the cutting and splicing of channels, this is incidentally the
# attach/detach facility of package Thread, but __without any
# safeguards__. It can also be used to emulate transfer of channels
# between threads, and is used for that here.
@@ -9123,7 +9171,7 @@ test io-74.1 {[104f2885bb] improper cache validity check} -setup {
removeFile io-74.1
} -returnCodes error -match glob -result {can not find channel named "*"}
-test io-75.1 {multibyte encoding error read results in raw bytes (-nocomplainencoding 1)} -setup {
+test io-75.1 {multibyte encoding error read results in raw bytes (-profile tcl8)} -setup {
set fn [makeFile {} io-75.1]
set f [open $fn w+]
fconfigure $f -encoding binary
@@ -9214,23 +9262,27 @@ test io-75.5 {invalid utf-8 encoding read is ignored (-profile tcl8)} -setup {
removeFile io-75.5
} -result 4181
-test io-75.6 {invalid utf-8 encoding gets is not ignored (-profile strict)} -setup {
+test io-75.6 {invalid utf-8 encoding, gets is not ignored (-profile strict)} -setup {
set fn [makeFile {} io-75.6]
set f [open $fn w+]
fconfigure $f -encoding binary
- # \x81 is invalid in utf-8
+ # \x81 is an incomplete byte sequence in utf-8
puts -nonewline $f A\x81
flush $f
seek $f 0
- fconfigure $f -encoding utf-8 -buffering none -eofchar "" -translation lf -profile strict
+ fconfigure $f -encoding utf-8 -buffering none -eofchar {} \
+ -translation lf -profile strict
} -body {
gets $f
} -cleanup {
close $f
removeFile io-75.6
-} -match glob -returnCodes 1 -result {error reading "*": illegal byte sequence}
+} -match glob -returnCodes 1 -result {error reading "file*":\
+ invalid or incomplete multibyte or wide character}
-test io-75.7 {invalid utf-8 encoding gets is not ignored (-profile strict)} -setup {
+test io-75.7 {
+ invalid utf-8 encoding gets is not ignored (-profile strict)
+} -setup {
set fn [makeFile {} io-75.7]
set f [open $fn w+]
fconfigure $f -encoding binary
@@ -9238,23 +9290,27 @@ test io-75.7 {invalid utf-8 encoding gets is not ignored (-profile strict)} -set
puts -nonewline $f A\x81
flush $f
seek $f 0
- fconfigure $f -encoding utf-8 -buffering none -eofchar "" -translation lf -profile strict
+ fconfigure $f -encoding utf-8 -buffering none -eofchar {} -translation lf \
+ -profile strict
} -body {
read $f
} -cleanup {
close $f
removeFile io-75.7
-} -match glob -returnCodes 1 -result {error reading "*": illegal byte sequence}
+} -match glob -returnCodes 1 -result {error reading "file*":\
+ invalid or incomplete multibyte or wide character}
test io-75.8 {invalid utf-8 encoding eof handling (-profile strict)} -setup {
set fn [makeFile {} io-75.8]
set f [open $fn w+]
fconfigure $f -encoding binary
- # \x81 is invalid in utf-8, but since \x1A comes first, -eofchar takes precedence.
+ # \x81 is invalid in utf-8, but since \x1A comes first, -eofchar takes
+ # precedence.
puts -nonewline $f A\x1A\x81
flush $f
seek $f 0
- fconfigure $f -encoding utf-8 -buffering none -eofchar \x1A -translation lf -profile strict
+ fconfigure $f -encoding utf-8 -buffering none -eofchar \x1A \
+ -translation lf -profile strict
} -body {
set d [read $f]
binary scan $d H* hd
@@ -9266,6 +9322,56 @@ test io-75.8 {invalid utf-8 encoding eof handling (-profile strict)} -setup {
removeFile io-75.8
} -result {41 1 {}}
+test io-75.8.eoflater {invalid utf-8 encoding eof handling (-profile strict)} -setup {
+ set res {}
+ set fn [makeFile {} io-75.8]
+ set f [open $fn w+]
+ # This also configures the channel encoding profile as strict.
+ fconfigure $f -encoding binary
+ # \x81 is invalid in utf-8. -eofchar is not detected, because it comes later.
+ puts -nonewline $f A\x81\x81\x1A
+ flush $f
+ seek $f 0
+ fconfigure $f -encoding utf-8 -buffering none -eofchar \x1A \
+ -translation lf -profile strict
+} -body {
+ set status [catch {read $f} cres copts]
+ lappend res $status
+ lappend res [eof $f]
+ chan configure $f -encoding iso8859-1
+ lappend res [read $f 1]
+ chan configure $f -encoding utf-8
+ catch {read $f 1} cres
+ lappend res $cres
+ close $f
+ set res
+} -cleanup {
+ removeFile io-75.8
+} -match glob -result "1 0 \x81 {error reading \"*\":\
+ invalid or incomplete multibyte or wide character}"
+
+
+test io-strict-multibyte-eof {
+ incomplete utf-8 sequence immediately prior to eof character
+
+ See issue 25cdcb7e8fb381fb
+} -setup {
+ set res {}
+ set chan [file tempfile];
+ fconfigure $chan -encoding binary
+ puts -nonewline $chan \x81\x1A
+ flush $chan
+ seek $chan 0
+ chan configure $chan -encoding utf-8 -profile strict
+} -body {
+ set status [catch {read $chan 1} cres]
+ lappend res $status $cres
+} -cleanup {
+ close $chan
+ unset res
+} -match glob -result {1 {error reading "*":\
+ invalid or incomplete multibyte or wide character}}
+
test io-75.9 {unrepresentable character write passes and is replaced by ?} -setup {
set fn [makeFile {} io-75.9]
set f [open $fn w+]
@@ -9278,12 +9384,14 @@ test io-75.9 {unrepresentable character write passes and is replaced by ?} -setu
} -cleanup {
close $f
removeFile io-75.9
-} -match glob -result [list {A} {error writing "*": illegal byte sequence}]
+} -match glob -result [list {A} {error writing "*":\
+ invalid or incomplete multibyte or wide character}]
-# Incomplete sequence test.
-# This error may IMHO only be detected with the close.
-# But the read already returns the incomplete sequence.
-test io-75.10 {incomplete multibyte encoding read is ignored} -setup {
+test io-75.10 {
+ incomplete multibyte encoding read is not ignored because "binary" sets
+ profile to strict
+} -setup {
+ set res {}
set fn [makeFile {} io-75.10]
set f [open $fn w+]
fconfigure $f -encoding binary
@@ -9292,13 +9400,21 @@ test io-75.10 {incomplete multibyte encoding read is ignored} -setup {
seek $f 0
fconfigure $f -encoding utf-8 -buffering none
} -body {
+ catch {read $f} errmsg
+ lappend res $errmsg
+ seek $f 0
+ chan configure $f -profile tcl8
set d [read $f]
binary scan $d H* hd
- set hd
+ lappend res $hd
+ return $res
} -cleanup {
close $f
removeFile io-75.10
-} -result 41c0
+ unset result
+} -match glob -result {{error reading "file*":\
+ invalid or incomplete multibyte or wide character} 41c0}
+
# The current result returns the orphan byte as byte.
# This may be expected due to special utf-8 handling.
@@ -9313,7 +9429,8 @@ test io-75.11 {shiftjis encoding error read results in raw bytes} -setup {
puts -nonewline $f A\x81\xFFA
flush $f
seek $f 0
- fconfigure $f -encoding shiftjis -blocking 0 -eofchar "" -translation lf -profile strict
+ fconfigure $f -encoding shiftjis -blocking 0 -eofchar {} -translation lf \
+ -profile strict
} -body {
set d [read $f]
binary scan $d H* hd
@@ -9322,33 +9439,50 @@ test io-75.11 {shiftjis encoding error read results in raw bytes} -setup {
} -cleanup {
close $f
removeFile io-75.11
-} -match glob -result {41 1 {error reading "*": illegal byte sequence}}
+} -match glob -result {41 1 {error reading "file*":\
+ invalid or incomplete multibyte or wide character}}
-test io-75.12 {invalid utf-8 encoding read is ignored} -setup {
+test io-75.12 {
+ invalid utf-8 encoding read is not ignored because setting the encoding to
+ "binary" also set the profile to strict
+} -setup {
+ set res {}
set fn [makeFile {} io-75.12]
set f [open $fn w+]
fconfigure $f -encoding binary
puts -nonewline $f A\x81
flush $f
seek $f 0
- fconfigure $f -encoding utf-8 -buffering none -eofchar "" -translation lf
+ fconfigure $f -encoding utf-8 -buffering none -eofchar {} -translation lf
} -body {
+ catch {read $f} errmsg
+ lappend res $errmsg
+ chan configure $f -profile tcl8
+ seek $f 0
set d [read $f]
binary scan $d H* hd
- set hd
+ lappend res $hd
+ return $res
} -cleanup {
close $f
removeFile io-75.12
-} -result 4181
-test io-75.13 {invalid utf-8 encoding read is not ignored (-profile strict)} -setup {
+ unset res
+} -match glob -result {{error reading "file*":\
+ invalid or incomplete multibyte or wide character} 4181}
+test io-75.13 {
+ In nonblocking mode when there is an encoding error the data that has been
+ successfully read so far is returned first and then the error is returned
+ on the next call to [read].
+} -setup {
set fn [makeFile {} io-75.13]
set f [open $fn w+]
fconfigure $f -encoding binary
# \x81 is invalid in utf-8
- puts -nonewline $f "A\x81"
+ puts -nonewline $f A\x81
flush $f
seek $f 0
- fconfigure $f -encoding utf-8 -blocking 0 -eofchar "" -translation lf -profile strict
+ fconfigure $f -encoding utf-8 -blocking 0 -eofchar {} -translation lf \
+ -profile strict
} -body {
set d [read $f]
binary scan $d H* hd
@@ -9357,7 +9491,69 @@ test io-75.13 {invalid utf-8 encoding read is not ignored (-profile strict)} -se
} -cleanup {
close $f
removeFile io-75.13
-} -match glob -result {41 1 {error reading "*": illegal byte sequence}}
+} -match glob -result {41 1 {error reading "file*":\
+ invalid or incomplete multibyte or wide character}}
+
+test io-75.14 {
+ [gets] succesfully returns lines prior to error
+
+ invalid utf-8 encoding [gets] continues in non-strict mode after error
+} -setup {
+ set chan [file tempfile]
+ fconfigure $chan -encoding binary
+ # \xc0\n is an invalid utf-8 sequence
+ puts -nonewline $chan a\nb\nc\xc0\nd\n
+ flush $chan
+ seek $chan 0
+ fconfigure $chan -encoding utf-8 -buffering none -eofchar {} \
+ -translation auto -profile strict
+} -body {
+ lappend res [gets $chan]
+ lappend res [gets $chan]
+ set status [catch {gets $chan} cres copts]
+ lappend res $status $cres
+ chan configure $chan -profile tcl8
+ lappend res [gets $chan]
+ lappend res [gets $chan]
+ close $chan
+ return $res
+} -match glob -result {a b 1 {error reading "*":\
+ invalid or incomplete multibyte or wide character} cÀ d}
+
+test io-75.15 {
+ invalid utf-8 encoding strict
+ gets does not hang
+ gets succeeds for the first two lines
+} -setup {
+ set res {}
+ set chan [file tempfile]
+ fconfigure $chan -encoding binary
+ # \xc0\x40 is an invalid utf-8 sequence
+ puts $chan hello\nAB\nCD\xc0\x40EF\nGHI
+ seek $chan 0
+} -body {
+ #Now try to read it with [gets]
+ fconfigure $chan -encoding utf-8 -profile strict
+ lappend res [gets $chan]
+ lappend res [gets $chan]
+ set status [catch {gets $chan} cres copts]
+ lappend res $status $cres
+ set status [catch {gets $chan} cres copts]
+ lappend res $status $cres
+ chan configure $chan -translation binary
+ set data [read $chan 4]
+ foreach char [split $data {}] {
+ scan $char %c ord
+ lappend res [format %x $ord]
+ }
+ fconfigure $chan -encoding utf-8 -profile strict -translation auto
+ lappend res [gets $chan]
+ lappend res [gets $chan]
+ return $res
+} -cleanup {
+ close $chan
+} -match glob -result {hello AB 1 {error reading "*": invalid or incomplete multibyte or wide character}\
+ 1 {error reading "*": invalid or incomplete multibyte or wide character} 43 44 c0 40 EF GHI}
# ### ### ### ######### ######### #########
@@ -9412,7 +9608,8 @@ test io-76.4 {channel mode dropping} -setup {
} -returnCodes error -cleanup {
close $f
removeFile dummy
-} -match glob -result {Tcl_RemoveChannelMode error: Bad mode, would make channel inacessible. Channel: "*"}
+} -match glob -result {Tcl_RemoveChannelMode error:\
+ Bad mode, would make channel inacessible. Channel: "*"}
test io-76.5 {channel mode dropping} -setup {
set datafile [makeFile {some characters} dummy]
@@ -9433,7 +9630,8 @@ test io-76.6 {channel mode dropping} -setup {
} -returnCodes error -cleanup {
close $f
removeFile dummy
-} -match glob -result {Tcl_RemoveChannelMode error: Bad mode, would make channel inacessible. Channel: "*"}
+} -match glob -result {Tcl_RemoveChannelMode error:\
+ Bad mode, would make channel inacessible. Channel: "*"}
test io-76.7 {channel mode dropping} -setup {
set datafile [makeFile {some characters} dummy]
@@ -9466,7 +9664,8 @@ test io-76.9 {channel mode dropping} -setup {
} -returnCodes error -cleanup {
close $f
removeFile dummy
-} -match glob -result {Tcl_RemoveChannelMode error: Bad mode, would make channel inacessible. Channel: "*"}
+} -match glob -result {Tcl_RemoveChannelMode error:\
+ Bad mode, would make channel inacessible. Channel: "*"}
test io-76.10 {channel mode dropping} -setup {
set datafile [makeFile {some characters} dummy]
@@ -9477,7 +9676,8 @@ test io-76.10 {channel mode dropping} -setup {
} -returnCodes error -cleanup {
close $f
removeFile dummy
-} -match glob -result {Tcl_RemoveChannelMode error: Bad mode, would make channel inacessible. Channel: "*"}
+} -match glob -result {Tcl_RemoveChannelMode error:\
+ Bad mode, would make channel inacessible. Channel: "*"}
# cleanup
foreach file [list fooBar longfile script script2 output test1 pipe my_script \
diff --git a/tests/ioCmd.test b/tests/ioCmd.test
index 399fd95..1c06ba3 100644
--- a/tests/ioCmd.test
+++ b/tests/ioCmd.test
@@ -266,7 +266,7 @@ test iocmd-8.9 {fconfigure command} -setup {
fconfigure $f1
} -cleanup {
catch {close $f1}
-} -result {-blocking 1 -buffering none -buffersize 4040 -encoding binary -eofchar {} -profile tcl8 -translation lf}
+} -result {-blocking 1 -buffering none -buffersize 4040 -encoding iso8859-1 -eofchar {} -profile tcl8 -translation lf}
test iocmd-8.10 {fconfigure command} -returnCodes error -body {
fconfigure a b
} -result {can not find channel named "a"}
@@ -496,11 +496,12 @@ test iocmd-12.10 {POSIX open access modes: BINARY} {
set result
} 5
test iocmd-12.11 {POSIX open access modes: BINARY} -body {
+ after 100
set f [open $path(test1) {WRONLY BINARY TRUNC}]
puts $f Ɉ ;# throws an exception
} -cleanup {
close $f
-} -returnCodes 1 -match glob -result {error writing "*": illegal byte sequence}
+} -returnCodes 1 -match glob -result {error writing "*": invalid or incomplete multibyte or wide character}
test iocmd-12.12 {POSIX open access modes: BINARY} {
set f [open $path(test1) {WRONLY BINARY TRUNC}]
puts $f H
@@ -688,7 +689,7 @@ test iocmd-20.1 {chan, unknown method} -body {
} -returnCodes error -match glob -result {unknown or ambiguous subcommand "foo": must be *}
# --- --- --- --------- --------- ---------
-# chan create, and method "initalize"
+# chan create, and method "initialize"
test iocmd-21.0 {chan create, wrong#args, not enough} {
catch {chan create} msg
@@ -698,12 +699,12 @@ test iocmd-21.1 {chan create, wrong#args, too many} {
catch {chan create a b c} msg
set msg
} {wrong # args: should be "chan create mode cmdprefix"}
-test iocmd-21.2 {chan create, invalid r/w mode, empty} {
- proc foo {} {}
- catch {chan create {} foo} msg
+test iocmd-21.2 {chan create, r/w mode empty} {
+ proc foo {cmd args} { return {initialize finalize watch} }
+ set chan [chan create {} foo]
+ close $chan
rename foo {}
- set msg
-} {bad mode list: is empty}
+} {}
test iocmd-21.3 {chan create, invalid r/w mode, bad string} {
proc foo {} {}
catch {chan create {c} foo} msg
@@ -1057,7 +1058,7 @@ test iocmd-23.1 {chan read, regular data return} -match glob -body {
rename foo {}
set res
} -result {{read rc* 4096} {read rc* 4096} snarfsnarf}
-test iocmd-23.2 {chan read, bad data return, to much} -match glob -body {
+test iocmd-23.2 {chan read, bad data return, too much} -match glob -body {
set res {}
proc foo {args} {
oninit; onfinal; track
@@ -2368,7 +2369,7 @@ test iocmd.tf-23.1 {chan read, regular data return} -match glob -body {
rename foo {}
set res
} -constraints {testchannel thread} -result {{read rc* 4096} {read rc* 4096} snarfsnarf}
-test iocmd.tf-23.2 {chan read, bad data return, to much} -match glob -body {
+test iocmd.tf-23.2 {chan read, bad data return, too much} -match glob -body {
set res {}
proc foo {args} {
oninit; onfinal; track
diff --git a/tests/ioTrans.test b/tests/ioTrans.test
index 9f6542c..45d2530 100644
--- a/tests/ioTrans.test
+++ b/tests/ioTrans.test
@@ -114,7 +114,7 @@ test iortrans-1.1 {chan, unknown method} -returnCodes error -body {
} -match glob -result {unknown or ambiguous subcommand "foo": must be*}
# --- --- --- --------- --------- ---------
-# chan push, and method "initalize"
+# chan push, and method "initialize"
test iortrans-2.0 {chan push, wrong#args, not enough} -returnCodes error -body {
chan push
@@ -1334,7 +1334,7 @@ test iortrans-11.2 {delete interp of reflected transform} -setup {
# ### ### ### ######### ######### #########
## Helper command. Runs a script in a separate thread and returns the result.
-## A channel is transfered into the thread as well, and a list of configuation
+## A channel is transferred into the thread as well, and a list of configuration
## variables
proc inthread {chan script args} {
@@ -2013,7 +2013,7 @@ test iortrans.tf-8.1 {seek flushes write buffers, ignores data} -setup {
# The close flushes again, this modifies the file!
lappend notes | [close $c] |
# NOTE: The flush generated by the close is recorded immediately, the
- # other note's here are defered until after the thread is done. This
+ # other note's here are deferred until after the thread is done. This
# changes the order of the result a bit from the non-threaded case
# (The first | moves one to the right). This is an artifact of the
# 'inthread' framework, not of the transformation itself.
diff --git a/tests/iogt.test b/tests/iogt.test
index 279a0dd..5692682 100644
--- a/tests/iogt.test
+++ b/tests/iogt.test
@@ -575,11 +575,11 @@ read {%^&*()_+-=
}
query/maxRead {} -1
flush/read {} {}
-query/maxRead {} -1
write %^&*()_+-= %^&*()_+-=
write {
} {
}
+query/maxRead {} -1
delete/read {} *ignored*
flush/write {} {}
delete/write {} *ignored*}
@@ -843,7 +843,7 @@ test iogt-6.0 {Push back} -constraints testchannel -body {
# expect to get "xxx" from the transform because of unread "def" input to
# transform which returns "xxx".
#
- # Actually the IO layer pre-read the whole file and will read "def"
+ # Actually the IO layer preread the whole file and will read "def"
# directly from the buffer without bothering to consult the newly stacked
# transformation. This is wrong.
read $f 3
diff --git a/tests/listObj.test b/tests/listObj.test
index c360fbb..c5ebbb0 100644
--- a/tests/listObj.test
+++ b/tests/listObj.test
@@ -22,6 +22,9 @@ catch [list package require -exact tcl::test [info patchlevel]]
testConstraint testobj [llength [info commands testobj]]
testConstraint memory [llength [info commands memory]]
+set INT_MAX 0x7fffffff; # Assumes sizeof(int) == 4
+set SIZE_MAX [expr {(1 << (8*$::tcl_platform(pointerSize) - 1)) - 1}]
+
catch {unset x}
test listobj-1.1 {Tcl_GetListObjType} emptyTest {
# Test removed; tested an internal detail
@@ -206,14 +209,14 @@ test listobj-10.3 {Tcl_ListObjReplace with negative count value} testobj {
testlistobj replace 1 1 -1 f
testlistobj get 1
} {a f b c d e}
-test listobj-10.4 {Tcl_ListObjReplace with UINT_MAX-1 count value} testobj {
+test listobj-10.4 {Tcl_ListObjReplace with $SIZE_MAX count value} testobj {
testlistobj set 1 a b c d e
- testlistobj replace 1 1 0xFFFFFFFE f
+ testlistobj replace 1 1 $SIZE_MAX f
testlistobj get 1
} {a f}
test listobj-10.5 {Tcl_ListObjReplace with SIZE_MAX-1 count value} testobj {
testlistobj set 1 a b c d e
- testlistobj replace 1 1 -2 f
+ testlistobj replace 1 1 [expr {$SIZE_MAX -1}] f
testlistobj get 1
} {a f}
diff --git a/tests/lsearch.test b/tests/lsearch.test
index 7c1402d..b8a8aa7 100644
--- a/tests/lsearch.test
+++ b/tests/lsearch.test
@@ -688,6 +688,9 @@ test lsearch-28.8 {lsearch -sorted with -stride} -body {
test lsearch-28.9 {lsearch -sorted with -stride} -body {
lsearch -sorted -stride 2 -index 1 -subindices -inline {3 5 8 7 2 9} 9
} -result 9
+test lsearch-28.10 {lsearch -sorted with -stride} -body {
+ lsearch -sorted -stride 4294967296 -index 1 -subindices -inline {3 5 8 7 2 9} 9
+} -returnCodes 1 -result {list size must be a multiple of the stride length}
# cleanup
diff --git a/tests/lseq.test b/tests/lseq.test
index 2529455..8a406cc 100644
--- a/tests/lseq.test
+++ b/tests/lseq.test
@@ -20,7 +20,7 @@ testConstraint arithSeriesShimmerOk 1
testConstraint knownBug 0
testConstraint has64BitLengths [expr {$tcl_platform(pointerSize) == 8}]
-## Arg errors
+# Arg errors
test lseq-1.1 {error cases} -body {
lseq
} \
@@ -417,9 +417,9 @@ test lseq-3.30 {lreverse with double values} arithSeriesDouble {
arithseries
18.5 17.0 15.5 14.0 12.5 11.0 9.5 8.0 6.5 5.0 3.5}
-test lseq-3.31 {lreverse inplace with doubles} arithSeriesDouble {
+test lseq-3.31 {lreverse inplace with doubles} {arithSeriesDouble has64BitLengths} {
lreverse [lseq 1.1 29.9 0.3]
-} {29.9 29.599999999999998 29.299999999999997 29.0 28.7 28.4 28.099999999999998 27.799999999999997 27.5 27.2 26.9 26.599999999999998 26.299999999999997 26.0 25.7 25.4 25.099999999999998 24.799999999999997 24.5 24.2 23.9 23.599999999999998 23.299999999999997 23.0 22.7 22.4 22.099999999999998 21.799999999999997 21.5 21.2 20.9 20.6 20.299999999999997 20.0 19.7 19.4 19.1 18.799999999999997 18.5 18.2 17.9 17.6 17.299999999999997 17.0 16.7 16.4 16.1 15.799999999999999 15.5 15.2 14.899999999999999 14.6 14.299999999999999 14.0 13.7 13.399999999999999 13.099999999999998 12.8 12.5 12.2 11.899999999999999 11.599999999999998 11.3 11.0 10.7 10.399999999999999 10.099999999999998 9.8 9.5 9.2 8.899999999999999 8.599999999999998 8.3 8.0 7.699999999999999 7.399999999999999 7.099999999999998 6.800000000000001 6.5 6.199999999999999 5.899999999999999 5.599999999999998 5.300000000000001 5.0 4.699999999999999 4.399999999999999 4.099999999999998 3.8000000000000007 3.5 3.1999999999999993 2.8999999999999986 2.599999999999998 2.3000000000000007 2.0 1.6999999999999993 1.3999999999999986 1.1000000000000014}
+} {29.9 29.6 29.3 29.0 28.7 28.4 28.1 27.8 27.5 27.2 26.9 26.6 26.3 26.0 25.7 25.4 25.1 24.8 24.5 24.2 23.9 23.6 23.3 23.0 22.7 22.4 22.1 21.8 21.5 21.2 20.9 20.6 20.3 20.0 19.7 19.4 19.1 18.8 18.5 18.2 17.9 17.6 17.3 17.0 16.7 16.4 16.1 15.8 15.5 15.2 14.9 14.6 14.3 14.0 13.7 13.4 13.1 12.8 12.5 12.2 11.9 11.6 11.3 11.0 10.7 10.4 10.1 9.8 9.5 9.2 8.9 8.6 8.3 8.0 7.7 7.4 7.1 6.8 6.5 6.2 5.9 5.6 5.3 5.0 4.7 4.4 4.1 3.8 3.5 3.2 2.9 2.6 2.3 2.0 1.7 1.4 1.1}
test lseq-4.1 {end expressions} {
set start 7
@@ -538,19 +538,12 @@ test lseq-4.8 {error case lrange} -body {
} -returnCodes 1 \
-result {bad index "fred": must be integer?[+-]integer? or end?[+-]integer?}
-test lseq-4.9 {error case lrange} -body {
- set fred 7
- set ginger 8
- lrange [lseq 1 10] $fred $ginger
-} -result {8 9}
-
-test lseq-4.10 {lset shimmer} -body {
- set l [lseq 15]
- lappend res $l [lindex [tcl::unsupported::representation $l] 3]
- lset l 3 25
- lappend res $l [lindex [tcl::unsupported::representation $l] 3]
-} -result {{0 1 2 3 4 5 6 7 8 9 10 11 12 13 14} arithseries {0 1 2 25 4 5 6 7 8 9 10 11 12 13 14} list}
-
+test lseq-4.9 {lrange empty/partial sets} -body {
+ foreach {fred ginger} {7 8 4 9 0 15 9 9 4 2} {
+ lappend res [lrange [lseq 1 5] $fred $ginger]
+ }
+ set res
+} -result {{} 5 {1 2 3 4 5} {} {}}
# Panic when using variable value?
test lseq-4.10 {panic using variable index} {
@@ -558,20 +551,39 @@ test lseq-4.10 {panic using variable index} {
lindex [lseq 10] $i
} {0}
-test lseq-4.11 {bug e5f06285de} knownBug {
- set a1 [lseq 4 40 0.1]
- set b1 [lseq 6 40 0.1]
- for {set i 0} {$i < [llength $b1]} {incr i} {
- set e1 [lindex $a1 $i+20]
- set e2 [lindex $b1 $i]
- set c1 [expr {4.0 + (double($i+20) * 0.1)}]
- set c2 [expr {6.0 + (double($i) * 0.1)}]
- if {[string compare $e1 $e2]} {
- lappend bad [list $i $e1 $e2 [format %g $e1]]
- }
- }
- set bad
-} {}
+test lseq-4.11 {bug lseq / lindex discrepancies} -constraints has64BitLengths -body {
+ lindex [lseq 0x7fffffff] 0x80000000
+} -result {}
+
+test lseq-4.12 {bug lseq} -constraints has64BitLengths -body {
+ llength [lseq 0x100000000]
+} -result {4294967296}
+
+test lseq-4.13 {bug lseq} -constraints has64BitLengths -body {
+ set l [lseq 0x7fffffffffffffff]
+ list \
+ [llength $l] \
+ [lindex $l end] \
+ [lindex $l 9223372036854775800]
+} -result {9223372036854775807 9223372036854775806 9223372036854775800}
+
+
+test lseq-4.14 {bug lseq - inconsistent rounding} has64BitLengths {
+ # using a non-integer increment, [lseq] rounding seems to be not consistent:
+ lseq 4 40 0.1
+} {4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 6.0 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 9.0 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9 10.0 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 11.0 11.1 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 12.0 12.1 12.2 12.3 12.4 12.5 12.6 12.7 12.8 12.9 13.0 13.1 13.2 13.3 13.4 13.5 13.6 13.7 13.8 13.9 14.0 14.1 14.2 14.3 14.4 14.5 14.6 14.7 14.8 14.9 15.0 15.1 15.2 15.3 15.4 15.5 15.6 15.7 15.8 15.9 16.0 16.1 16.2 16.3 16.4 16.5 16.6 16.7 16.8 16.9 17.0 17.1 17.2 17.3 17.4 17.5 17.6 17.7 17.8 17.9 18.0 18.1 18.2 18.3 18.4 18.5 18.6 18.7 18.8 18.9 19.0 19.1 19.2 19.3 19.4 19.5 19.6 19.7 19.8 19.9 20.0 20.1 20.2 20.3 20.4 20.5 20.6 20.7 20.8 20.9 21.0 21.1 21.2 21.3 21.4 21.5 21.6 21.7 21.8 21.9 22.0 22.1 22.2 22.3 22.4 22.5 22.6 22.7 22.8 22.9 23.0 23.1 23.2 23.3 23.4 23.5 23.6 23.7 23.8 23.9 24.0 24.1 24.2 24.3 24.4 24.5 24.6 24.7 24.8 24.9 25.0 25.1 25.2 25.3 25.4 25.5 25.6 25.7 25.8 25.9 26.0 26.1 26.2 26.3 26.4 26.5 26.6 26.7 26.8 26.9 27.0 27.1 27.2 27.3 27.4 27.5 27.6 27.7 27.8 27.9 28.0 28.1 28.2 28.3 28.4 28.5 28.6 28.7 28.8 28.9 29.0 29.1 29.2 29.3 29.4 29.5 29.6 29.7 29.8 29.9 30.0 30.1 30.2 30.3 30.4 30.5 30.6 30.7 30.8 30.9 31.0 31.1 31.2 31.3 31.4 31.5 31.6 31.7 31.8 31.9 32.0 32.1 32.2 32.3 32.4 32.5 32.6 32.7 32.8 32.9 33.0 33.1 33.2 33.3 33.4 33.5 33.6 33.7 33.8 33.9 34.0 34.1 34.2 34.3 34.4 34.5 34.6 34.7 34.8 34.9 35.0 35.1 35.2 35.3 35.4 35.5 35.6 35.7 35.8 35.9 36.0 36.1 36.2 36.3 36.4 36.5 36.6 36.7 36.8 36.9 37.0 37.1 37.2 37.3 37.4 37.5 37.6 37.7 37.8 37.9 38.0 38.1 38.2 38.3 38.4 38.5 38.6 38.7 38.8 38.9 39.0 39.1 39.2 39.3 39.4 39.5 39.6 39.7 39.8 39.9 40.0}
+
+test lseq-4.15 {bug lseq - inconsistent rounding} has64BitLengths {
+ # using a non-integer increment, [lseq] rounding seems to be not consistent:
+ lseq 6 40 0.1
+} {6.0 6.1 6.2 6.3 6.4 6.5 6.6 6.7 6.8 6.9 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 8.5 8.6 8.7 8.8 8.9 9.0 9.1 9.2 9.3 9.4 9.5 9.6 9.7 9.8 9.9 10.0 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 11.0 11.1 11.2 11.3 11.4 11.5 11.6 11.7 11.8 11.9 12.0 12.1 12.2 12.3 12.4 12.5 12.6 12.7 12.8 12.9 13.0 13.1 13.2 13.3 13.4 13.5 13.6 13.7 13.8 13.9 14.0 14.1 14.2 14.3 14.4 14.5 14.6 14.7 14.8 14.9 15.0 15.1 15.2 15.3 15.4 15.5 15.6 15.7 15.8 15.9 16.0 16.1 16.2 16.3 16.4 16.5 16.6 16.7 16.8 16.9 17.0 17.1 17.2 17.3 17.4 17.5 17.6 17.7 17.8 17.9 18.0 18.1 18.2 18.3 18.4 18.5 18.6 18.7 18.8 18.9 19.0 19.1 19.2 19.3 19.4 19.5 19.6 19.7 19.8 19.9 20.0 20.1 20.2 20.3 20.4 20.5 20.6 20.7 20.8 20.9 21.0 21.1 21.2 21.3 21.4 21.5 21.6 21.7 21.8 21.9 22.0 22.1 22.2 22.3 22.4 22.5 22.6 22.7 22.8 22.9 23.0 23.1 23.2 23.3 23.4 23.5 23.6 23.7 23.8 23.9 24.0 24.1 24.2 24.3 24.4 24.5 24.6 24.7 24.8 24.9 25.0 25.1 25.2 25.3 25.4 25.5 25.6 25.7 25.8 25.9 26.0 26.1 26.2 26.3 26.4 26.5 26.6 26.7 26.8 26.9 27.0 27.1 27.2 27.3 27.4 27.5 27.6 27.7 27.8 27.9 28.0 28.1 28.2 28.3 28.4 28.5 28.6 28.7 28.8 28.9 29.0 29.1 29.2 29.3 29.4 29.5 29.6 29.7 29.8 29.9 30.0 30.1 30.2 30.3 30.4 30.5 30.6 30.7 30.8 30.9 31.0 31.1 31.2 31.3 31.4 31.5 31.6 31.7 31.8 31.9 32.0 32.1 32.2 32.3 32.4 32.5 32.6 32.7 32.8 32.9 33.0 33.1 33.2 33.3 33.4 33.5 33.6 33.7 33.8 33.9 34.0 34.1 34.2 34.3 34.4 34.5 34.6 34.7 34.8 34.9 35.0 35.1 35.2 35.3 35.4 35.5 35.6 35.7 35.8 35.9 36.0 36.1 36.2 36.3 36.4 36.5 36.6 36.7 36.8 36.9 37.0 37.1 37.2 37.3 37.4 37.5 37.6 37.7 37.8 37.9 38.0 38.1 38.2 38.3 38.4 38.5 38.6 38.7 38.8 38.9 39.0 39.1 39.2 39.3 39.4 39.5 39.6 39.7 39.8 39.9 40.0}
+
+test lseq-4.16 {bug lseq - inconsistent rounding} {
+ # using a non-integer increment, [lseq] rounding seems to be not consistent:
+ set res {}
+ lappend res [lseq 4.07 6 0.1]
+ lappend res [lseq 4.03 4.208 0.013]
+} {{4.07 4.17 4.27 4.37 4.47 4.57 4.67 4.77 4.87 4.97 5.07 5.17 5.27 5.37 5.47 5.57 5.67 5.77 5.87 5.97} {4.03 4.043 4.056 4.069 4.082 4.095 4.108 4.121 4.134 4.147 4.16 4.173 4.186 4.199}}
# cleanup
::tcltest::cleanupTests
diff --git a/tests/mathop.test b/tests/mathop.test
index 6b56c8b..57d48d6 100644
--- a/tests/mathop.test
+++ b/tests/mathop.test
@@ -22,7 +22,7 @@ namespace eval ::testmathop2 {
}
# Helper to test math ops.
-# Test different invokation variants and see that they do the same thing.
+# Test different invocation variants and see that they do the same thing.
# Byte compiled / non byte compiled version
# Shared / unshared arguments
# Original / imported
diff --git a/tests/msgcat.test b/tests/msgcat.test
index 4549cee..6d2ba2c 100644
--- a/tests/msgcat.test
+++ b/tests/msgcat.test
@@ -1055,7 +1055,7 @@ if {[package vsatisfies [package provide msgcat] 1.7]} {
variable locale
if {![info exist locale]} { set locale [mclocale] }
- test msgcat-14.1 {invokation loadcmd} -setup {
+ test msgcat-14.1 {invocation loadcmd} -setup {
mcforgetpackage
mclocale $locale
mclocale ""
@@ -1069,7 +1069,7 @@ if {[package vsatisfies [package provide msgcat] 1.7]} {
lsort $resultvariable
} -result {foo foo_bar}
- test msgcat-14.2 {invokation failed in loadcmd} -setup {
+ test msgcat-14.2 {invocation failed in loadcmd} -setup {
mcforgetpackage
mclocale $locale
mclocale ""
@@ -1087,7 +1087,7 @@ if {[package vsatisfies [package provide msgcat] 1.7]} {
list $err [dict get $errdict -code]
} -result {fail 1}
- test msgcat-14.3 {invokation changecmd} -setup {
+ test msgcat-14.3 {invocation changecmd} -setup {
mcforgetpackage
mclocale $locale
mclocale ""
@@ -1100,7 +1100,7 @@ if {[package vsatisfies [package provide msgcat] 1.7]} {
set resultvariable
} -result {foo_bar foo {}}
- test msgcat-14.4 {invokation unknowncmd} -setup {
+ test msgcat-14.4 {invocation unknowncmd} -setup {
mcforgetpackage
mclocale $locale
mclocale ""
diff --git a/tests/ooNext2.test b/tests/ooNext2.test
index 746f9a5..8d8cf45 100644
--- a/tests/ooNext2.test
+++ b/tests/ooNext2.test
@@ -126,7 +126,7 @@ test oo-nextto-1.3 {basic nextto functionality: constructors} -setup {
variable result
constructor {p q r} {
lappend result ==C== p=$p,q=$q,r=$r
- # Route arguments to superclasses, in non-trival pattern
+ # Route arguments to superclasses, in non-trivial pattern
nextto B $q
nextto A $p $r
}
diff --git a/tests/pkgMkIndex.test b/tests/pkgMkIndex.test
index 390154a..49f5849 100644
--- a/tests/pkgMkIndex.test
+++ b/tests/pkgMkIndex.test
@@ -490,7 +490,7 @@ removeFile [file join pkg pkg2_b.tcl]
makeFile {
# This package requires circ2, and circ2 requires circ3, which in turn
-# requires circ1. In case of cirularities, pkg_mkIndex should give up when
+# requires circ1. In case of circularities, pkg_mkIndex should give up when
# it gets stuck.
package require circ2 1.0
package provide circ1 1.0
@@ -654,7 +654,7 @@ test pkgMkIndex-12.1 {same name procs in different namespace} {
removeFile [file join pkg samename.tcl]
-# Proc names with embedded spaces are properly listed (ie, correct number of
+# Proc names with embedded spaces are properly listed (i.e. correct number of
# braces) in result
makeFile {
package provide spacename 1.0
diff --git a/tests/remote.tcl b/tests/remote.tcl
index 6bc4b17..eee551a 100644
--- a/tests/remote.tcl
+++ b/tests/remote.tcl
@@ -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.
-# Initialize message delimitor
+# Initialize message delimiter
# Initialize command array
catch {unset command}
diff --git a/tests/resolver.test b/tests/resolver.test
index 51df07c..ea84956 100644
--- a/tests/resolver.test
+++ b/tests/resolver.test
@@ -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 child
+# reproducible and to minimize interactions between test cases, we use a child
# interpreter per test-case.
#
#
diff --git a/tests/safe-stock.test b/tests/safe-stock.test
index d23d86e..24e90a0 100644
--- a/tests/safe-stock.test
+++ b/tests/safe-stock.test
@@ -97,8 +97,8 @@ proc mapAndSortList {map listIn} {
lsort $listOut
}
-# Force actual loading of the safe package because we use un-exported (and
-# thus un-autoindexed) APIs in this test result arguments:
+# Force actual loading of the safe package because we use unexported (and
+# thus unautoindexed) APIs in this test result arguments:
catch {safe::interpConfigure}
testConstraint AutoSyncDefined 1
diff --git a/tests/safe.test b/tests/safe.test
index d81da0a..8af6c24 100644
--- a/tests/safe.test
+++ b/tests/safe.test
@@ -56,8 +56,8 @@ proc mapAndSortList {map listIn} {
lsort $listOut
}
-# Force actual loading of the safe package because we use un-exported (and
-# thus un-autoindexed) APIs in this test result arguments:
+# Force actual loading of the safe package because we use unexported (and
+# thus unautoindexed) APIs in this test result arguments:
catch {safe::interpConfigure}
# testing that nested and statics do what is advertised (we use a static
diff --git a/tests/scan.test b/tests/scan.test
index 03a5b46..6d7a9fb 100644
--- a/tests/scan.test
+++ b/tests/scan.test
@@ -508,7 +508,7 @@ test scan-5.10 {integer scanning} -setup {
list [scan "1 2 " "%hd %d %d %d" a b c d] $a $b $c $d
} -result {2 1 2 {} {}}
#
-# The behavior for scaning intergers larger than MAX_INT is not defined by the
+# The behavior for scanning integers larger than MAX_INT is not defined by the
# ANSI spec. Some implementations wrap the input (-16) some return MAX_INT.
#
test scan-5.11 {integer scanning} -constraints {nonPortable} -setup {
@@ -858,6 +858,12 @@ test scan-13.8 {Tcl_ScanObjCmd, inline XPG case lots of arguments} {
set msg [scan "10 20 30" {%100$d %5$d %200$d}]
list [llength $msg] [lindex $msg 99] [lindex $msg 4] [lindex $msg 199]
} {200 10 20 30}
+test scan-13.9 {Tcl_ScanObjCmd, inline XPG case limit error} -body {
+ # Note this applies to 64-bit builds as well so long as max number of
+ # command line arguments allowed for scan command is INT_MAX
+ scan abc {%2147483648$s}
+} -result {"%n$" argument index out of range} -returnCodes error
+
# scan infinities - not working
diff --git a/tests/socket.test b/tests/socket.test
index b1435be..82e908a 100644
--- a/tests/socket.test
+++ b/tests/socket.test
@@ -127,7 +127,7 @@ set t2 [clock milliseconds]
set lat1 [expr {($t2-$t1)*2}]; # doubled as a safety margin
# Test the latency of failed connection attempts over the loopback
-# interface. They can take more than a second under Windowos and requres
+# interface. They can take more than a second under Windows and requires
# additional [after]s in some tests that are not needed on systems that fail
# immediately.
set t1 [clock milliseconds]
@@ -1864,7 +1864,7 @@ proc transf_test {{testmode transfer} {maxIter 1000} {maxTime 10000}} {
set srvsock {}
# if binding on port 0 is not possible (system related, blocked on ISPs etc):
if {[catch {close [socket -async $::localhost $port]}]} {
- # simplest server on random port (immediatelly closing a connect):
+ # simplest server on random port (immediately closing a connect):
set port [randport]
set srvsock [socket -server {apply {{ch args} {close $ch}}} -myaddr $::localhost $port]
# socket on windows has some issues yet (e. g. bug [b6d0d8cc2c]), so we simply decrease iteration count (to 1/4):
@@ -1898,7 +1898,7 @@ proc transf_test {{testmode transfer} {maxIter 1000} {maxTime 10000}} {
}
iteration first
}
- # parent proc commiting transfer attempt (attach) and checking acquire was successful:
+ # parent proc committing transfer attempt (attach) and checking acquire was successful:
proc transf_parent {fd args} {
tcltest::DebugPuts 2 "** trma / $::count ** $args **"
thread::attach $fd
@@ -2226,7 +2226,7 @@ test socket-14.7.2 {pending [socket -async] and blocking [gets], no listener} \
list $x [fconfigure $sock -error] [fconfigure $sock -error]
} -cleanup {
close $sock
- } -match glob -result {{error reading "sock*": socket is not connected} {connection refused} {}}
+ } -match glob -result {{error reading "sock*": transport endpoint is not connected} {connection refused} {}}
test socket-14.8.0 {pending [socket -async] and nonblocking [gets], server is IPv4} \
-constraints {socket supported_inet localhost_v4} \
-setup {
@@ -2291,7 +2291,7 @@ test socket-14.8.2 {pending [socket -async] and nonblocking [gets], no listener}
list $x [fconfigure $sock -error] [fconfigure $sock -error]
} -cleanup {
close $sock
- } -match glob -result {{error reading "sock*": socket is not connected} {connection refused} {}}
+ } -match glob -result {{error reading "sock*": transport endpoint is not connected} {connection refused} {}}
test socket-14.9.0 {pending [socket -async] and blocking [puts], server is IPv4} \
-constraints {socket supported_inet localhost_v4} \
-setup {
@@ -2406,7 +2406,7 @@ test socket-14.11.0 {pending [socket -async] and nonblocking [puts], no listener
} -cleanup {
catch {close $sock}
unset x
- } -result {socket is not connected} -returnCodes 1
+ } -result {transport endpoint is not connected} -returnCodes 1
test socket-14.11.1 {pending [socket -async] and nonblocking [puts], no listener, flush} \
-constraints {socket testsocket_testflags} \
-body {
@@ -2425,7 +2425,7 @@ test socket-14.11.1 {pending [socket -async] and nonblocking [puts], no listener
} -cleanup {
catch {close $sock}
catch {unset x}
- } -result {socket is not connected} -returnCodes 1
+ } -result {transport endpoint is not connected} -returnCodes 1
test socket-14.12 {[socket -async] background progress triggered by [fconfigure -error]} \
-constraints {socket} \
-body {
@@ -2447,7 +2447,7 @@ test socket-14.13 {testing writable event when quick failure} \
# Test for bug 336441ed59 where a quick background fail was ignored
# Test only for windows as socket -async 255.255.255.255 fails
- # directly on unix
+ # directly on Unix
# The following connect should fail very quickly
set a1 [after 2000 {set x timeout}]
diff --git a/tests/stringObj.test b/tests/stringObj.test
index 492e0eb..4245a13 100644
--- a/tests/stringObj.test
+++ b/tests/stringObj.test
@@ -31,6 +31,9 @@ test stringObj-1.1 {string type registration} testobj {
set result [expr {$first >= 0}]
} 1
+set INT_MAX 0x7fffffff; # Assumes sizeof(int) == 4
+set SIZE_MAX [expr {(1 << (8*$::tcl_platform(pointerSize) - 1)) - 1}]
+
test stringObj-2.1 {Tcl_NewStringObj} testobj {
set result ""
lappend result [testobj freeallvars]
@@ -315,7 +318,7 @@ test stringObj-9.10 {TclAppendObjToObj, integer src & mixed dest} testobj {
test stringObj-9.11 {TclAppendObjToObj, mixed src & 1-byte dest index check} testobj {
# bug 2678, in <=8.2.0, the second obj (the one to append) in
# Tcl_AppendObjToObj was not correctly checked to see if it was all one
- # byte chars, so a unicode string would be added as one byte chars.
+ # byte chars, so a Unicode string would be added as one byte chars.
set x abcdef
set len [string length $x]
set y a\xFCb\xE5c\xEF
@@ -408,13 +411,13 @@ test stringObj-13.4 {Tcl_GetCharLength with mixed width chars} testobj {
} 1
test stringObj-13.5 {Tcl_GetCharLength with mixed width chars} testobj {
# string length "○○"
- # Use \uXXXX notation below instead of hardcoding the values, otherwise
+ # Use \uXXXX notation below instead of hard-coding the values, otherwise
# the test will fail in multibyte locales.
string length "\xEF\xBF\xAE\xEF\xBF\xAE"
} 6
test stringObj-13.6 {Tcl_GetCharLength with mixed width chars} testobj {
# set a "ïa¿b®cï¿d®"
- # Use \uXXXX notation below instead of hardcoding the values, otherwise
+ # Use \uXXXX notation below instead of hard-coding the values, otherwise
# the test will fail in multibyte locales.
set a "\xEFa\xBFb\xAEc\xEF\xBFd\xAE"
list [string length $a] [string length $a]
@@ -500,29 +503,30 @@ test stringObj-16.6 {Tcl_GetRange: old anomaly} testobj {
teststringobj set 1 abcde
teststringobj range 1 2 0
} {}
-test stringObj-16.7 {Tcl_GetRange: first = UINT_MAX-1} testobj {
+test stringObj-16.7 {Tcl_GetRange: first = INT_MAX-1} testobj {
teststringobj set 1 abcde
- teststringobj range 1 0xFFFFFFFE 3
+ teststringobj range 1 [expr {$INT_MAX-1}] 3
} {}
test stringObj-16.8 {Tcl_GetRange: first = SIZE_MAX-1} testobj {
teststringobj set 1 abcde
- teststringobj range 1 -2 3
+ teststringobj range 1 [expr {$SIZE_MAX - 1}] 3
} {}
-test stringObj-16.9 {Tcl_GetRange: last = UINT_MAX-1} testobj {
+test stringObj-16.9 {Tcl_GetRange: last = INT_MAX-1} testobj {
teststringobj set 1 abcde
- teststringobj range 1 1 0xFFFFFFFE
+ teststringobj range 1 1 [expr {$INT_MAX-1}]
} bcde
test stringObj-16.10 {Tcl_GetRange: last = SIZE_MAX-1} testobj {
teststringobj set 1 abcde
- teststringobj range 1 1 -2
+ teststringobj range 1 1 [expr {$SIZE_MAX - 1}]
} bcde
-test stringObj-16.11 {Tcl_GetRange: first = last = UINT_MAX-1} testobj {
+test stringObj-16.11 {Tcl_GetRange: first = last = INT_MAX-1} testobj {
teststringobj set 1 abcde
- teststringobj range 1 0xFFFFFFFE 0xFFFFFFFE
+ teststringobj range 1 [expr {$INT_MAX-1}] [expr {$INT_MAX-1}]
} {}
test stringObj-16.12 {Tcl_GetRange: first = last = SIZE_MAX-1} testobj {
teststringobj set 1 abcde
- teststringobj range 1 -2 -2
+ set i [expr {$SIZE_MAX - 1}]
+ teststringobj range 1 $i $i
} {}
if {[testConstraint testobj]} {
diff --git a/tests/tcltest.test b/tests/tcltest.test
index 19d0ad2..20d75bb 100644
--- a/tests/tcltest.test
+++ b/tests/tcltest.test
@@ -542,21 +542,21 @@ test tcltest-8.2 {tcltest a.tcl -tmpdir thisdirectoryisafile} {
-result {*not a directory*}
-match glob
}
-# Test non-writeable directories, non-readable directories with directory flags
+# Test non-writable directories, non-readable directories with directory flags
set notReadableDir [file join [temporaryDirectory] notreadable]
-set notWriteableDir [file join [temporaryDirectory] notwriteable]
+set notWritableDir [file join [temporaryDirectory] notwritable]
makeDirectory notreadable
-makeDirectory notwriteable
+makeDirectory notwritable
switch -- $::tcl_platform(platform) {
unix {
file attributes $notReadableDir -permissions 0o333
- file attributes $notWriteableDir -permissions 0o555
+ file attributes $notWritableDir -permissions 0o555
}
default {
# note in FAT/NTFS we won't be able to protect directory with read-only attribute...
- catch {file attributes $notWriteableDir -readonly 1}
- catch {testchmod 0o444 $notWriteableDir}
+ catch {file attributes $notWritableDir -readonly 1}
+ catch {testchmod 0o444 $notWritableDir}
}
}
test tcltest-8.3 {tcltest a.tcl -tmpdir notReadableDir} {
@@ -571,17 +571,17 @@ test tcltest-8.3 {tcltest a.tcl -tmpdir notReadableDir} {
# This constraint doesn't go at the top of the file so that it doesn't
# interfere with tcltest-5.5
testConstraint notFAT [expr {
- ![regexp {^(FAT\d*|NTFS)$} [lindex [file system $notWriteableDir] 1]]
+ ![regexp {^(FAT\d*|NTFS)$} [lindex [file system $notWritableDir] 1]]
|| $::tcl_platform(platform) eq "unix" || [llength [info commands testchmod]]
}]
# FAT/NTFS permissions are fairly hopeless; ignore this test if that FS is used
-test tcltest-8.4 {tcltest a.tcl -tmpdir notWriteableDir} {
+test tcltest-8.4 {tcltest a.tcl -tmpdir notWritableDir} {
-constraints {unixOrWin notRoot notFAT notWsl}
-body {
- child msg $a -tmpdir $notWriteableDir
+ child msg $a -tmpdir $notWritableDir
return $msg
}
- -result {*not writeable*}
+ -result {*not writable*}
-match glob
}
test tcltest-8.5 {tcltest a.tcl -tmpdir normaldirectory} {
@@ -721,15 +721,15 @@ test tcltest-8.60 {::workingDirectory} {
switch -- $::tcl_platform(platform) {
unix {
file attributes $notReadableDir -permissions 0o777
- file attributes $notWriteableDir -permissions 0o777
+ file attributes $notWritableDir -permissions 0o777
}
default {
- catch {testchmod 0o777 $notWriteableDir}
- catch {file attributes $notWriteableDir -readonly 0}
+ catch {testchmod 0o777 $notWritableDir}
+ catch {file attributes $notWritableDir -readonly 0}
}
}
-file delete -force -- $notReadableDir $notWriteableDir
+file delete -force -- $notReadableDir $notWritableDir
removeFile a.tcl
removeFile thisdirectoryisafile
removeDirectory normaldirectory
diff --git a/tests/tcltests.tcl b/tests/tcltests.tcl
index a2251bf..61366a4 100644
--- a/tests/tcltests.tcl
+++ b/tests/tcltests.tcl
@@ -34,6 +34,18 @@ namespace eval ::tcltests {
}
+ # Stolen from dict.test
+ proc scriptmemcheck script {
+ set end [lindex [split [memory info] \n] 3 3]
+ for {set i 0} {$i < 5} {incr i} {
+ uplevel 1 $script
+ set tmp $end
+ set end [lindex [split [memory info] \n] 3 3]
+ }
+ expr {$end - $tmp}
+ }
+
+
proc tempdir_alternate {} {
close [file tempfile tempfile]
set tmpdir [file dirname $tempfile]
diff --git a/tests/unixFCmd.test b/tests/unixFCmd.test
index e1084af..09a34dd 100644
--- a/tests/unixFCmd.test
+++ b/tests/unixFCmd.test
@@ -26,7 +26,7 @@ testConstraint notWsl [expr {[llength [array names ::env *WSL*]] == 0}]
set oldcwd [pwd]
cd [temporaryDirectory]
-# Several tests require need to match results against the unix username
+# Several tests require need to match results against the Unix username
set user {}
if {[testConstraint unix]} {
catch {set user [exec whoami]}
@@ -112,7 +112,7 @@ test unixFCmd-1.2 {TclpRenameFile: EEXIST} -setup {
file rename td2 td1
} -returnCodes error -cleanup {
cleanup
-} -result {error renaming "td2" to "td1/td2": file already exists}
+} -result {error renaming "td2" to "td1/td2": file exists}
test unixFCmd-1.3 {TclpRenameFile: EINVAL} -setup {
cleanup
} -constraints {unix notRoot} -body {
@@ -387,7 +387,7 @@ file delete -force -- foo.test
test unixFCmd-18.1 {Unix pwd} -constraints {unix notRoot nonPortable} -setup {
set cd [pwd]
} -body {
- # This test is nonPortable because SunOS generates a weird error
+ # This test is non-portable because SunOS generates a weird error
# message when the current directory isn't readable.
set nd $cd/tstdir
file mkdir $nd
diff --git a/tests/unixForkEvent.test b/tests/unixForkEvent.test
index f321b10..bf22449 100644
--- a/tests/unixForkEvent.test
+++ b/tests/unixForkEvent.test
@@ -17,7 +17,7 @@ testConstraint testfork [llength [info commands testfork]]
# Test if the notifier thread is well initialized in a forked interpreter
# by Tcl_InitNotifier
-test unixforkevent-1.1 {fork and test writeable event} \
+test unixforkevent-1.1 {fork and test writable event} \
-constraints {testfork nonPortable} \
-body {
set myFolder [makeDirectory unixtestfork]
diff --git a/tests/winConsole.test b/tests/winConsole.test
index f030444..3104184 100644
--- a/tests/winConsole.test
+++ b/tests/winConsole.test
@@ -344,7 +344,7 @@ test console-fconfigure-set-3.0 {
fconfigure stderr -winsize
} -constraints {win interactive} -body {
fconfigure stderr -winsize {10 30}
-} -result {bad option "-winsize": should be one of -blocking, -buffering, -buffersize, -encoding, -eofchar, or -profile, -translation} -returnCodes error
+} -result {bad option "-winsize": should be one of -blocking, -buffering, -buffersize, -encoding, -eofchar, -profile, or -translation} -returnCodes error
# Multiple threads
diff --git a/tests/winDde.test b/tests/winDde.test
index 14308c7..93b9242 100644
--- a/tests/winDde.test
+++ b/tests/winDde.test
@@ -154,15 +154,15 @@ test winDde-3.5 {DDE request locally} -constraints dde -body {
dde execute TclEval self [list set \xe1 foo]
dde request -binary TclEval self \xe1
} -result "foo\x00"
-# Set variable a to A with diaeresis (unicode C4) by relying on the fact
+# Set variable a to A with diaeresis (Unicode C4) by relying on the fact
# 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
} -result 196
-# Set variable a to A with diaeresis (unicode C4) using binary execute
-# and compose utf-8 (e.g. "c3 84" ) manualy
+# Set variable a to A with diaeresis (Unicode C4) using binary execute
+# and compose utf-8 (e.g. "c3 84" ) manually
test winDde-3.7 {DDE request binary} -constraints {dde notWine} -body {
set \xe1 "not set"
dde execute -binary TclEval self [list set \xc3\xa1 \xc3\x84\x00]
diff --git a/tests/winFCmd.test b/tests/winFCmd.test
index 3be1920..9b5e67e 100644
--- a/tests/winFCmd.test
+++ b/tests/winFCmd.test
@@ -123,7 +123,7 @@ append longname $longname
# Uses the "testfile" command instead of the "file" command. The "file"
# command provides several layers of sanity checks on the arguments and
# it can be difficult to actually forward "insane" arguments to the
-# low-level posix emulation layer.
+# low-level Posix emulation layer.
test winFCmd-1.1 {TclpRenameFile: errno: EACCES} -body {
testfile mv $cdfile $cdrom/dummy~~.fil
diff --git a/tests/zlib.test b/tests/zlib.test
index 720fdd6..93c568b 100644
--- a/tests/zlib.test
+++ b/tests/zlib.test
@@ -292,7 +292,7 @@ test zlib-8.6 {transformation and fconfigure} -setup {
} -cleanup {
catch {close $fd}
removeFile $file
-} -result {{-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile tcl8 -translation lf} {-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile tcl8 -translation lf -checksum 1 -dictionary {}} {-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile tcl8 -translation lf}}
+} -result {{-blocking 1 -buffering full -buffersize 4096 -encoding iso8859-1 -eofchar {} -profile strict -translation lf} {-blocking 1 -buffering full -buffersize 4096 -encoding iso8859-1 -eofchar {} -profile strict -translation lf -checksum 1 -dictionary {}} {-blocking 1 -buffering full -buffersize 4096 -encoding iso8859-1 -eofchar {} -profile strict -translation lf}}
test zlib-8.7 {transformation and fconfigure} -setup {
set file [makeFile {} test.gz]
set fd [open $file wb]
@@ -302,7 +302,7 @@ test zlib-8.7 {transformation and fconfigure} -setup {
} -cleanup {
catch {close $fd}
removeFile $file
-} -result {{-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile tcl8 -translation lf} {-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile tcl8 -translation lf -checksum 0} {-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile tcl8 -translation lf}}
+} -result {{-blocking 1 -buffering full -buffersize 4096 -encoding iso8859-1 -eofchar {} -profile strict -translation lf} {-blocking 1 -buffering full -buffersize 4096 -encoding iso8859-1 -eofchar {} -profile strict -translation lf -checksum 0} {-blocking 1 -buffering full -buffersize 4096 -encoding iso8859-1 -eofchar {} -profile strict -translation lf}}
# Input is headers from fetching SPDY draft
# Dictionary is that which is proposed _in_ SPDY draft
set spdyHeaders "HTTP/1.0 200 OK\r\nContent-Type: text/html; charset=utf-8\r\nX-Robots-Tag: noarchive\r\nLast-Modified: Tue, 05 Jun 2012 02:43:25 GMT\r\nETag: \"1338864205129|#public|0|en|||0\"\r\nExpires: Tue, 05 Jun 2012 16:17:11 GMT\r\nDate: Tue, 05 Jun 2012 16:17:06 GMT\r\nCache-Control: public, max-age=5\r\nX-Content-Type-Options: nosniff\r\nX-XSS-Protection: 1; mode=block\r\nServer: GSE\r\n"