summaryrefslogtreecommitdiff
path: root/tcl/tests/switch.test
diff options
context:
space:
mode:
Diffstat (limited to 'tcl/tests/switch.test')
-rw-r--r--tcl/tests/switch.test27
1 files changed, 24 insertions, 3 deletions
diff --git a/tcl/tests/switch.test b/tcl/tests/switch.test
index 2041dc31e19..c8ecbe7e72c 100644
--- a/tcl/tests/switch.test
+++ b/tcl/tests/switch.test
@@ -6,13 +6,17 @@
#
# Copyright (c) 1993 The Regents of the University of California.
# Copyright (c) 1994 Sun Microsystems, Inc.
+# Copyright (c) 1998-1999 by Scriptics Corporation.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# RCS: @(#) $Id$
-if {[string compare test [info procs test]] == 1} then {source defs}
+if {[lsearch [namespace children] ::tcltest] == -1} {
+ package require tcltest
+ namespace import -force ::tcltest::*
+}
test switch-1.1 {simple patterns} {
switch a a {format 1} b {format 2} c {format 3} default {format 4}
@@ -56,7 +60,7 @@ test switch-3.1 {-exact vs. -glob vs. -regexp} {
}
} exact
test switch-3.2 {-exact vs. -glob vs. -regexp} {
- switch -exact -regexp aaaab {
+ switch -regexp aaaab {
^a*b$ {concat regexp}
*b {concat glob}
aaaab {concat exact}
@@ -121,7 +125,7 @@ test switch-5.1 {errors in -regexp matching} {
aaaab {concat exact}
default {concat none}
}} msg] $msg
-} {1 {couldn't compile regular expression pattern: ?+* follows nothing}}
+} {1 {couldn't compile regular expression pattern: quantifier operand invalid}}
test switch-6.1 {backslashes in patterns} {
switch -exact {\a\$\.\[} {
@@ -177,3 +181,20 @@ test switch-8.1 {empty body} {
default {set msg 2}
}
} {}
+
+# cleanup
+::tcltest::cleanupTests
+return
+
+
+
+
+
+
+
+
+
+
+
+
+