diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2012-02-23 21:08:11 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2012-02-23 21:08:11 (GMT) |
commit | fbbaada7c6f41c2d812462097bb2bd959e516491 (patch) | |
tree | f073644653dd2240e0cbd30ddf34ab71e3f61c64 /tests/reg.test | |
parent | e4e0da064a9354c10ce335e9f37ecf48af2d9090 (diff) | |
download | tcl-fbbaada7c6f41c2d812462097bb2bd959e516491.zip tcl-fbbaada7c6f41c2d812462097bb2bd959e516491.tar.gz tcl-fbbaada7c6f41c2d812462097bb2bd959e516491.tar.bz2 |
Add tests relating to bug 1115587. The bug itself still exists at this point.
Diffstat (limited to 'tests/reg.test')
-rw-r--r-- | tests/reg.test | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/tests/reg.test b/tests/reg.test index d92339f..0ebfa11 100644 --- a/tests/reg.test +++ b/tests/reg.test @@ -174,14 +174,32 @@ namespace eval RETest { return $ret } + # Share the generation of the list of test constraints so it is + # done the same on all routes. + proc TestConstraints {flags} { + set constraints [list testregexp] + + variable regBug + if {$regBug} { + # This will trigger registration as a skipped test + lappend constraints knownBug + } + + # Tcl locale stuff doesn't do the ch/xy test fakery yet + if {[string match *+* $flags]} { + # This will trigger registration as a skipped test + lappend constraints localeRegexp + } + + return $constraints + } + # match expected, internal routine that does the work # parameters like the "real" routines except they don't have "opts", # which is a possibly-empty list of switches for the regexp match attempt # The ! flag is used to indicate expected match failure (for REG_EXPECT, # which wants argument testing even in the event of failure). proc MatchExpected {opts testid flags re target args} { - variable regBug - # if &, test as both BRE and ARE if {[string match *&* $flags]} { set f [string map {& {}} $flags] @@ -190,18 +208,7 @@ namespace eval RETest { return } - set constraints [list testregexp] - - if {$regBug} { - # This will register as a skipped test - lappend constraints knownBug - } - - # Tcl locale stuff doesn't do the ch/xy test fakery yet - if {[string match *+* $flags]} { - # This will register as a skipped test - lappend constraints localeRegexp - } + set constraints [TestConstraints $flags] set f [TestFlags $flags] set infoflags [TestInfoFlags $flags] @@ -252,13 +259,7 @@ namespace eval RETest { return } - set constraints [list testregexp] - - # Tcl locale stuff doesn't do the ch/xy test fakery yet - if {[string match *+* $flags]} { - # This will register as a skipped test - lappend constraints localeRegexp - } + set constraints [TestConstraints $flags] set cmd [list testregexp -about {*}[TestFlags $flags] $re] ::tcltest::test [TestNum $testid error] [TestDesc $testid error] \ @@ -268,6 +269,7 @@ namespace eval RETest { # match failure expected proc expectNomatch {testid flags re target args} { + variable regBug # if &, test as both ARE and BRE if {[string match *&* $flags]} { set f [string map {& {}} $flags] @@ -276,13 +278,7 @@ namespace eval RETest { return } - set constraints [list testregexp] - - # Tcl locale stuff doesn't do the ch/xy test fakery yet - if {[string match *+* $flags]} { - # This will register as a skipped test - lappend constraints localeRegexp - } + set constraints [TestConstraints $flags] set f [TestFlags $flags] set infoflags [TestInfoFlags $flags] @@ -331,7 +327,7 @@ namespace eval RETest { } } namespace import RETest::* - + ######## the tests themselves ######## # support functions and preliminary misc. @@ -660,6 +656,9 @@ expectMatch 14.17 RP {a([bc])(\1*)} ab ab b "" expectError 14.18 - {a((b)\1)} ESUBREG expectError 14.19 - {a(b)c\2} ESUBREG expectMatch 14.20 bR {a\(b*\)c\1} abbcbb abbcbb bb +expectMatch 14.21 RP {^([bc])\1*$} bbb bbb b +expectMatch 14.22 RP {^([bc])\1*$} ccc ccc c +knownBug expectNomatch 14.23 R {^([bc])\1*$} bcb doing 15 "octal escapes vs back references" @@ -1069,7 +1068,11 @@ test reg-33.13 {Bug 1810264 - infinite loop} { test reg-33.14 {Bug 1810264 - super-expensive expression} nonPortable { regexp {(x{200}){200}$y} {x} } 0 - + # cleanup ::tcltest::cleanupTests return + +# Local Variables: +# mode: tcl +# End: |