summaryrefslogtreecommitdiffstats
path: root/tests/switch.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2003-04-28 10:05:14 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2003-04-28 10:05:14 (GMT)
commit270dd26ada27456d73cfdcaf7623fee880227569 (patch)
tree60a15fad984f16bbee15913a3f56f55381838c15 /tests/switch.test
parent044b2f3286bfc5afce188db48744bc1512a55cea (diff)
downloadtcl-270dd26ada27456d73cfdcaf7623fee880227569.zip
tcl-270dd26ada27456d73cfdcaf7623fee880227569.tar.gz
tcl-270dd26ada27456d73cfdcaf7623fee880227569.tar.bz2
Default mode of operation of [switch] is exact matching. [Bug 727563]
Diffstat (limited to 'tests/switch.test')
-rw-r--r--tests/switch.test23
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/switch.test b/tests/switch.test
index 153557f..cfc80ec 100644
--- a/tests/switch.test
+++ b/tests/switch.test
@@ -11,7 +11,7 @@
# 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.8 2003/03/05 22:31:24 dkf Exp $
+# RCS: @(#) $Id: switch.test,v 1.9 2003/04/28 10:05:28 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -331,7 +331,26 @@ test switch-10.9 {comparison of compiled and interpreted behaviour of switch, ex
test switch-10.10 {comparison of compiled and interpreted behaviour of switch, glob matching with default} {
expr {[cswtest2-glob abcb] eq [iswtest2-glob abcb]}
} 1
-
+proc cswtest-default-exact {x} {
+ switch -- $x {
+ a* {return b}
+ aa {return c}
+ default {return d}
+ }
+}
+test switch-10.11 {default to exact matching when compiled} {
+ cswtest-default-exact a
+} d
+test switch-10.12 {default to exact matching when compiled} {
+ cswtest-default-exact aa
+} c
+test switch-10.13 {default to exact matching when compiled} {
+ cswtest-default-exact a*
+} b
+test switch-10.14 {default to exact matching when compiled} {
+ cswtest-default-exact a**
+} d
+rename cswtest-default-exact {}
rename cswtest-glob {}
rename iswtest-glob {}
rename cswtest2-glob {}