diff options
author | dgp <dgp@users.sourceforge.net> | 2004-02-25 23:56:58 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2004-02-25 23:56:58 (GMT) |
commit | 9f1913a0d8f82a07b0ed1500f3b3d31d3ff0f9c6 (patch) | |
tree | c4e71eedeebec78847b456ffa6f2bd451c9a92d3 /tests/source.test | |
parent | f8f2edda8715ea332ecf36f0b07d45d662f9a9ff (diff) | |
download | tcl-9f1913a0d8f82a07b0ed1500f3b3d31d3ff0f9c6.zip tcl-9f1913a0d8f82a07b0ed1500f3b3d31d3ff0f9c6.tar.gz tcl-9f1913a0d8f82a07b0ed1500f3b3d31d3ff0f9c6.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 828b9da..ce2e87c 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.10 2003/10/07 21:45:39 dgp Exp $ +# RCS: @(#) $Id: source.test,v 1.11 2004/02/25 23:56:59 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}}] |