summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--tests/switch.test108
2 files changed, 112 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index cc5c7f7..f4c5b72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-21 Donal K. Fellows <dkf@users.sf.net>
+
+ * tests/switch.test: Added more tests of regexp-mode compilation of
+ the [switch] command. [Bug 1854435]
+
2008-03-20 Donal K. Fellows <dkf@users.sf.net>
* generic/tcl.h, generic/tclThreadAlloc.c: Tidied up the declarations
diff --git a/tests/switch.test b/tests/switch.test
index 45f494f..9a46191 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.20 2008/02/12 10:27:27 dkf Exp $
+# RCS: @(#) $Id: switch.test,v 1.21 2008/03/21 19:09:13 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -635,7 +635,113 @@ test switch-14.4 {-regexp -- compilation [Bug 1854399]} {
}
foo
} yes
+test switch-14.5 {switch -regexp compilation} {
+ apply {{} {
+ switch -regexp -- 0 {
+ {0|1|2} {return yes}
+ default {return no}
+ }
+ }}
+} yes
+test switch-14.6 {switch -regexp compilation} {
+ apply {{} {
+ switch -regexp -- 0 {
+ {0|11|222} {return yes}
+ default {return no}
+ }
+ }}
+} yes
+test switch-14.7 {switch -regexp compilation} {
+ apply {{} {
+ switch -regexp -- 0 {
+ {[012]} {return yes}
+ default {return no}
+ }
+ }}
+} yes
+test switch-14.8 {switch -regexp compilation} {
+ apply {{} {
+ switch -regexp -- x {
+ {0|1|2} {return yes}
+ default {return no}
+ }
+ }}
+} no
+test switch-14.9 {switch -regexp compilation} {
+ apply {{} {
+ switch -regexp -- x {
+ {0|11|222} {return yes}
+ default {return no}
+ }
+ }}
+} no
+test switch-14.10 {switch -regexp compilation} {
+ apply {{} {
+ switch -regexp -- x {
+ {[012]} {return yes}
+ default {return no}
+ }
+ }}
+} no
+test switch-14.11 {switch -regexp compilation} {
+ apply {{} {
+ switch -regexp -- x {
+ {0|1|2} {return yes}
+ .+ {return yes2}
+ default {return no}
+ }
+ }}
+} yes2
+test switch-14.12 {switch -regexp compilation} {
+ apply {{} {
+ switch -regexp -- x {
+ {0|11|222} {return yes}
+ .+ {return yes2}
+ default {return no}
+ }
+ }}
+} yes2
+test switch-14.13 {switch -regexp compilation} {
+ apply {{} {
+ switch -regexp -- x {
+ {[012]} {return yes}
+ .+ {return yes2}
+ default {return no}
+ }
+ }}
+} yes2
+test switch-14.14 {switch -regexp compilation} {
+ apply {{} {
+ switch -regexp -- {} {
+ {0|1|2} {return yes}
+ .+ {return yes2}
+ default {return no}
+ }
+ }}
+} no
+test switch-14.15 {switch -regexp compilation} {
+ apply {{} {
+ switch -regexp -- {} {
+ {0|11|222} {return yes}
+ .+ {return yes2}
+ default {return no}
+ }
+ }}
+} no
+test switch-14.16 {switch -regexp compilation} {
+ apply {{} {
+ switch -regexp -- {} {
+ {[012]} {return yes}
+ .+ {return yes2}
+ default {return no}
+ }
+ }}
+} no
# cleanup
::tcltest::cleanupTests
return
+
+# Local Variables:
+# mode: tcl
+# End: