summaryrefslogtreecommitdiffstats
path: root/tests/switch.test
diff options
context:
space:
mode:
Diffstat (limited to 'tests/switch.test')
-rw-r--r--tests/switch.test27
1 files changed, 23 insertions, 4 deletions
diff --git a/tests/switch.test b/tests/switch.test
index 4d1f4a8..cdbfc61 100644
--- a/tests/switch.test
+++ b/tests/switch.test
@@ -6,13 +6,16 @@
#
# 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: switch.test,v 1.2 1998/09/14 18:40:14 stanton Exp $
+# RCS: @(#) $Id: switch.test,v 1.3 1999/04/16 00:47:35 stanton Exp $
-if {[string compare test [info procs test]] == 1} then {source defs}
+if {[lsearch [namespace children] ::tcltest] == -1} {
+ source [file join [pwd] [file dirname [info script]] defs.tcl]
+}
test switch-1.1 {simple patterns} {
switch a a {format 1} b {format 2} c {format 3} default {format 4}
@@ -56,7 +59,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 +124,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 +180,19 @@ test switch-8.1 {empty body} {
default {set msg 2}
}
} {}
+
+# cleanup
+::tcltest::cleanupTests
+return
+
+
+
+
+
+
+
+
+
+
+
+