diff options
author | dgp <dgp@users.sourceforge.net> | 2004-02-25 23:38:14 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2004-02-25 23:38:14 (GMT) |
commit | 4e389884a3823483212e4dd7d41287db9cf727ae (patch) | |
tree | 3ebec546b31e48e9389e4c0bc0a55927e5a295e6 /tests/source.test | |
parent | c2915400905bc123ad738b9a636d049cd183cae7 (diff) | |
download | tcl-4e389884a3823483212e4dd7d41287db9cf727ae.zip tcl-4e389884a3823483212e4dd7d41287db9cf727ae.tar.gz tcl-4e389884a3823483212e4dd7d41287db9cf727ae.tar.bz2 |
* tests/basic.test: Made several tests more robust to the
* tests/cmdMZ.test: list-quoting of path names that might
* tests/exec.test: contain Tcl-special chars like { or [.
* tests/io.test: Should help us sort out Tcl Bug 554068.
* tests/pid.test:
* tests/socket.test:
* tests/source.test:
* tests/unixInit.test:
Diffstat (limited to 'tests/source.test')
-rw-r--r-- | tests/source.test | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/tests/source.test b/tests/source.test index c603c1b..6417af7 100644 --- a/tests/source.test +++ b/tests/source.test @@ -12,10 +12,10 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: source.test,v 1.8.2.1 2003/10/07 18:53:23 dgp Exp $ +# RCS: @(#) $Id: source.test,v 1.8.2.2 2004/02/25 23:38:17 dgp Exp $ -if {[catch {package require tcltest 2.0.2}]} { - puts stderr "Skipping tests in [info script]. tcltest 2.0.2 required." +if {[catch {package require tcltest 2.1}]} { + puts stderr "Skipping tests in [info script]. tcltest 2.1 required." return } @@ -25,6 +25,7 @@ namespace eval ::tcl::test::source { namespace import ::tcltest::cleanupTests namespace import ::tcltest::makeFile namespace import ::tcltest::removeFile + namespace import ::tcltest::customMatch test source-1.1 {source command} -setup { set x "old x value" @@ -63,6 +64,18 @@ test source-1.3 {source command} -setup { removeFile source.file } -result {a b c d e f} +proc ListGlobMatch {expected actual} { + if {[llength $expected] != [llength $actual]} { + return 0 + } + foreach e $expected a $actual { + if {![string match $e $a]} { + return 0 + } + } + return 1 +} +customMatch listGlob [namespace which ListGlobMatch] test source-2.3 {source error conditions} -setup { set sourcefile [makeFile { @@ -74,7 +87,7 @@ test source-2.3 {source error conditions} -setup { list [catch {source $sourcefile} msg] $msg $::errorInfo } -cleanup { removeFile source.file -} -match glob -result [list 1 {error in sourced file} \ +} -match listGlob -result [list 1 {error in sourced file} \ {error in sourced file while executing "error "error in sourced file"" @@ -103,7 +116,7 @@ test source-2.6 {source error conditions} -setup { removeFile _non_existent_ } -body { list [catch {source $sourcefile} msg] $msg $::errorCode -} -match glob -result [list 1 \ +} -match listGlob -result [list 1 \ {couldn't read file "*_non_existent_": no such file or directory} \ {POSIX ENOENT {no such file or directory}}] |