diff options
author | andreask <andreask> | 2013-01-22 19:24:25 (GMT) |
---|---|---|
committer | andreask <andreask> | 2013-01-22 19:24:25 (GMT) |
commit | 6d8a36d84d2843681302604a082e2f787c3c3674 (patch) | |
tree | 9d3b4ee05189203cf7ce94b4b2a6d2d911aaa18d /tests/regexp.test | |
parent | 296aebbd6ee092a25741684fa37ee31ef5a3e222 (diff) | |
download | tcl-6d8a36d84d2843681302604a082e2f787c3c3674.zip tcl-6d8a36d84d2843681302604a082e2f787c3c3674.tar.gz tcl-6d8a36d84d2843681302604a082e2f787c3c3674.tar.bz2 |
Contribution by Patrick Fradin <patrick.fradin@planar.com>
Quoting his mail:
<pre>
==========================================================
Hi Jeff,
I spent some of my time to contribute to the TclTk community ! I'm in
late for Christmas gift but like we said in French : "Mieux vaut tard
que jamais". ;-)
I've use TclDevKit 5.3.0 tclchecker to analyse TclTk code in Tcl and
Tk library directories (library, tools and tests) to correct a lot of
warnings and few errors. (encapsulate some expr, use 'chan xxx'
instead of fconfigure, fileevent...)
I've made some improvements too :
Examples :
- Use 'lassign' instead of many 'lindex' of 'foreach/break' loop.
- Use 'in' or 'ni' operators instead of 'lsearch -exact' or to
factorise some eq/ne && / || tests.
- Use 'eq' or 'ne' to tests strings instead of '==' or '!='.
- Use 'unset -nocomplain' to avoid 'catch {unset...}'.
- Remove some useless catch around 'destroy' calls.
- Use expand {*} instead of 'eval'. Don't touch a lot of code because
I don't know all structs and lists. I think it could be a greater
improvement to reduce 'eval' calls.
Due to previous experience, I dot not change any indentation ! ;-)
==========================================================
</pre>
Diffstat (limited to 'tests/regexp.test')
-rw-r--r-- | tests/regexp.test | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tests/regexp.test b/tests/regexp.test index 7cafd1b..97628b1 100644 --- a/tests/regexp.test +++ b/tests/regexp.test @@ -895,7 +895,7 @@ test regexp-23.11 {regexp -all and -line} { } {{1 1} {2 2} {4 4}} test regexp-24.1 {regsub -all and -line} { - foreach {v1 v2 v3} {{} {} {}} {} + lassign "" v1 v2 v3 set string "" list \ [regsub -line -all {^} $string {<&>} v1] $v1 \ @@ -903,7 +903,7 @@ test regexp-24.1 {regsub -all and -line} { [regsub -line -all {$} $string {<&>} v3] $v3 } {1 <> 1 <> 1 <>} test regexp-24.2 {regsub -all and -line} { - foreach {v1 v2 v3} {{} {} {}} {} + lassign "" v1 v2 v3 set string "\n" list \ [regsub -line -all {^} $string {<&>} v1] $v1 \ @@ -911,7 +911,7 @@ test regexp-24.2 {regsub -all and -line} { [regsub -line -all {$} $string {<&>} v3] $v3 } [list 2 "<>\n<>" 2 "<>\n<>" 2 "<>\n<>"] test regexp-24.3 {regsub -all and -line} { - foreach {v1 v2 v3} {{} {} {}} {} + lassign "" v1 v2 v3 set string "\n\n" list \ [regsub -line -all {^} $string {<&>} v1] $v1 \ @@ -919,7 +919,7 @@ test regexp-24.3 {regsub -all and -line} { [regsub -line -all {$} $string {<&>} v3] $v3 } [list 3 "<>\n<>\n<>" 3 "<>\n<>\n<>" 3 "<>\n<>\n<>"] test regexp-24.4 {regsub -all and -line} { - foreach {v1 v2 v3} {{} {} {}} {} + lassign "" v1 v2 v3 set string "a" list \ [regsub -line -all {^} $string {<&>} v1] $v1 \ @@ -927,7 +927,7 @@ test regexp-24.4 {regsub -all and -line} { [regsub -line -all {$} $string {<&>} v3] $v3 } [list 1 "<>a" 1 "<a>" 1 "a<>"] test regexp-24.5 {regsub -all and -line} { - foreach {v1 v2 v3} {{} {} {}} {} + lassign "" v1 v2 v3 set string "a\n" list \ [regsub -line -all {^} $string {<&>} v1] $v1 \ @@ -935,7 +935,7 @@ test regexp-24.5 {regsub -all and -line} { [regsub -line -all {$} $string {<&>} v3] $v3 } [list 2 "<>a\n<>" 2 "<a>\n<>" 2 "a<>\n<>"] test regexp-24.6 {regsub -all and -line} { - foreach {v1 v2 v3} {{} {} {}} {} + lassign "" v1 v2 v3 set string "\na" list \ [regsub -line -all {^} $string {<&>} v1] $v1 \ @@ -943,7 +943,7 @@ test regexp-24.6 {regsub -all and -line} { [regsub -line -all {$} $string {<&>} v3] $v3 } [list 2 "<>\n<>a" 2 "<>\n<a>" 2 "<>\na<>"] test regexp-24.7 {regsub -all and -line} { - foreach {v1 v2 v3} {{} {} {}} {} + lassign "" v1 v2 v3 set string "ab\n" list \ [regsub -line -all {^} $string {<&>} v1] $v1 \ @@ -951,7 +951,7 @@ test regexp-24.7 {regsub -all and -line} { [regsub -line -all {$} $string {<&>} v3] $v3 } [list 2 "<>ab\n<>" 2 "<ab>\n<>" 2 "ab<>\n<>"] test regexp-24.8 {regsub -all and -line} { - foreach {v1 v2 v3} {{} {} {}} {} + lassign "" v1 v2 v3 set string "a\nb" list \ [regsub -line -all {^} $string {<&>} v1] $v1 \ @@ -959,7 +959,7 @@ test regexp-24.8 {regsub -all and -line} { [regsub -line -all {$} $string {<&>} v3] $v3 } [list 2 "<>a\n<>b" 2 "<a>\n<b>" 2 "a<>\nb<>"] test regexp-24.9 {regsub -all and -line} { - foreach {v1 v2 v3} {{} {} {}} {} + lassign "" v1 v2 v3 set string "a\nb\n" list \ [regsub -line -all {^} $string {<&>} v1] $v1 \ @@ -967,7 +967,7 @@ test regexp-24.9 {regsub -all and -line} { [regsub -line -all {$} $string {<&>} v3] $v3 } [list 3 "<>a\n<>b\n<>" 3 "<a>\n<b>\n<>" 3 "a<>\nb<>\n<>"] test regexp-24.10 {regsub -all and -line} { - foreach {v1 v2 v3} {{} {} {}} {} + lassign "" v1 v2 v3 set string "a\nb\nc" list \ [regsub -line -all {^} $string {<&>} v1] $v1 \ |