summaryrefslogtreecommitdiffstats
path: root/tests/regexp.test
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2017-02-11 21:36:36 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2017-02-11 21:36:36 (GMT)
commit293d30f0a2a4756db591e83e93eae24681e0ec7a (patch)
treee58a24b15db6580a63f08ba1979616861a7c5cbb /tests/regexp.test
parent089e88af6f855e42658be530688791a814c26e91 (diff)
downloadtcl-293d30f0a2a4756db591e83e93eae24681e0ec7a.zip
tcl-293d30f0a2a4756db591e83e93eae24681e0ec7a.tar.gz
tcl-293d30f0a2a4756db591e83e93eae24681e0ec7a.tar.bz2
Proposed implementation of [regsub -command].
Diffstat (limited to 'tests/regexp.test')
-rw-r--r--tests/regexp.test22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/regexp.test b/tests/regexp.test
index 4ffdbdb..6c77b41 100644
--- a/tests/regexp.test
+++ b/tests/regexp.test
@@ -453,7 +453,7 @@ test regexp-11.4 {regsub errors} {
} {1 {wrong # args: should be "regsub ?-option ...? exp string subSpec ?varName?"}}
test regexp-11.5 {regsub errors} {
list [catch {regsub -gorp a b c} msg] $msg
-} {1 {bad option "-gorp": must be -all, -nocase, -expanded, -line, -linestop, -lineanchor, -start, or --}}
+} {1 {bad option "-gorp": must be -all, -command, -expanded, -line, -linestop, -lineanchor, -nocase, -start, or --}}
test regexp-11.6 {regsub errors} {
list [catch {regsub -nocase a( b c d} msg] $msg
} {1 {couldn't compile regular expression pattern: parentheses () not balanced}}
@@ -1123,6 +1123,26 @@ test regexp-26.12 {regexp with -line option} {
test regexp-26.13 {regexp without -line option} {
regexp -all -inline -- {a*} "b\n"
} {{} {}}
+
+test regexp-27.1 {regsub -command} {
+ regsub -command {.x.} {abcxdef} {string length}
+} ab3ef
+test regexp-27.2 {regsub -command} {
+ regsub -command {.x.} {abcxdefxghi} {string length}
+} ab3efxghi
+test regexp-27.3 {regsub -command} {
+ set x 0
+ regsub -all -command {(?=.)} abcde "incr x;#"
+} 1a2b3c4d5e
+test regexp-27.4 {regsub -command} -body {
+ regsub -command {.x.} {abcxdef} error
+} -returnCodes error -result cxd
+test regexp-27.5 {regsub -command} {
+ regsub -command {(.)(.)} {abcdef} {list ,}
+} {, ab a bcdef}
+test regexp-27.6 {regsub -command} {
+ regsub -command -all {(.)(.)} {abcdef} {list ,}
+} {, ab a b, cd c d, ef e f}
# cleanup
::tcltest::cleanupTests