aboutsummaryrefslogtreecommitdiff
path: root/test.tcl
diff options
context:
space:
mode:
authorantirez <antirez>2005-03-03 22:10:52 +0000
committerantirez <antirez>2005-03-03 22:10:52 +0000
commitb19ba0f0f7a994306878b348f223a8d3d2995d1b (patch)
tree2967cc61fca8b480e91343405acd444d2bd64d93 /test.tcl
parent39c829b54eeeaa553307719a31fe5a53edc6bbb3 (diff)
downloadjimtcl-b19ba0f0f7a994306878b348f223a8d3d2995d1b.zip
jimtcl-b19ba0f0f7a994306878b348f223a8d3d2995d1b.tar.gz
jimtcl-b19ba0f0f7a994306878b348f223a8d3d2995d1b.tar.bz2
[string map ?-nocase? ...] implemented. tests added.
Diffstat (limited to 'test.tcl')
-rw-r--r--test.tcl49
1 files changed, 49 insertions, 0 deletions
diff --git a/test.tcl b/test.tcl
index 011fa21..aa2ef61 100644
--- a/test.tcl
+++ b/test.tcl
@@ -2237,6 +2237,55 @@ test string-9.3 {string length} {
foo
} 15
+# string map
+
+test string-10.4 {string map} {
+ string map {a b} abba
+} {bbbb}
+test string-10.5 {string map} {
+ string map {a b} a
+} {b}
+test string-10.6 {string map -nocase} {
+ string map -nocase {a b} Abba
+} {bbbb}
+test string-10.7 {string map} {
+ string map {abc 321 ab * a A} aabcabaababcab
+} {A321*A*321*}
+test string-10.8 {string map -nocase} {
+ string map -nocase {aBc 321 Ab * a A} aabcabaababcab
+} {A321*A*321*}
+test string-10.10 {string map} {
+ list [catch {string map {a b c} abba} msg] $msg
+} {1 {list must contain an even number of elements}}
+test string-10.11 {string map, nulls} {
+ string map {\x00 NULL blah \x00nix} {qwerty}
+} {qwerty}
+test string-10.12 {string map, unicode} {
+ string map [list \374 ue UE \334] "a\374ueUE\000EU"
+} aueue\334\0EU
+test string-10.13 {string map, -nocase unicode} {
+ string map -nocase [list \374 ue UE \334] "a\374ueUE\000EU"
+} aue\334\334\0EU
+test string-10.14 {string map, -nocase null arguments} {
+ string map -nocase {{} abc} foo
+} foo
+test string-10.15 {string map, one pair case} {
+ string map -nocase {abc 32} aAbCaBaAbAbcAb
+} {a32aBaAb32Ab}
+test string-10.16 {string map, one pair case} {
+ string map -nocase {ab 4321} aAbCaBaAbAbcAb
+} {a4321C4321a43214321c4321}
+test string-10.17 {string map, one pair case} {
+ string map {Ab 4321} aAbCaBaAbAbcAb
+} {a4321CaBa43214321c4321}
+test string-10.18 {string map, empty argument} {
+ string map -nocase {{} abc} foo
+} foo
+test string-10.19 {string map, empty arguments} {
+ string map -nocase {{} abc f bar {} def} foo
+} baroo
+
+
################################################################################
# FINAL REPORT
################################################################################