summaryrefslogtreecommitdiffstats
path: root/tests/source.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/source.test')
-rw-r--r--tests/source.test23
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}}]