diff options
author | dkf <donal.k.fellows@manchester.ac.uk> | 2017-02-11 21:36:36 (GMT) |
---|---|---|
committer | dkf <donal.k.fellows@manchester.ac.uk> | 2017-02-11 21:36:36 (GMT) |
commit | efa3ec69393a1dee51e76e848dbe10ebaa55603e (patch) | |
tree | e58a24b15db6580a63f08ba1979616861a7c5cbb /tests/regexp.test | |
parent | 8fb5bb0f202daaf8e2a31c2bf6e69381d206c021 (diff) | |
download | tcl-efa3ec69393a1dee51e76e848dbe10ebaa55603e.zip tcl-efa3ec69393a1dee51e76e848dbe10ebaa55603e.tar.gz tcl-efa3ec69393a1dee51e76e848dbe10ebaa55603e.tar.bz2 |
Proposed implementation of [regsub -command].
Diffstat (limited to 'tests/regexp.test')
-rw-r--r-- | tests/regexp.test | 22 |
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 |