diff options
author | Steve Bennett <steveb@workware.net.au> | 2010-10-30 15:21:21 +1000 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2010-11-22 13:27:14 +1000 |
commit | 192056900583884bc1f07f371df6478d856ada3b (patch) | |
tree | 540618a3e81d8d9e14261e267edb912f5b73710a /tests/jim.test | |
parent | d98489727fe31fa217d237b36901211adc35282d (diff) | |
download | jimtcl-192056900583884bc1f07f371df6478d856ada3b.zip jimtcl-192056900583884bc1f07f371df6478d856ada3b.tar.gz jimtcl-192056900583884bc1f07f371df6478d856ada3b.tar.bz2 |
Overhaul unit test framework
Much closer to tcltest now, including constraints.
Try to get all appropriate tests running under both Jim and Tcl.
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests/jim.test')
-rw-r--r-- | tests/jim.test | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/tests/jim.test b/tests/jim.test index 1fcead3..1d477e2 100644 --- a/tests/jim.test +++ b/tests/jim.test @@ -7,13 +7,11 @@ # # Sometimes tests are modified to reflect different error messages. -source testing.tcl +source [file dirname [info script]]/testing.tcl +needs constraint jim catch {package require regexp} - -if {[info commands regexp] eq ""} { - proc regexp {pat str} {expr {$pat eq "^a*b$" && $str eq "aaaab"}} -} +testConstraint regexp [expr {[info commands regexp] ne {}}] ################################################################################ # SET @@ -2452,7 +2450,7 @@ test switch-3.1 {-exact vs. -glob vs. -regexp} { default {concat none} } } exact -test switch-3.2 {-exact vs. -glob vs. -regexp (no [regexp] cmd)} { +test switch-3.2 {-exact vs. -glob vs. -regexp (no [regexp] cmd)} regexp { rename regexp regexp.none set rc [catch { switch -regexp aaaab { @@ -2466,7 +2464,7 @@ test switch-3.2 {-exact vs. -glob vs. -regexp (no [regexp] cmd)} { set rc } 1 -test switch-3.3 {-exact vs. -glob vs. -regexp (with [regexp] cmd)} { +test switch-3.3 {-exact vs. -glob vs. -regexp (with [regexp] cmd)} regexp { switch -regexp aaaab { ^a*b$ {concat regexp} *b {concat glob} @@ -2516,13 +2514,13 @@ test switch-4.5 {error in default command} { default {error switch2}} msg] $msg } {1 switch2} -#~ test switch-5.1 {errors in -regexp matching} { - #~ list [catch {switch -regexp aaaab { - #~ *b {concat glob} - #~ aaaab {concat exact} - #~ default {concat none} - #~ }} msg] $msg -#~ } {1 {couldn't compile regular expression pattern: quantifier operand invalid}} +test switch-5.1 {errors in -regexp matching} regexp { + list [catch {switch -regexp aaaab { + *b {concat glob} + aaaab {concat exact} + default {concat none} + }} msg] $msg +} {1 {couldn't compile regular expression pattern: quantifier operand invalid}} test switch-6.1 {backslashes in patterns} { switch -exact {\a\$\.\[} { |