From eb3bdd1436d6f44483a5067f3d7021ca26e2cce6 Mon Sep 17 00:00:00 2001 From: dgp Date: Thu, 28 Oct 2004 00:00:44 +0000 Subject: * tests/appendComp.test: Backport test suite fixes of errors * tests/autoMkindex.test: revealed by -singleproc 1 -debug 1 * tests/exec.test: options to make test. * tests/execute.test: * tests/interp.test: * tests/io.test: * tests/namespace.test: * tests/regexpComp.test: * tests/stringComp.test: * tests/unixInit.test: * tests/winPipe.test: --- ChangeLog | 14 +++ tests/appendComp.test | 6 +- tests/autoMkindex.test | 8 +- tests/exec.test | 5 +- tests/execute.test | 12 ++- tests/interp.test | 14 +-- tests/io.test | 6 +- tests/namespace.test | 4 +- tests/regexpComp.test | 262 ++++++++++++++++++++++---------------------- tests/stringComp.test | 288 ++++++++++++++++++++++++------------------------- tests/unixInit.test | 5 +- tests/winPipe.test | 3 +- 12 files changed, 325 insertions(+), 302 deletions(-) diff --git a/ChangeLog b/ChangeLog index 59e4f7b..bf7f3dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2004-10-27 Don Porter + + * tests/appendComp.test: Backport test suite fixes of errors + * tests/autoMkindex.test: revealed by -singleproc 1 -debug 1 + * tests/exec.test: options to make test. + * tests/execute.test: + * tests/interp.test: + * tests/io.test: + * tests/namespace.test: + * tests/regexpComp.test: + * tests/stringComp.test: + * tests/unixInit.test: + * tests/winPipe.test: + 2004-10-26 Kevin B. Kenny * generic/tclCmdAH.c (Tcl_FormatObjCmd): Backport a missing bit diff --git a/tests/appendComp.test b/tests/appendComp.test index e5c96f8..16ffb32 100644 --- a/tests/appendComp.test +++ b/tests/appendComp.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: appendComp.test,v 1.5 2001/11/23 01:25:38 das Exp $ +# RCS: @(#) $Id: appendComp.test,v 1.5.4.1 2004/10/28 00:01:05 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -198,11 +198,11 @@ test appendComp-4.18 {lappend command} { proc foo {} { lappend x {} } foo } {{}} -test append-4.19 {lappend command} { +test appendComp-4.19 {lappend command} { proc foo {} { lappend x(0) } foo } {} -test append-4.20 {lappend command} { +test appendComp-4.20 {lappend command} { proc foo {} { lappend x(0) abc } foo } {abc} diff --git a/tests/autoMkindex.test b/tests/autoMkindex.test index 457e225..a65a406 100644 --- a/tests/autoMkindex.test +++ b/tests/autoMkindex.test @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: autoMkindex.test,v 1.14 2002/10/03 13:34:32 dkf Exp $ +# RCS: @(#) $Id: autoMkindex.test,v 1.14.2.1 2004/10/28 00:01:06 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -326,15 +326,15 @@ proc {[magic mojo proc]} {} {} test autoMkindex-5.2 {correctly locate auto loaded procs with []} { file delete tclIndex - set res {} + set result {} if { ![catch {auto_mkindex . pkg/magicchar2.tcl}] } { # Make a slave interp to test the autoloading set c [interp create] $c eval {lappend auto_path [pwd]} - set res [$c eval {catch {{[magic mojo proc]}}}] + set result [$c eval {catch {{[magic mojo proc]}}}] interp delete $c } - set res + set result } 0 removeFile [file join pkg magicchar2.tcl] diff --git a/tests/exec.test b/tests/exec.test index e5c9bf7..3613cba 100644 --- a/tests/exec.test +++ b/tests/exec.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: exec.test,v 1.16.2.3 2004/07/02 23:37:31 hobbs Exp $ +# RCS: @(#) $Id: exec.test,v 1.16.2.4 2004/10/28 00:01:06 dgp Exp $ package require tcltest 2 namespace import -force ::tcltest::* @@ -19,7 +19,7 @@ namespace import -force ::tcltest::* # All tests require the "exec" command. # Skip them if exec is not defined. testConstraint exec [llength [info commands exec]] -catch {unset path} +unset -nocomplain path set path(echo) [makeFile { puts -nonewline [lindex $argv 0] foreach str [lrange $argv 1 end] { @@ -605,6 +605,7 @@ test exec-18.1 { exec cat deals with weird file names} {exec tempNotWin} { foreach file {script gorp.file gorp.file2 echo cat wc sh sleep exit err} { removeFile $file } +unset -nocomplain path ::tcltest::cleanupTests return diff --git a/tests/execute.test b/tests/execute.test index 2f7363c..7883ffe 100644 --- a/tests/execute.test +++ b/tests/execute.test @@ -14,7 +14,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: execute.test,v 1.13.2.1 2003/09/19 18:43:00 msofer Exp $ +# RCS: @(#) $Id: execute.test,v 1.13.2.2 2004/10/28 00:01:07 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -713,13 +713,17 @@ test execute-7.34 {Wide int handling} {longIs32bit} { expr {wide(0x1) * 1024 * 1024 * 1024 * 1024} } 1099511627776 -test execute-8.1 {Stack protection} { +test execute-8.1 {Stack protection} -setup { # If [Bug #804681] has not been properly # taken care of, this should segfault proc whatever args {llength $args} trace add variable ::errorInfo {write unset} whatever - catch {expr {1+9/0}} -} 1 +} -body { + expr {1+9/0} +} -cleanup { + trace remove variable ::errorInfo {write unset} whatever + rename whatever {} +} -returnCodes error -match glob -result * # cleanup if {[info commands testobj] != {}} { diff --git a/tests/interp.test b/tests/interp.test index 769f32f..ff6e81e 100644 --- a/tests/interp.test +++ b/tests/interp.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: interp.test,v 1.19.2.5 2003/09/04 17:36:50 dgp Exp $ +# RCS: @(#) $Id: interp.test,v 1.19.2.6 2004/10/28 00:01:07 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2.1 @@ -299,6 +299,7 @@ test interp-9.3 {testing aliases for hidden commands} { catch {interp create a} a eval {proc p {} {return ENTER_A}} interp alias {} p a p + set res {} lappend res [list [catch p msg] $msg] interp hide a p lappend res [list [catch p msg] $msg] @@ -2931,11 +2932,12 @@ test interp-32.1 { parent's working directory should test interp-33.1 {refCounting for target words of alias [Bug 730244]} { # This test will panic if Bug 730244 is not fixed. - interp create i - proc test args {return $args} - trace add execution test enter {interp alias i alias {} ;#} - interp alias i alias {} test this - i eval alias + set i [interp create] + proc testHelper args {rename testHelper {}; return $args} + # Note: interp names are simple words by default + trace add execution testHelper enter "interp alias $i alias {} ;#" + interp alias $i alias {} testHelper this + $i eval alias } this # cleanup diff --git a/tests/io.test b/tests/io.test index a529e61..a66bf89 100644 --- a/tests/io.test +++ b/tests/io.test @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: io.test,v 1.40.2.6 2004/07/26 21:39:42 hobbs Exp $ +# RCS: @(#) $Id: io.test,v 1.40.2.7 2004/10/28 00:01:08 dgp Exp $ if {[catch {package require tcltest 2}]} { puts stderr "Skipping tests in [info script]. tcltest 2 required." @@ -2685,7 +2685,7 @@ test io-29.33 {Tcl_Flush, implicit flush on exit} {exec} { set r } "hello\nbye\nstrange\n" test io-29.34 {Tcl_Close, async flush on close, using sockets} {socket tempNotMac fileevent} { - set c 0 + variable c 0 variable x running set l abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz proc writelots {s l} { @@ -5776,7 +5776,7 @@ test io-48.4 {lf write, testing readability, ^Z termination, auto read mode} {fi file delete $path(test1) set f [open $path(test1) w] fconfigure $f -translation lf - set c [format "abc\ndef\n%c" 26] + variable c [format "abc\ndef\n%c" 26] puts -nonewline $f $c close $f proc consume {f} { diff --git a/tests/namespace.test b/tests/namespace.test index 542f137..096af88 100644 --- a/tests/namespace.test +++ b/tests/namespace.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: namespace.test,v 1.21.2.4 2004/10/26 20:14:36 dgp Exp $ +# RCS: @(#) $Id: namespace.test,v 1.21.2.5 2004/10/28 00:01:11 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -432,7 +432,7 @@ test namespace-10.8 {Tcl_ForgetImport: Bug 560297} -setup { namespace delete origin link link2 my } -test namespace-10.8 {Tcl_ForgetImport: Bug 560297} -setup { +test namespace-10.9 {Tcl_ForgetImport: Bug 560297} -setup { namespace eval origin { namespace export cmd proc cmd {} {} diff --git a/tests/regexpComp.test b/tests/regexpComp.test index b8600dd..6580d60 100644 --- a/tests/regexpComp.test +++ b/tests/regexpComp.test @@ -32,35 +32,35 @@ proc evalInProc { script } { } catch {unset foo} -test regexp-1.1 {basic regexp operation} { +test regexpComp-1.1 {basic regexp operation} { evalInProc { regexp ab*c abbbc } } 1 -test regexp-1.2 {basic regexp operation} { +test regexpComp-1.2 {basic regexp operation} { evalInProc { regexp ab*c ac } } 1 -test regexp-1.3 {basic regexp operation} { +test regexpComp-1.3 {basic regexp operation} { evalInProc { regexp ab*c ab } } 0 -test regexp-1.4 {basic regexp operation} { +test regexpComp-1.4 {basic regexp operation} { evalInProc { regexp -- -gorp abc-gorpxxx } } 1 -test regexp-1.5 {basic regexp operation} { +test regexpComp-1.5 {basic regexp operation} { evalInProc { regexp {^([^ ]*)[ ]*([^ ]*)} "" a } } 1 -test regexp-1.6 {basic regexp operation} { +test regexpComp-1.6 {basic regexp operation} { list [catch {regexp {} abc} msg] $msg } {0 1} -test regexp-1.7 {regexp utf compliance} { +test regexpComp-1.7 {regexp utf compliance} { # if not UTF-8 aware, result is "0 1" evalInProc { set foo "\u4e4eb q" @@ -69,27 +69,27 @@ test regexp-1.7 {regexp utf compliance} { } } {0 0} -test regexp-2.1 {getting substrings back from regexp} { +test regexpComp-2.1 {getting substrings back from regexp} { evalInProc { set foo {} list [regexp ab*c abbbbc foo] $foo } } {1 abbbbc} -test regexp-2.2 {getting substrings back from regexp} { +test regexpComp-2.2 {getting substrings back from regexp} { evalInProc { set foo {} set f2 {} list [regexp a(b*)c abbbbc foo f2] $foo $f2 } } {1 abbbbc bbbb} -test regexp-2.3 {getting substrings back from regexp} { +test regexpComp-2.3 {getting substrings back from regexp} { evalInProc { set foo {} set f2 {} list [regexp a(b*)(c) abbbbc foo f2] $foo $f2 } } {1 abbbbc bbbb} -test regexp-2.4 {getting substrings back from regexp} { +test regexpComp-2.4 {getting substrings back from regexp} { evalInProc { set foo {} set f2 {} @@ -97,7 +97,7 @@ test regexp-2.4 {getting substrings back from regexp} { list [regexp a(b*)(c) abbbbc foo f2 f3] $foo $f2 $f3 } } {1 abbbbc bbbb c} -test regexp-2.5 {getting substrings back from regexp} { +test regexpComp-2.5 {getting substrings back from regexp} { evalInProc { set foo {}; set f1 {}; set f2 {}; set f3 {}; set f4 {}; set f5 {}; set f6 {}; set f7 {}; set f8 {}; set f9 {}; set fa {}; set fb {}; @@ -107,46 +107,46 @@ test regexp-2.5 {getting substrings back from regexp} { $f6 $f7 $f8 $f9 $fa $fb } } {1 12223345556789999aabbb 1 222 33 4 555 6 7 8 9999 aa bbb} -test regexp-2.6 {getting substrings back from regexp} { +test regexpComp-2.6 {getting substrings back from regexp} { evalInProc { set foo 2; set f2 2; set f3 2; set f4 2 list [regexp (a)(b)? xay foo f2 f3 f4] $foo $f2 $f3 $f4 } } {1 a a {} {}} -test regexp-2.7 {getting substrings back from regexp} { +test regexpComp-2.7 {getting substrings back from regexp} { evalInProc { set foo 1; set f2 1; set f3 1; set f4 1 list [regexp (a)(b)?(c) xacy foo f2 f3 f4] $foo $f2 $f3 $f4 } } {1 ac a {} c} -test regexp-2.8 {getting substrings back from regexp} { +test regexpComp-2.8 {getting substrings back from regexp} { evalInProc { set match {} list [regexp {^a*b} aaaab match] $match } } {1 aaaab} -test regexp-3.1 {-indices option to regexp} { +test regexpComp-3.1 {-indices option to regexp} { evalInProc { set foo {} list [regexp -indices ab*c abbbbc foo] $foo } } {1 {0 5}} -test regexp-3.2 {-indices option to regexp} { +test regexpComp-3.2 {-indices option to regexp} { evalInProc { set foo {} set f2 {} list [regexp -indices a(b*)c abbbbc foo f2] $foo $f2 } } {1 {0 5} {1 4}} -test regexp-3.3 {-indices option to regexp} { +test regexpComp-3.3 {-indices option to regexp} { evalInProc { set foo {} set f2 {} list [regexp -indices a(b*)(c) abbbbc foo f2] $foo $f2 } } {1 {0 5} {1 4}} -test regexp-3.4 {-indices option to regexp} { +test regexpComp-3.4 {-indices option to regexp} { evalInProc { set foo {} set f2 {} @@ -154,7 +154,7 @@ test regexp-3.4 {-indices option to regexp} { list [regexp -indices a(b*)(c) abbbbc foo f2 f3] $foo $f2 $f3 } } {1 {0 5} {1 4} {5 5}} -test regexp-3.5 {-indices option to regexp} { +test regexpComp-3.5 {-indices option to regexp} { evalInProc { set foo {}; set f1 {}; set f2 {}; set f3 {}; set f4 {}; set f5 {}; set f6 {}; set f7 {}; set f8 {}; set f9 {} @@ -164,25 +164,25 @@ test regexp-3.5 {-indices option to regexp} { $f6 $f7 $f8 $f9 } } {1 {0 16} {0 0} {1 3} {4 5} {6 6} {7 9} {10 10} {11 11} {12 12} {13 16}} -test regexp-3.6 {getting substrings back from regexp} { +test regexpComp-3.6 {getting substrings back from regexp} { evalInProc { set foo 2; set f2 2; set f3 2; set f4 2 list [regexp -indices (a)(b)? xay foo f2 f3 f4] $foo $f2 $f3 $f4 } } {1 {1 1} {1 1} {-1 -1} {-1 -1}} -test regexp-3.7 {getting substrings back from regexp} { +test regexpComp-3.7 {getting substrings back from regexp} { evalInProc { set foo 1; set f2 1; set f3 1; set f4 1 list [regexp -indices (a)(b)?(c) xacy foo f2 f3 f4] $foo $f2 $f3 $f4 } } {1 {1 2} {1 1} {-1 -1} {2 2}} -test regexp-4.1 {-nocase option to regexp} { +test regexpComp-4.1 {-nocase option to regexp} { evalInProc { regexp -nocase foo abcFOo } } 1 -test regexp-4.2 {-nocase option to regexp} { +test regexpComp-4.2 {-nocase option to regexp} { evalInProc { set f1 22 set f2 33 @@ -190,21 +190,21 @@ test regexp-4.2 {-nocase option to regexp} { list [regexp -nocase {a(b*)([xy]*)z} aBbbxYXxxZ22 f1 f2 f3] $f1 $f2 $f3 } } {1 aBbbxYXxxZ Bbb xYXxx} -test regexp-4.3 {-nocase option to regexp} { +test regexpComp-4.3 {-nocase option to regexp} { evalInProc { regexp -nocase FOo abcFOo } } 1 set ::x abcdefghijklmnopqrstuvwxyz1234567890 set ::x $x$x$x$x$x$x$x$x$x$x$x$x -test regexp-4.4 {case conversion in regexp} { +test regexpComp-4.4 {case conversion in regexp} { evalInProc { list [regexp -nocase $::x $::x foo] $foo } } "1 $x" catch {unset ::x} -test regexp-5.1 {exercise cache of compiled expressions} { +test regexpComp-5.1 {exercise cache of compiled expressions} { evalInProc { regexp .*a b regexp .*b c @@ -214,7 +214,7 @@ test regexp-5.1 {exercise cache of compiled expressions} { regexp .*a bbba } } 1 -test regexp-5.2 {exercise cache of compiled expressions} { +test regexpComp-5.2 {exercise cache of compiled expressions} { evalInProc { regexp .*a b regexp .*b c @@ -224,7 +224,7 @@ test regexp-5.2 {exercise cache of compiled expressions} { regexp .*b xxxb } } 1 -test regexp-5.3 {exercise cache of compiled expressions} { +test regexpComp-5.3 {exercise cache of compiled expressions} { evalInProc { regexp .*a b regexp .*b c @@ -234,7 +234,7 @@ test regexp-5.3 {exercise cache of compiled expressions} { regexp .*c yyyc } } 1 -test regexp-5.4 {exercise cache of compiled expressions} { +test regexpComp-5.4 {exercise cache of compiled expressions} { evalInProc { regexp .*a b regexp .*b c @@ -244,7 +244,7 @@ test regexp-5.4 {exercise cache of compiled expressions} { regexp .*d 1d } } 1 -test regexp-5.5 {exercise cache of compiled expressions} { +test regexpComp-5.5 {exercise cache of compiled expressions} { evalInProc { regexp .*a b regexp .*b c @@ -255,139 +255,139 @@ test regexp-5.5 {exercise cache of compiled expressions} { } } 1 -test regexp-6.1 {regexp errors} { +test regexpComp-6.1 {regexp errors} { evalInProc { list [catch {regexp a} msg] $msg } } {1 {wrong # args: should be "regexp ?switches? exp string ?matchVar? ?subMatchVar subMatchVar ...?"}} -test regexp-6.2 {regexp errors} { +test regexpComp-6.2 {regexp errors} { evalInProc { list [catch {regexp -nocase a} msg] $msg } } {1 {wrong # args: should be "regexp ?switches? exp string ?matchVar? ?subMatchVar subMatchVar ...?"}} -test regexp-6.3 {regexp errors} { +test regexpComp-6.3 {regexp errors} { evalInProc { list [catch {regexp -gorp a} msg] $msg } } {1 {bad switch "-gorp": must be -all, -about, -indices, -inline, -expanded, -line, -linestop, -lineanchor, -nocase, -start, or --}} -test regexp-6.4 {regexp errors} { +test regexpComp-6.4 {regexp errors} { evalInProc { list [catch {regexp a( b} msg] $msg } } {1 {couldn't compile regular expression pattern: parentheses () not balanced}} -test regexp-6.5 {regexp errors} { +test regexpComp-6.5 {regexp errors} { evalInProc { list [catch {regexp a( b} msg] $msg } } {1 {couldn't compile regular expression pattern: parentheses () not balanced}} -test regexp-6.6 {regexp errors} { +test regexpComp-6.6 {regexp errors} { evalInProc { list [catch {regexp a a f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1 f1} msg] $msg } } {0 1} -test regexp-6.7 {regexp errors} { +test regexpComp-6.7 {regexp errors} { evalInProc { list [catch {regexp (x)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.) xyzzy} msg] $msg } } {0 0} -test regexp-6.8 {regexp errors} { +test regexpComp-6.8 {regexp errors} { evalInProc { catch {unset f1} set f1 44 list [catch {regexp abc abc f1(f2)} msg] $msg } } {1 {couldn't set variable "f1(f2)"}} -test regexp-6.9 {regexp errors, -start bad int check} { +test regexpComp-6.9 {regexp errors, -start bad int check} { evalInProc { list [catch {regexp -start bogus {^$} {}} msg] $msg } } {1 {expected integer but got "bogus"}} -test regexp-7.1 {basic regsub operation} { +test regexpComp-7.1 {basic regsub operation} { evalInProc { list [regsub aa+ xaxaaaxaa 111&222 foo] $foo } } {1 xax111aaa222xaa} -test regexp-7.2 {basic regsub operation} { +test regexpComp-7.2 {basic regsub operation} { evalInProc { list [regsub aa+ aaaxaa &111 foo] $foo } } {1 aaa111xaa} -test regexp-7.3 {basic regsub operation} { +test regexpComp-7.3 {basic regsub operation} { evalInProc { list [regsub aa+ xaxaaa 111& foo] $foo } } {1 xax111aaa} -test regexp-7.4 {basic regsub operation} { +test regexpComp-7.4 {basic regsub operation} { evalInProc { list [regsub aa+ aaa 11&2&333 foo] $foo } } {1 11aaa2aaa333} -test regexp-7.5 {basic regsub operation} { +test regexpComp-7.5 {basic regsub operation} { evalInProc { list [regsub aa+ xaxaaaxaa &2&333 foo] $foo } } {1 xaxaaa2aaa333xaa} -test regexp-7.6 {basic regsub operation} { +test regexpComp-7.6 {basic regsub operation} { evalInProc { list [regsub aa+ xaxaaaxaa 1&22& foo] $foo } } {1 xax1aaa22aaaxaa} -test regexp-7.7 {basic regsub operation} { +test regexpComp-7.7 {basic regsub operation} { evalInProc { list [regsub a(a+) xaxaaaxaa {1\122\1} foo] $foo } } {1 xax1aa22aaxaa} -test regexp-7.8 {basic regsub operation} { +test regexpComp-7.8 {basic regsub operation} { evalInProc { list [regsub a(a+) xaxaaaxaa {1\\\122\1} foo] $foo } } "1 {xax1\\aa22aaxaa}" -test regexp-7.9 {basic regsub operation} { +test regexpComp-7.9 {basic regsub operation} { evalInProc { list [regsub a(a+) xaxaaaxaa {1\\122\1} foo] $foo } } "1 {xax1\\122aaxaa}" -test regexp-7.10 {basic regsub operation} { +test regexpComp-7.10 {basic regsub operation} { evalInProc { list [regsub a(a+) xaxaaaxaa {1\\&\1} foo] $foo } } "1 {xax1\\aaaaaxaa}" -test regexp-7.11 {basic regsub operation} { +test regexpComp-7.11 {basic regsub operation} { evalInProc { list [regsub a(a+) xaxaaaxaa {1\&\1} foo] $foo } } {1 xax1&aaxaa} -test regexp-7.12 {basic regsub operation} { +test regexpComp-7.12 {basic regsub operation} { evalInProc { list [regsub a(a+) xaxaaaxaa {\1\1\1\1&&} foo] $foo } } {1 xaxaaaaaaaaaaaaaaxaa} -test regexp-7.13 {basic regsub operation} { +test regexpComp-7.13 {basic regsub operation} { evalInProc { set foo xxx list [regsub abc xyz 111 foo] $foo } } {0 xyz} -test regexp-7.14 {basic regsub operation} { +test regexpComp-7.14 {basic regsub operation} { evalInProc { set foo xxx list [regsub ^ xyz "111 " foo] $foo } } {1 {111 xyz}} -test regexp-7.15 {basic regsub operation} { +test regexpComp-7.15 {basic regsub operation} { evalInProc { set foo xxx list [regsub -- -foo abc-foodef "111 " foo] $foo } } {1 {abc111 def}} -test regexp-7.16 {basic regsub operation} { +test regexpComp-7.16 {basic regsub operation} { evalInProc { set foo xxx list [regsub x "" y foo] $foo } } {0 {}} -test regexp-7.17 {regsub utf compliance} { +test regexpComp-7.17 {regsub utf compliance} { evalInProc { # if not UTF-8 aware, result is "0 1" set foo "xyz555ijka\u4e4ebpqr" @@ -396,35 +396,35 @@ test regexp-7.17 {regsub utf compliance} { } } {0 0} -test regexp-8.1 {case conversion in regsub} { +test regexpComp-8.1 {case conversion in regsub} { evalInProc { list [regsub -nocase a(a+) xaAAaAAay & foo] $foo } } {1 xaAAaAAay} -test regexp-8.2 {case conversion in regsub} { +test regexpComp-8.2 {case conversion in regsub} { evalInProc { list [regsub -nocase a(a+) xaAAaAAay & foo] $foo } } {1 xaAAaAAay} -test regexp-8.3 {case conversion in regsub} { +test regexpComp-8.3 {case conversion in regsub} { evalInProc { set foo 123 list [regsub a(a+) xaAAaAAay & foo] $foo } } {0 xaAAaAAay} -test regexp-8.4 {case conversion in regsub} { +test regexpComp-8.4 {case conversion in regsub} { evalInProc { set foo 123 list [regsub -nocase a CaDE b foo] $foo } } {1 CbDE} -test regexp-8.5 {case conversion in regsub} { +test regexpComp-8.5 {case conversion in regsub} { evalInProc { set foo 123 list [regsub -nocase XYZ CxYzD b foo] $foo } } {1 CbD} -test regexp-8.6 {case conversion in regsub} { +test regexpComp-8.6 {case conversion in regsub} { evalInProc { set x abcdefghijklmnopqrstuvwxyz1234567890 set x $x$x$x$x$x$x$x$x$x$x$x$x @@ -433,112 +433,112 @@ test regexp-8.6 {case conversion in regsub} { } } {1 b} -test regexp-9.1 {-all option to regsub} { +test regexpComp-9.1 {-all option to regsub} { evalInProc { set foo 86 list [regsub -all x+ axxxbxxcxdx |&| foo] $foo } } {4 a|xxx|b|xx|c|x|d|x|} -test regexp-9.2 {-all option to regsub} { +test regexpComp-9.2 {-all option to regsub} { evalInProc { set foo 86 list [regsub -nocase -all x+ aXxXbxxcXdx |&| foo] $foo } } {4 a|XxX|b|xx|c|X|d|x|} -test regexp-9.3 {-all option to regsub} { +test regexpComp-9.3 {-all option to regsub} { evalInProc { set foo 86 list [regsub x+ axxxbxxcxdx |&| foo] $foo } } {1 a|xxx|bxxcxdx} -test regexp-9.4 {-all option to regsub} { +test regexpComp-9.4 {-all option to regsub} { evalInProc { set foo 86 list [regsub -all bc axxxbxxcxdx |&| foo] $foo } } {0 axxxbxxcxdx} -test regexp-9.5 {-all option to regsub} { +test regexpComp-9.5 {-all option to regsub} { evalInProc { set foo xxx list [regsub -all node "node node more" yy foo] $foo } } {2 {yy yy more}} -test regexp-9.6 {-all option to regsub} { +test regexpComp-9.6 {-all option to regsub} { evalInProc { set foo xxx list [regsub -all ^ xxx 123 foo] $foo } } {1 123xxx} -test regexp-10.1 {expanded syntax in regsub} { +test regexpComp-10.1 {expanded syntax in regsub} { evalInProc { set foo xxx list [regsub -expanded ". \#comment\n . \#comment2" abc def foo] $foo } } {1 defc} -test regexp-10.2 {newline sensitivity in regsub} { +test regexpComp-10.2 {newline sensitivity in regsub} { evalInProc { set foo xxx list [regsub -line {^a.*b$} "dabc\naxyb\n" 123 foo] $foo } } "1 {dabc\n123\n}" -test regexp-10.3 {newline sensitivity in regsub} { +test regexpComp-10.3 {newline sensitivity in regsub} { evalInProc { set foo xxx list [regsub -line {^a.*b$} "dabc\naxyb\nxb" 123 foo] $foo } } "1 {dabc\n123\nxb}" -test regexp-10.4 {partial newline sensitivity in regsub} { +test regexpComp-10.4 {partial newline sensitivity in regsub} { evalInProc { set foo xxx list [regsub -lineanchor {^a.*b$} "da\naxyb\nxb" 123 foo] $foo } } "1 {da\n123}" -test regexp-10.5 {inverse partial newline sensitivity in regsub} { +test regexpComp-10.5 {inverse partial newline sensitivity in regsub} { evalInProc { set foo xxx list [regsub -linestop {a.*b} "da\nbaxyb\nxb" 123 foo] $foo } } "1 {da\nb123\nxb}" -test regexp-11.1 {regsub errors} { +test regexpComp-11.1 {regsub errors} { evalInProc { list [catch {regsub a b} msg] $msg } } {1 {wrong # args: should be "regsub ?switches? exp string subSpec ?varName?"}} -test regexp-11.2 {regsub errors} { +test regexpComp-11.2 {regsub errors} { evalInProc { list [catch {regsub -nocase a b} msg] $msg } } {1 {wrong # args: should be "regsub ?switches? exp string subSpec ?varName?"}} -test regexp-11.3 {regsub errors} { +test regexpComp-11.3 {regsub errors} { evalInProc { list [catch {regsub -nocase -all a b} msg] $msg } } {1 {wrong # args: should be "regsub ?switches? exp string subSpec ?varName?"}} -test regexp-11.4 {regsub errors} { +test regexpComp-11.4 {regsub errors} { evalInProc { list [catch {regsub a b c d e f} msg] $msg } } {1 {wrong # args: should be "regsub ?switches? exp string subSpec ?varName?"}} -test regexp-11.5 {regsub errors} { +test regexpComp-11.5 {regsub errors} { evalInProc { list [catch {regsub -gorp a b c} msg] $msg } } {1 {bad switch "-gorp": must be -all, -nocase, -expanded, -line, -linestop, -lineanchor, -start, or --}} -test regexp-11.6 {regsub errors} { +test regexpComp-11.6 {regsub errors} { evalInProc { list [catch {regsub -nocase a( b c d} msg] $msg } } {1 {couldn't compile regular expression pattern: parentheses () not balanced}} -test regexp-11.7 {regsub errors} { +test regexpComp-11.7 {regsub errors} { evalInProc { catch {unset f1} set f1 44 list [catch {regsub -nocase aaa aaa xxx f1(f2)} msg] $msg } } {1 {couldn't set variable "f1(f2)"}} -test regexp-11.8 {regsub errors, -start bad int check} { +test regexpComp-11.8 {regsub errors, -start bad int check} { evalInProc { list [catch {regsub -start bogus pattern string rep var} msg] $msg } @@ -548,13 +548,13 @@ test regexp-11.8 {regsub errors, -start bad int check} { # Meg. This is probably bigger than most users want... # 8.2.3 regexp reduced stack space requirements, but this should be # tested again -test regexp-12.1 {Tcl_RegExpExec: large number of subexpressions} {macCrash} { +test regexpComp-12.1 {Tcl_RegExpExec: large number of subexpressions} {macCrash} { evalInProc { list [regexp (.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)(.) abcdefghijklmnopqrstuvwxyz all a b c d e f g h i j k l m n o p q r s t u v w x y z] $all $a $b $c $d $e $f $g $h $i $j $k $l $m $n $o $p $q $r $s $t $u $v $w $x $y $z } } {1 abcdefghijklmnopqrstuvwxyz a b c d e f g h i j k l m n o p q r s t u v w x y z} -test regexp-13.1 {regsub of a very large string} { +test regexpComp-13.1 {regsub of a very large string} { # This test is designed to stress the memory subsystem in order # to catch Bug #933. It only fails if the Tcl memory allocator # is in use. @@ -567,7 +567,7 @@ test regexp-13.1 {regsub of a very large string} { set x done } {done} -test regexp-14.1 {CompileRegexp: regexp cache} { +test regexpComp-14.1 {CompileRegexp: regexp cache} { evalInProc { regexp .*a b regexp .*b c @@ -579,7 +579,7 @@ test regexp-14.1 {CompileRegexp: regexp cache} { regexp $x bbba } } 1 -test regexp-14.2 {CompileRegexp: regexp cache, different flags} { +test regexpComp-14.2 {CompileRegexp: regexp cache, different flags} { evalInProc { regexp .*a b regexp .*b c @@ -593,7 +593,7 @@ test regexp-14.2 {CompileRegexp: regexp cache, different flags} { } 1 testConstraint exec [llength [info commands exec]] -test regexp-14.3 {CompileRegexp: regexp cache, empty regexp and empty cache} -constraints { +test regexpComp-14.3 {CompileRegexp: regexp cache, empty regexp and empty cache} -constraints { exec } -setup { set junk [makeFile {puts [regexp {} foo]} junk.tcl] @@ -603,96 +603,96 @@ test regexp-14.3 {CompileRegexp: regexp cache, empty regexp and empty cache} -co removeFile junk.tcl } -result 1 -test regexp-15.1 {regexp -start} { +test regexpComp-15.1 {regexp -start} { catch {unset x} list [regexp -start -10 {\d} 1abc2de3 x] $x } {1 1} -test regexp-15.2 {regexp -start} { +test regexpComp-15.2 {regexp -start} { catch {unset x} list [regexp -start 2 {\d} 1abc2de3 x] $x } {1 2} -test regexp-15.3 {regexp -start} { +test regexpComp-15.3 {regexp -start} { catch {unset x} list [regexp -start 4 {\d} 1abc2de3 x] $x } {1 2} -test regexp-15.4 {regexp -start} { +test regexpComp-15.4 {regexp -start} { catch {unset x} list [regexp -start 5 {\d} 1abc2de3 x] $x } {1 3} -test regexp-15.5 {regexp -start, over end of string} { +test regexpComp-15.5 {regexp -start, over end of string} { catch {unset x} list [regexp -start [string length 1abc2de3] {\d} 1abc2de3 x] [info exists x] } {0 0} -test regexp-15.6 {regexp -start, loss of ^$ behavior} { +test regexpComp-15.6 {regexp -start, loss of ^$ behavior} { list [regexp -start 2 {^$} {}] } {0} -test regexp-16.1 {regsub -start} { +test regexpComp-16.1 {regsub -start} { catch {unset x} list [regsub -all -start 2 {\d} a1b2c3d4e5 {/&} x] $x } {4 a1b/2c/3d/4e/5} -test regexp-16.2 {regsub -start} { +test regexpComp-16.2 {regsub -start} { catch {unset x} list [regsub -all -start -25 {z} hello {/&} x] $x } {0 hello} -test regexp-16.3 {regsub -start} { +test regexpComp-16.3 {regsub -start} { catch {unset x} list [regsub -all -start 3 {z} hello {/&} x] $x } {0 hello} -test regexp-16.4 {regsub -start, \A behavior} { +test regexpComp-16.4 {regsub -start, \A behavior} { set out {} lappend out [regsub -start 0 -all {\A(\w)} {abcde} {/\1} x] $x lappend out [regsub -start 2 -all {\A(\w)} {abcde} {/\1} x] $x } {5 /a/b/c/d/e 3 ab/c/d/e} -test regexp-17.1 {regexp -inline} { +test regexpComp-17.1 {regexp -inline} { regexp -inline b ababa } {b} -test regexp-17.2 {regexp -inline} { +test regexpComp-17.2 {regexp -inline} { regexp -inline (b) ababa } {b b} -test regexp-17.3 {regexp -inline -indices} { +test regexpComp-17.3 {regexp -inline -indices} { regexp -inline -indices (b) ababa } {{1 1} {1 1}} -test regexp-17.4 {regexp -inline} { +test regexpComp-17.4 {regexp -inline} { regexp -inline {\w(\d+)\w} " hello 23 there456def " } {e456d 456} -test regexp-17.5 {regexp -inline no matches} { +test regexpComp-17.5 {regexp -inline no matches} { regexp -inline {\w(\d+)\w} "" } {} -test regexp-17.6 {regexp -inline no matches} { +test regexpComp-17.6 {regexp -inline no matches} { regexp -inline hello goodbye } {} -test regexp-17.7 {regexp -inline, no matchvars allowed} { +test regexpComp-17.7 {regexp -inline, no matchvars allowed} { list [catch {regexp -inline b abc match} msg] $msg } {1 {regexp match variables not allowed when using -inline}} -test regexp-18.1 {regexp -all} { +test regexpComp-18.1 {regexp -all} { regexp -all b bbbbb } {5} -test regexp-18.2 {regexp -all} { +test regexpComp-18.2 {regexp -all} { regexp -all b abababbabaaaaaaaaaab } {6} -test regexp-18.3 {regexp -all -inline} { +test regexpComp-18.3 {regexp -all -inline} { regexp -all -inline b abababbabaaaaaaaaaab } {b b b b b b} -test regexp-18.4 {regexp -all -inline} { +test regexpComp-18.4 {regexp -all -inline} { regexp -all -inline {\w(\w)} abcdefg } {ab b cd d ef f} -test regexp-18.5 {regexp -all -inline} { +test regexpComp-18.5 {regexp -all -inline} { regexp -all -inline {\w(\w)$} abcdefg } {fg g} -test regexp-18.6 {regexp -all -inline} { +test regexpComp-18.6 {regexp -all -inline} { regexp -all -inline {\d+} 10:20:30:40 } {10 20 30 40} -test regexp-18.7 {regexp -all -inline} { +test regexpComp-18.7 {regexp -all -inline} { list [catch {regexp -all -inline b abc match} msg] $msg } {1 {regexp match variables not allowed when using -inline}} -test regexp-18.8 {regexp -all} { +test regexpComp-18.8 {regexp -all} { # This should not cause an infinite loop regexp -all -inline {a*} a } {a} -test regexp-18.9 {regexp -all} { +test regexpComp-18.9 {regexp -all} { # Yes, the expected result is {a {}}. Here's why: # Start at index 0; a* matches the "a" there then stops. # Go to index 1; a* matches the lambda (or {}) there then stops. Recall @@ -701,7 +701,7 @@ test regexp-18.9 {regexp -all} { # Go to index 2; this is past the end of the string, so stop. regexp -all -inline {a*} ab } {a {}} -test regexp-18.10 {regexp -all} { +test regexpComp-18.10 {regexp -all} { # Yes, the expected result is {a {} a}. Here's why: # Start at index 0; a* matches the "a" there then stops. # Go to index 1; a* matches the lambda (or {}) there then stops. Recall @@ -711,25 +711,25 @@ test regexp-18.10 {regexp -all} { # Go to index 3; this is past the end of the string, so stop. regexp -all -inline {a*} aba } {a {} a} -test regexp-18.11 {regexp -all} { +test regexpComp-18.11 {regexp -all} { evalInProc { regexp -all -inline {^a} aaaa } } {a} -test regexp-18.12 {regexp -all -inline -indices} { +test regexpComp-18.12 {regexp -all -inline -indices} { evalInProc { regexp -all -inline -indices a(b(c)d|e(f)g)h abcdhaefgh } } {{0 4} {1 3} {2 2} {-1 -1} {5 9} {6 8} {-1 -1} {7 7}} -test regexp-19.1 {regsub null replacement} { +test regexpComp-19.1 {regsub null replacement} { evalInProc { regsub -all {@} {@hel@lo@} "\0a\0" result list $result [string length $result] } } "\0a\0hel\0a\0lo\0a\0 14" -test regexp-20.1 {regsub shared object shimmering} { +test regexpComp-20.1 {regsub shared object shimmering} { evalInProc { # Bug #461322 set a abcdefghijklmnopqurstuvwxyz @@ -739,64 +739,64 @@ test regexp-20.1 {regsub shared object shimmering} { list $d [string length $d] [string bytelength $d] } } [list abcdefghijklmnopqurstuvwxyz0123456789 37 37] -test regexp-20.2 {regsub shared object shimmering with -about} { +test regexpComp-20.2 {regsub shared object shimmering with -about} { evalInProc { eval regexp -about abc } } {0 {}} -test regexp-21.1 {regexp command compiling tests} { +test regexpComp-21.1 {regexp command compiling tests} { evalInProc { regexp foo bar } } 0 -test regexp-21.2 {regexp command compiling tests} { +test regexpComp-21.2 {regexp command compiling tests} { evalInProc { regexp {^foo$} dogfood } } 0 -test regexp-21.3 {regexp command compiling tests} { +test regexpComp-21.3 {regexp command compiling tests} { evalInProc { set a foo regexp {^foo$} $a } } 1 -test regexp-21.4 {regexp command compiling tests} { +test regexpComp-21.4 {regexp command compiling tests} { evalInProc { regexp foo dogfood } } 1 -test regexp-21.5 {regexp command compiling tests} { +test regexpComp-21.5 {regexp command compiling tests} { evalInProc { regexp -nocase FOO dogfod } } 0 -test regexp-21.6 {regexp command compiling tests} { +test regexpComp-21.6 {regexp command compiling tests} { evalInProc { regexp -n foo dogfoOd } } 1 -test regexp-21.7 {regexp command compiling tests} { +test regexpComp-21.7 {regexp command compiling tests} { evalInProc { regexp -no -- FoO dogfood } } 1 -test regexp-21.8 {regexp command compiling tests} { +test regexpComp-21.8 {regexp command compiling tests} { evalInProc { regexp -- foo dogfod } } 0 -test regexp-21.9 {regexp command compiling tests} { +test regexpComp-21.9 {regexp command compiling tests} { evalInProc { list [catch {regexp -- -nocase foo dogfod} msg] $msg } } {0 0} -test regexp-21.10 {regexp command compiling tests} { +test regexpComp-21.10 {regexp command compiling tests} { evalInProc { list [regsub -all "" foo bar str] $str } } {3 barfbarobaro} -test regexp-21.11 {regexp command compiling tests} { +test regexpComp-21.11 {regexp command compiling tests} { evalInProc { list [regsub -all "" "" bar str] $str } @@ -818,7 +818,7 @@ foreach {str exp result} { anything ^.*b$ 0 anything ^a.*$ 1 } { - test regexp-22.[incr i] {regexp command compiling tests} \ + test regexpComp-22.[incr i] {regexp command compiling tests} \ [subst {evalInProc {set a "$str"; regexp {$exp} \$a}}] $result } diff --git a/tests/stringComp.test b/tests/stringComp.test index 14b0107..30a89db 100644 --- a/tests/stringComp.test +++ b/tests/stringComp.test @@ -15,7 +15,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: stringComp.test,v 1.6 2003/02/18 02:25:45 hobbs Exp $ +# RCS: @(#) $Id: stringComp.test,v 1.6.2.1 2004/10/28 00:01:12 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -27,15 +27,15 @@ if {[lsearch [namespace children] ::tcltest] == -1} { set ::tcltest::testConstraints(testobj) \ [expr {[info commands testobj] != {}}] -test string-1.1 {error conditions} { +test stringComp-1.1 {error conditions} { proc foo {} {string gorp a b} list [catch {foo} msg] $msg } {1 {bad option "gorp": must be bytelength, compare, equal, first, index, is, last, length, map, match, range, repeat, replace, tolower, toupper, totitle, trim, trimleft, trimright, wordend, or wordstart}} -test string-1.2 {error conditions} { +test stringComp-1.2 {error conditions} { proc foo {} {string} list [catch {foo} msg] $msg } {1 {wrong # args: should be "string option arg ?arg ...?"}} -test string-1.3 {error condition - undefined method during compile} { +test stringComp-1.3 {error condition - undefined method during compile} { # We don't want this to complain about 'never' because it may never # be called, or string may get redefined. This must compile OK. proc foo {str i} { @@ -45,48 +45,48 @@ test string-1.3 {error condition - undefined method during compile} { foo abc 0 } a -test string-2.1 {string compare, too few args} { +test stringComp-2.1 {string compare, too few args} { proc foo {} {string compare a} list [catch {foo} msg] $msg } {1 {wrong # args: should be "string compare ?-nocase? ?-length int? string1 string2"}} -test string-2.2 {string compare, bad args} { +test stringComp-2.2 {string compare, bad args} { proc foo {} {string compare a b c} list [catch {foo} msg] $msg } {1 {bad option "a": must be -nocase or -length}} -test string-2.3 {string compare, bad args} { +test stringComp-2.3 {string compare, bad args} { list [catch {string compare -length -nocase str1 str2} msg] $msg } {1 {expected integer but got "-nocase"}} -test string-2.4 {string compare, too many args} { +test stringComp-2.4 {string compare, too many args} { list [catch {string compare -length 10 -nocase str1 str2 str3} msg] $msg } {1 {wrong # args: should be "string compare ?-nocase? ?-length int? string1 string2"}} -test string-2.5 {string compare with length unspecified} { +test stringComp-2.5 {string compare with length unspecified} { list [catch {string compare -length 10 10} msg] $msg } {1 {wrong # args: should be "string compare ?-nocase? ?-length int? string1 string2"}} -test string-2.6 {string compare} { +test stringComp-2.6 {string compare} { proc foo {} {string compare abcde abdef} foo } -1 -test string-2.7 {string compare, shortest method name} { +test stringComp-2.7 {string compare, shortest method name} { proc foo {} {string c abcde ABCDE} foo } 1 -test string-2.8 {string compare} { +test stringComp-2.8 {string compare} { proc foo {} {string compare abcde abcde} foo } 0 -test string-2.9 {string compare with length} { +test stringComp-2.9 {string compare with length} { proc foo {} {string compare -length 2 abcde abxyz} foo } 0 -test string-2.10 {string compare with special index} { +test stringComp-2.10 {string compare with special index} { proc foo {} {string compare -length end-3 abcde abxyz} list [catch {foo} msg] $msg } {1 {expected integer but got "end-3"}} -test string-2.11 {string compare, unicode} { +test stringComp-2.11 {string compare, unicode} { proc foo {} {string compare ab\u7266 ab\u7267} foo } -1 -test string-2.12 {string compare, high bit} { +test stringComp-2.12 {string compare, high bit} { # This test will fail if the underlying comparaison # is using signed chars instead of unsigned chars. # (like SunOS's default memcmp thus the compat/memcmp.c) @@ -96,244 +96,244 @@ test string-2.12 {string compare, high bit} { # translated into a 2 or more bytelength but whose first byte has # the high bit set. } 1 -test string-2.13 {string compare -nocase} { +test stringComp-2.13 {string compare -nocase} { proc foo {} {string compare -nocase abcde abdef} foo } -1 -test string-2.14 {string compare -nocase} { +test stringComp-2.14 {string compare -nocase} { proc foo {} {string c -nocase abcde ABCDE} foo } 0 -test string-2.15 {string compare -nocase} { +test stringComp-2.15 {string compare -nocase} { proc foo {} {string compare -nocase abcde abcde} foo } 0 -test string-2.16 {string compare -nocase with length} { +test stringComp-2.16 {string compare -nocase with length} { proc foo {} {string compare -length 2 -nocase abcde Abxyz} foo } 0 -test string-2.17 {string compare -nocase with length} { +test stringComp-2.17 {string compare -nocase with length} { proc foo {} {string compare -nocase -length 3 abcde Abxyz} foo } -1 -test string-2.18 {string compare -nocase with length <= 0} { +test stringComp-2.18 {string compare -nocase with length <= 0} { proc foo {} {string compare -nocase -length -1 abcde AbCdEf} foo } -1 -test string-2.19 {string compare -nocase with excessive length} { +test stringComp-2.19 {string compare -nocase with excessive length} { proc foo {} {string compare -nocase -length 50 AbCdEf abcde} foo } 1 -test string-2.20 {string compare -len unicode} { +test stringComp-2.20 {string compare -len unicode} { # These are strings that are 6 BYTELENGTH long, but the length # shouldn't make a different because there are actually 3 CHARS long proc foo {} {string compare -len 5 \334\334\334 \334\334\374} foo } -1 -test string-2.21 {string compare -nocase with special index} { +test stringComp-2.21 {string compare -nocase with special index} { proc foo {} {string compare -nocase -length end-3 Abcde abxyz} list [catch {foo} msg] $msg } {1 {expected integer but got "end-3"}} -test string-2.22 {string compare, null strings} { +test stringComp-2.22 {string compare, null strings} { proc foo {} {string compare "" ""} foo } 0 -test string-2.23 {string compare, null strings} { +test stringComp-2.23 {string compare, null strings} { proc foo {} {string compare "" foo} foo } -1 -test string-2.24 {string compare, null strings} { +test stringComp-2.24 {string compare, null strings} { proc foo {} {string compare foo ""} foo } 1 -test string-2.25 {string compare -nocase, null strings} { +test stringComp-2.25 {string compare -nocase, null strings} { proc foo {} {string compare -nocase "" ""} foo } 0 -test string-2.26 {string compare -nocase, null strings} { +test stringComp-2.26 {string compare -nocase, null strings} { proc foo {} {string compare -nocase "" foo} foo } -1 -test string-2.27 {string compare -nocase, null strings} { +test stringComp-2.27 {string compare -nocase, null strings} { proc foo {} {string compare -nocase foo ""} foo } 1 -test string-2.28 {string compare with length, unequal strings} { +test stringComp-2.28 {string compare with length, unequal strings} { proc foo {} {string compare -length 2 abc abde} foo } 0 -test string-2.29 {string compare with length, unequal strings} { +test stringComp-2.29 {string compare with length, unequal strings} { proc foo {} {string compare -length 2 ab abde} foo } 0 -test string-2.30 {string compare with NUL character vs. other ASCII} { +test stringComp-2.30 {string compare with NUL character vs. other ASCII} { # Be careful here, since UTF-8 rep comparison with memcmp() of # these puts chars in the wrong order proc foo {} {string compare \x00 \x01} foo } -1 -test string-2.31 {string compare, high bit} { +test stringComp-2.31 {string compare, high bit} { proc foo {} {string compare "a\x80" "a@"} foo } 1 -test string-2.32 {string compare, high bit} { +test stringComp-2.32 {string compare, high bit} { proc foo {} {string compare "a\x00" "a\x01"} foo } -1 -test string-2.33 {string compare, high bit} { +test stringComp-2.33 {string compare, high bit} { proc foo {} {string compare "\x00\x00" "\x00\x01"} foo } -1 # only need a few tests on equal, since it uses the same code as # string compare, but just modifies the return output -test string-3.1 {string equal} { +test stringComp-3.1 {string equal} { proc foo {} {string equal abcde abdef} foo } 0 -test string-3.2 {string equal} { +test stringComp-3.2 {string equal} { proc foo {} {string eq abcde ABCDE} foo } 0 -test string-3.3 {string equal} { +test stringComp-3.3 {string equal} { proc foo {} {string equal abcde abcde} foo } 1 -test string-3.4 {string equal -nocase} { +test stringComp-3.4 {string equal -nocase} { proc foo {} {string equal -nocase \334\334\334\334\374\374\374\374 \334\334\334\334\334\334\334\334} foo } 1 -test string-3.5 {string equal -nocase} { +test stringComp-3.5 {string equal -nocase} { proc foo {} {string equal -nocase abcde abdef} foo } 0 -test string-3.6 {string equal -nocase} { +test stringComp-3.6 {string equal -nocase} { proc foo {} {string eq -nocase abcde ABCDE} foo } 1 -test string-3.7 {string equal -nocase} { +test stringComp-3.7 {string equal -nocase} { proc foo {} {string equal -nocase abcde abcde} foo } 1 -test string-3.8 {string equal with length, unequal strings} { +test stringComp-3.8 {string equal with length, unequal strings} { proc foo {} {string equal -length 2 abc abde} foo } 1 -test string-4.1 {string first, too few args} { +test stringComp-4.1 {string first, too few args} { proc foo {} {string first a} list [catch {foo} msg] $msg } {1 {wrong # args: should be "string first subString string ?startIndex?"}} -test string-4.2 {string first, bad args} { +test stringComp-4.2 {string first, bad args} { proc foo {} {string first a b c} list [catch {foo} msg] $msg } {1 {bad index "c": must be integer or end?-integer?}} -test string-4.3 {string first, too many args} { +test stringComp-4.3 {string first, too many args} { proc foo {} {string first a b 5 d} list [catch {foo} msg] $msg } {1 {wrong # args: should be "string first subString string ?startIndex?"}} -test string-4.4 {string first} { +test stringComp-4.4 {string first} { proc foo {} {string first bq abcdefgbcefgbqrs} foo } 12 -test string-4.5 {string first} { +test stringComp-4.5 {string first} { proc foo {} {string fir bcd abcdefgbcefgbqrs} foo } 1 -test string-4.6 {string first} { +test stringComp-4.6 {string first} { proc foo {} {string f b abcdefgbcefgbqrs} foo } 1 -test string-4.7 {string first} { +test stringComp-4.7 {string first} { proc foo {} {string first xxx x123xx345xxx789xxx012} foo } 9 -test string-4.8 {string first} { +test stringComp-4.8 {string first} { proc foo {} {string first "" x123xx345xxx789xxx012} foo } -1 -test string-4.9 {string first, unicode} { +test stringComp-4.9 {string first, unicode} { proc foo {} {string first x abc\u7266x} foo } 4 -test string-4.10 {string first, unicode} { +test stringComp-4.10 {string first, unicode} { proc foo {} {string first \u7266 abc\u7266x} foo } 3 -test string-4.11 {string first, start index} { +test stringComp-4.11 {string first, start index} { proc foo {} {string first \u7266 abc\u7266x 3} foo } 3 -test string-4.12 {string first, start index} { +test stringComp-4.12 {string first, start index} { proc foo {} {string first \u7266 abc\u7266x 4} foo } -1 -test string-4.13 {string first, start index} { +test stringComp-4.13 {string first, start index} { proc foo {} {string first \u7266 abc\u7266x end-2} foo } 3 -test string-4.14 {string first, negative start index} { +test stringComp-4.14 {string first, negative start index} { proc foo {} {string first b abc -1} foo } 1 -test string-5.1 {string index} { +test stringComp-5.1 {string index} { proc foo {} {string index} list [catch {foo} msg] $msg } {1 {wrong # args: should be "string index string charIndex"}} -test string-5.2 {string index} { +test stringComp-5.2 {string index} { proc foo {} {string index a b c} list [catch {foo} msg] $msg } {1 {wrong # args: should be "string index string charIndex"}} -test string-5.3 {string index} { +test stringComp-5.3 {string index} { proc foo {} {string index abcde 0} foo } a -test string-5.4 {string index} { +test stringComp-5.4 {string index} { proc foo {} {string in abcde 4} foo } e -test string-5.5 {string index} { +test stringComp-5.5 {string index} { proc foo {} {string index abcde 5} foo } {} -test string-5.6 {string index} { +test stringComp-5.6 {string index} { proc foo {} {string index abcde -10} list [catch {foo} msg] $msg } {0 {}} -test string-5.7 {string index} { +test stringComp-5.7 {string index} { proc foo {} {string index a xyz} list [catch {foo} msg] $msg } {1 {bad index "xyz": must be integer or end?-integer?}} -test string-5.8 {string index} { +test stringComp-5.8 {string index} { proc foo {} {string index abc end} foo } c -test string-5.9 {string index} { +test stringComp-5.9 {string index} { proc foo {} {string index abc end-1} foo } b -test string-5.10 {string index, unicode} { +test stringComp-5.10 {string index, unicode} { proc foo {} {string index abc\u7266d 4} foo } d -test string-5.11 {string index, unicode} { +test stringComp-5.11 {string index, unicode} { proc foo {} {string index abc\u7266d 3} foo } \u7266 -test string-5.12 {string index, unicode over char length, under byte length} { +test stringComp-5.12 {string index, unicode over char length, under byte length} { proc foo {} {string index \334\374\334\374 6} foo } {} -test string-5.13 {string index, bytearray object} { +test stringComp-5.13 {string index, bytearray object} { proc foo {} {string index [binary format a5 fuz] 0} foo } f -test string-5.14 {string index, bytearray object} { +test stringComp-5.14 {string index, bytearray object} { proc foo {} {string index [binary format I* {0x50515253 0x52}] 3} foo } S -test string-5.15 {string index, bytearray object} { +test stringComp-5.15 {string index, bytearray object} { proc foo {} { set b [binary format I* {0x50515253 0x52}] set i1 [string index $b end-6] @@ -342,7 +342,7 @@ test string-5.15 {string index, bytearray object} { } foo } 0 -test string-5.16 {string index, bytearray object with string obj shimmering} { +test stringComp-5.16 {string index, bytearray object with string obj shimmering} { proc foo {} { set str "0123456789\x00 abcdedfghi" binary scan $str H* dump @@ -350,19 +350,19 @@ test string-5.16 {string index, bytearray object with string obj shimmering} { } foo } 0 -test string-5.17 {string index, bad integer} { +test stringComp-5.17 {string index, bad integer} { proc foo {} {string index "abc" 08} list [catch {foo} msg] $msg } {1 {bad index "08": must be integer or end?-integer? (looks like invalid octal number)}} -test string-5.18 {string index, bad integer} { +test stringComp-5.18 {string index, bad integer} { proc foo {} {string index "abc" end-00289} list [catch {foo} msg] $msg } {1 {bad index "end-00289": must be integer or end?-integer? (looks like invalid octal number)}} -test string-5.19 {string index, bytearray object out of bounds} { +test stringComp-5.19 {string index, bytearray object out of bounds} { proc foo {} {string index [binary format I* {0x50515253 0x52}] -1} foo } {} -test string-5.20 {string index, bytearray object out of bounds} { +test stringComp-5.20 {string index, bytearray object out of bounds} { proc foo {} {string index [binary format I* {0x50515253 0x52}] 20} foo } {} @@ -387,50 +387,50 @@ catch {rename largest_int {}} ## string length ## not yet bc -test string-8.1 {string bytelength} { +test stringComp-8.1 {string bytelength} { proc foo {} {string bytelength} list [catch {foo} msg] $msg } {1 {wrong # args: should be "string bytelength string"}} -test string-8.2 {string bytelength} { +test stringComp-8.2 {string bytelength} { proc foo {} {string bytelength a b} list [catch {foo} msg] $msg } {1 {wrong # args: should be "string bytelength string"}} -test string-8.3 {string bytelength} { +test stringComp-8.3 {string bytelength} { proc foo {} {string bytelength "\u00c7"} foo } 2 -test string-8.4 {string bytelength} { +test stringComp-8.4 {string bytelength} { proc foo {} {string b ""} foo } 0 ## string length ## -test string-9.1 {string length} { +test stringComp-9.1 {string length} { proc foo {} {string length} list [catch {foo} msg] $msg } {1 {wrong # args: should be "string length string"}} -test string-9.2 {string length} { +test stringComp-9.2 {string length} { proc foo {} {string length a b} list [catch {foo} msg] $msg } {1 {wrong # args: should be "string length string"}} -test string-9.3 {string length} { +test stringComp-9.3 {string length} { proc foo {} {string length "a little string"} foo } 15 -test string-9.4 {string length} { +test stringComp-9.4 {string length} { proc foo {} {string le ""} foo } 0 -test string-9.5 {string length, unicode} { +test stringComp-9.5 {string length, unicode} { proc foo {} {string le "abcd\u7266"} foo } 5 -test string-9.6 {string length, bytearray object} { +test stringComp-9.6 {string length, bytearray object} { proc foo {} {string length [binary format a5 foo]} foo } 5 -test string-9.7 {string length, bytearray object} { +test stringComp-9.7 {string length, bytearray object} { proc foo {} {string length [binary format I* {0x50515253 0x52}]} foo } 8 @@ -440,215 +440,215 @@ test string-9.7 {string length, bytearray object} { ## string match ## -test string-11.1 {string match, too few args} { +test stringComp-11.1 {string match, too few args} { proc foo {} {string match a} list [catch {foo} msg] $msg } {1 {wrong # args: should be "string match ?-nocase? pattern string"}} -test string-11.2 {string match, too many args} { +test stringComp-11.2 {string match, too many args} { proc foo {} {string match a b c d} list [catch {foo} msg] $msg } {1 {wrong # args: should be "string match ?-nocase? pattern string"}} -test string-11.3 {string match} { +test stringComp-11.3 {string match} { proc foo {} {string match abc abc} foo } 1 -test string-11.4 {string match} { +test stringComp-11.4 {string match} { proc foo {} {string mat abc abd} foo } 0 -test string-11.5 {string match} { +test stringComp-11.5 {string match} { proc foo {} {string match ab*c abc} foo } 1 -test string-11.6 {string match} { +test stringComp-11.6 {string match} { proc foo {} {string match ab**c abc} foo } 1 -test string-11.7 {string match} { +test stringComp-11.7 {string match} { proc foo {} {string match ab* abcdef} foo } 1 -test string-11.8 {string match} { +test stringComp-11.8 {string match} { proc foo {} {string match *c abc} foo } 1 -test string-11.9 {string match} { +test stringComp-11.9 {string match} { proc foo {} {string match *3*6*9 0123456789} foo } 1 -test string-11.10 {string match} { +test stringComp-11.10 {string match} { proc foo {} {string match *3*6*9 01234567890} foo } 0 -test string-11.11 {string match} { +test stringComp-11.11 {string match} { proc foo {} {string match a?c abc} foo } 1 -test string-11.12 {string match} { +test stringComp-11.12 {string match} { proc foo {} {string match a??c abc} foo } 0 -test string-11.13 {string match} { +test stringComp-11.13 {string match} { proc foo {} {string match ?1??4???8? 0123456789} foo } 1 -test string-11.14 {string match} { +test stringComp-11.14 {string match} { proc foo {} {string match {[abc]bc} abc} foo } 1 -test string-11.15 {string match} { +test stringComp-11.15 {string match} { proc foo {} {string match {a[abc]c} abc} foo } 1 -test string-11.16 {string match} { +test stringComp-11.16 {string match} { proc foo {} {string match {a[xyz]c} abc} foo } 0 -test string-11.17 {string match} { +test stringComp-11.17 {string match} { proc foo {} {string match {12[2-7]45} 12345} foo } 1 -test string-11.18 {string match} { +test stringComp-11.18 {string match} { proc foo {} {string match {12[ab2-4cd]45} 12345} foo } 1 -test string-11.19 {string match} { +test stringComp-11.19 {string match} { proc foo {} {string match {12[ab2-4cd]45} 12b45} foo } 1 -test string-11.20 {string match} { +test stringComp-11.20 {string match} { proc foo {} {string match {12[ab2-4cd]45} 12d45} foo } 1 -test string-11.21 {string match} { +test stringComp-11.21 {string match} { proc foo {} {string match {12[ab2-4cd]45} 12145} foo } 0 -test string-11.22 {string match} { +test stringComp-11.22 {string match} { proc foo {} {string match {12[ab2-4cd]45} 12545} foo } 0 -test string-11.23 {string match} { +test stringComp-11.23 {string match} { proc foo {} {string match {a\*b} a*b} foo } 1 -test string-11.24 {string match} { +test stringComp-11.24 {string match} { proc foo {} {string match {a\*b} ab} foo } 0 -test string-11.25 {string match} { +test stringComp-11.25 {string match} { proc foo {} {string match {a\*\?\[\]\\\x} "a*?\[\]\\x"} foo } 1 -test string-11.26 {string match} { +test stringComp-11.26 {string match} { proc foo {} {string match ** ""} foo } 1 -test string-11.27 {string match} { +test stringComp-11.27 {string match} { proc foo {} {string match *. ""} foo } 0 -test string-11.28 {string match} { +test stringComp-11.28 {string match} { proc foo {} {string match "" ""} foo } 1 -test string-11.29 {string match} { +test stringComp-11.29 {string match} { proc foo {} {string match \[a a} foo } 1 -test string-11.30 {string match, bad args} { +test stringComp-11.30 {string match, bad args} { proc foo {} {string match - b c} list [catch {foo} msg] $msg } {1 {bad option "-": must be -nocase}} -test string-11.31 {string match case} { +test stringComp-11.31 {string match case} { proc foo {} {string match a A} foo } 0 -test string-11.32 {string match nocase} { +test stringComp-11.32 {string match nocase} { proc foo {} {string match -n a A} foo } 1 -test string-11.33 {string match nocase} { +test stringComp-11.33 {string match nocase} { proc foo {} {string match -nocase a\334 A\374} foo } 1 -test string-11.34 {string match nocase} { +test stringComp-11.34 {string match nocase} { proc foo {} {string match -nocase a*f ABCDEf} foo } 1 -test string-11.35 {string match case, false hope} { +test stringComp-11.35 {string match case, false hope} { # This is true because '_' lies between the A-Z and a-z ranges proc foo {} {string match {[A-z]} _} foo } 1 -test string-11.36 {string match nocase range} { +test stringComp-11.36 {string match nocase range} { # This is false because although '_' lies between the A-Z and a-z ranges, # we lower case the end points before checking the ranges. proc foo {} {string match -nocase {[A-z]} _} foo } 0 -test string-11.37 {string match nocase} { +test stringComp-11.37 {string match nocase} { proc foo {} {string match -nocase {[A-fh-Z]} g} foo } 0 -test string-11.38 {string match case, reverse range} { +test stringComp-11.38 {string match case, reverse range} { proc foo {} {string match {[A-fh-Z]} g} foo } 1 -test string-11.39 {string match, *\ case} { +test stringComp-11.39 {string match, *\ case} { proc foo {} {string match {*\abc} abc} foo } 1 -test string-11.40 {string match, *special case} { +test stringComp-11.40 {string match, *special case} { proc foo {} {string match {*[ab]} abc} foo } 0 -test string-11.41 {string match, *special case} { +test stringComp-11.41 {string match, *special case} { proc foo {} {string match {*[ab]*} abc} foo } 1 -test string-11.42 {string match, *special case} { +test stringComp-11.42 {string match, *special case} { proc foo {} {string match "*\\" "\\"} foo } 0 -test string-11.43 {string match, *special case} { +test stringComp-11.43 {string match, *special case} { proc foo {} {string match "*\\\\" "\\"} foo } 1 -test string-11.44 {string match, *special case} { +test stringComp-11.44 {string match, *special case} { proc foo {} {string match "*???" "12345"} foo } 1 -test string-11.45 {string match, *special case} { +test stringComp-11.45 {string match, *special case} { proc foo {} {string match "*???" "12"} foo } 0 -test string-11.46 {string match, *special case} { +test stringComp-11.46 {string match, *special case} { proc foo {} {string match "*\\*" "abc*"} foo } 1 -test string-11.47 {string match, *special case} { +test stringComp-11.47 {string match, *special case} { proc foo {} {string match "*\\*" "*"} foo } 1 -test string-11.48 {string match, *special case} { +test stringComp-11.48 {string match, *special case} { proc foo {} {string match "*\\*" "*abc"} foo } 0 -test string-11.49 {string match, *special case} { +test stringComp-11.49 {string match, *special case} { proc foo {} {string match "?\\*" "a*"} foo } 1 -test string-11.50 {string match, *special case} { +test stringComp-11.50 {string match, *special case} { proc foo {} {string match "\\" "\\"} foo } 0 -test string-11.51 {string match; *, -nocase and UTF-8} { +test stringComp-11.51 {string match; *, -nocase and UTF-8} { proc foo {} {string match -nocase [binary format I 717316707] \ [binary format I 2028036707]} foo } 1 -test string-11.52 {string match, null char in string} { +test stringComp-11.52 {string match, null char in string} { proc foo {} { set ptn "*abc*" foreach elem [list "\u0000@abc" "@abc" "\u0000@abc\u0000" "blahabcblah"] { @@ -658,7 +658,7 @@ test string-11.52 {string match, null char in string} { } foo } {1 1 1 1} -test string-11.53 {string match, null char in pattern} { +test stringComp-11.53 {string match, null char in pattern} { proc foo {} { set out "" foreach {ptn elem} [list \ @@ -674,7 +674,7 @@ test string-11.53 {string match, null char in pattern} { } foo } {1 0 1 0 1} -test string-11.54 {string match, failure} { +test stringComp-11.54 {string match, failure} { proc foo {} { set longString "" for {set i 0} {$i < 10} {incr i} { diff --git a/tests/unixInit.test b/tests/unixInit.test index 4523ee3..61d69d0 100644 --- a/tests/unixInit.test +++ b/tests/unixInit.test @@ -10,11 +10,11 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: unixInit.test,v 1.30.2.8 2004/05/05 21:34:52 dgp Exp $ +# RCS: @(#) $Id: unixInit.test,v 1.30.2.9 2004/10/28 00:01:12 dgp Exp $ package require tcltest 2 namespace import -force ::tcltest::* -catch {unset path} +unset -nocomplain path if {[info exists env(TCL_LIBRARY)]} { set oldlibrary $env(TCL_LIBRARY) unset env(TCL_LIBRARY) @@ -381,5 +381,6 @@ if {[info exists oldlibrary]} { } catch {unset env(LANG)} catch {set env(LANG) $oldlang} +unset -nocomplain path ::tcltest::cleanupTests return diff --git a/tests/winPipe.test b/tests/winPipe.test index 60e7dd5..4cc6e26 100644 --- a/tests/winPipe.test +++ b/tests/winPipe.test @@ -12,10 +12,11 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: winPipe.test,v 1.22.2.1 2004/02/25 07:56:11 davygrvy Exp $ +# RCS: @(#) $Id: winPipe.test,v 1.22.2.2 2004/10/28 00:01:12 dgp Exp $ package require tcltest namespace import -force ::tcltest::* +unset -nocomplain path testConstraint exec [llength [info commands exec]] -- cgit v0.12