aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2010-10-20 16:01:17 +1000
committerSteve Bennett <steveb@workware.net.au>2010-11-17 07:57:37 +1000
commit9f6ad73686d6dc1fc8628be60a0d42a6ee20817c (patch)
tree455e400d7d49937b5814d824ff40461aee93b8ff /tests
parentabac7fb5ee7d37150951b9618ba6a0ee57d98085 (diff)
downloadjimtcl-9f6ad73686d6dc1fc8628be60a0d42a6ee20817c.zip
jimtcl-9f6ad73686d6dc1fc8628be60a0d42a6ee20817c.tar.gz
jimtcl-9f6ad73686d6dc1fc8628be60a0d42a6ee20817c.tar.bz2
Add UTF-8 support to Jim
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests')
-rw-r--r--tests/format.test502
-rw-r--r--tests/jim.test14
-rw-r--r--tests/lsort.test4
-rw-r--r--tests/misc.test3
-rw-r--r--tests/scan.test26
-rw-r--r--tests/string.test18
-rw-r--r--tests/stringmatch.test228
-rw-r--r--tests/testing.tcl18
-rw-r--r--tests/utf8.test336
9 files changed, 1121 insertions, 28 deletions
diff --git a/tests/format.test b/tests/format.test
new file mode 100644
index 0000000..7926379
--- /dev/null
+++ b/tests/format.test
@@ -0,0 +1,502 @@
+# Commands covered: format
+#
+# This file contains a collection of tests for one or more of the Tcl
+# built-in commands. Sourcing this file into Tcl runs the tests and
+# generates output for errors. No output means no errors were found.
+#
+# Copyright (c) 1991-1994 The Regents of the University of California.
+# Copyright (c) 1994-1998 Sun Microsystems, Inc.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+# RCS: @(#) $Id: format.test,v 1.8 2000/04/10 17:18:59 ericm Exp $
+
+source testing.tcl
+
+# The following code is needed because some versions of SCO Unix have
+# a round-off error in sprintf which would cause some of the tests to
+# fail. Someday I hope this code shouldn't be necessary (code added
+# 9/9/91).
+
+set roundOffBug 0
+if {"[format %7.1e 68.514]" == "6.8e+01"} {
+ puts stdout "Note: this system has a sprintf round-off bug, some tests skipped\n"
+ set roundOffBug 1
+}
+
+test format-1.1 {integer formatting} {
+ format "%*d %d %d %d" 6 34 16923 -12 -1
+} { 34 16923 -12 -1}
+test format-1.2 {integer formatting} {
+ format "%4d %4d %4d %4d %d %#x %#X" 6 34 16923 -12 -1 14 12
+} { 6 34 16923 -12 -1 0xe 0XC}
+
+# %u output depends on word length, so this test is not portable.
+
+test format-1.3 {integer formatting} {
+ format "%4u %4u %4u %4u %d %#o" 6 34 16923 -12 -1 0
+} { 6 34 16923 18446744073709551604 -1 0}
+test format-1.4 {integer formatting} {
+ format "%-4d %-4i %-4d %-4ld" 6 34 16923 -12 -1
+} {6 34 16923 -12 }
+test format-1.5 {integer formatting} {
+ format "%04d %04d %04d %04i" 6 34 16923 -12 -1
+} {0006 0034 16923 -012}
+test format-1.6 {integer formatting} {
+ format "%00*d" 6 34
+} {000034}
+
+# Printing negative numbers in hex or octal format depends on word
+# length, so these tests are not portable.
+
+test format-1.7 {integer formatting} {
+ format "%4x %4x %4x %4x" 6 34 16923 -12 -1
+} { 6 22 421b fffffffffffffff4}
+test format-1.8 {integer formatting} {
+ format "%#x %#X %#X %#x" 6 34 16923 -12 -1
+} {0x6 0X22 0X421B 0xfffffffffffffff4}
+test format-1.9 {integer formatting} {
+ format "%#20x %#20x %#20x %#20x" 6 34 16923 -12 -1
+} { 0x6 0x22 0x421b 0xfffffffffffffff4}
+test format-1.10 {integer formatting} {
+ format "%-#20x %-#20x %-#20x %-#20x" 6 34 16923 -12 -1
+} {0x6 0x22 0x421b 0xfffffffffffffff4 }
+test format-1.11 {integer formatting} {
+ format "%-#20o %#-20o %#-20o %#-20o" 6 34 16923 -12 -1
+} {06 042 041033 01777777777777777777764}
+
+test format-2.1 {string formatting} {
+ format "%s %s %c %s" abcd {This is a very long test string.} 120 x
+} {abcd This is a very long test string. x x}
+test format-2.2 {string formatting} {
+ format "%20s %20s %20c %20s" abcd {This is a very long test string.} 120 x
+} { abcd This is a very long test string. x x}
+test format-2.3 {string formatting} {
+ format "%.10s %.10s %c %.10s" abcd {This is a very long test string.} 120 x
+} {abcd This is a x x}
+test format-2.4 {string formatting} {
+ format "%s %s %% %c %s" abcd {This is a very long test string.} 120 x
+} {abcd This is a very long test string. % x x}
+test format-2.5 {string formatting, embedded nulls} {
+ format "%10s" abc\0def
+} " abc\0def"
+ifutf8 {
+ test format-2.6 {string formatting, international chars} {
+ format "%10s" abc\ufeffdef
+ } " abc\ufeffdef"
+ test format-2.6 {string formatting, international chars} {
+ format "%.5s" abc\ufeffdef
+ } "abc\ufeffd"
+}
+test format-2.7 {string formatting, international chars} {
+ format "foo\ufeffbar%s" baz
+} "foo\ufeffbarbaz"
+test format-2.8 {string formatting, width} {
+ format "a%5sa" f
+} "a fa"
+test format-2.8 {string formatting, width} {
+ format "a%-5sa" f
+} "af a"
+test format-2.8 {string formatting, width} {
+ format "a%2sa" foo
+} "afooa"
+test format-2.8 {string formatting, width} {
+ format "a%0sa" foo
+} "afooa"
+test format-2.8 {string formatting, precision} {
+ format "a%.2sa" foobarbaz
+} "afoa"
+test format-2.8 {string formatting, precision} {
+ format "a%.sa" foobarbaz
+} "aa"
+test format-2.8 {string formatting, precision} {
+ list [catch {format "a%.-2sa" foobarbaz} msg] $msg
+} {1 {bad field specifier "-"}}
+test format-2.8 {string formatting, width and precision} {
+ format "a%5.2sa" foobarbaz
+} "a foa"
+test format-2.8 {string formatting, width and precision} {
+ format "a%5.7sa" foobarbaz
+} "afoobarba"
+
+ifutf8 {
+ test format-3.1 {Tcl_FormatObjCmd: character formatting} {
+ format "|%c|%0c|%-1c|%1c|%-6c|%6c|%*c|%*c|" 65 65 65 65 65 65 3 65 -4 65
+ } "|A|A|A|A|A | A| A|A |"
+ test format-3.2 {Tcl_FormatObjCmd: international character formatting} {
+ format "|%c|%0c|%-1c|%1c|%-6c|%6c|%*c|%*c|" 0xa2 0x4e4e 0x25a 0xc3 0xff08 0 3 0x6575 -4 0x4e4f
+ } "|\ua2|\u4e4e|\u25a|\uc3|\uff08 | \0| \u6575|\u4e4f |"
+}
+
+test format-4.1 {e and f formats} {
+ format "%e %e %e %e" 34.2e12 68.514 -.125 -16000. .000053
+} {3.420000e+13 6.851400e+01 -1.250000e-01 -1.600000e+04}
+test format-4.2 {e and f formats} {
+ format "%20e %20e %20e %20e" 34.2e12 68.514 -.125 -16000. .000053
+} { 3.420000e+13 6.851400e+01 -1.250000e-01 -1.600000e+04}
+if {!$roundOffBug} {
+ test format-4.3 {e and f formats} {
+ format "%.1e %.1e %.1e %.1e" 34.2e12 68.514 -.126 -16000. .000053
+ } {3.4e+13 6.9e+01 -1.3e-01 -1.6e+04}
+ test format-4.4 {e and f formats} {
+ format "%020e %020e %020e %020e" 34.2e12 68.514 -.126 -16000. .000053
+ } {000000003.420000e+13 000000006.851400e+01 -00000001.260000e-01 -00000001.600000e+04}
+ test format-4.5 {e and f formats} {
+ format "%7.1e %7.1e %7.1e %7.1e" 34.2e12 68.514 -.126 -16000. .000053
+ } {3.4e+13 6.9e+01 -1.3e-01 -1.6e+04}
+ test format-4.6 {e and f formats} {
+ format "%f %f %f %f" 34.2e12 68.514 -.125 -16000. .000053
+ } {34200000000000.000000 68.514000 -0.125000 -16000.000000}
+}
+test format-4.7 {e and f formats} {
+ format "%.4f %.4f %.4f %.4f %.4f" 34.2e12 68.514 -.125 -16000. .000053
+} {34200000000000.0000 68.5140 -0.1250 -16000.0000 0.0001}
+test format-4.8 {e and f formats} {
+ format "%.4e %.5e %.6e" -9.99996 -9.99996 9.99996
+} {-1.0000e+01 -9.99996e+00 9.999960e+00}
+test format-4.9 {e and f formats} {
+ format "%.4f %.5f %.6f" -9.99996 -9.99996 9.99996
+} {-10.0000 -9.99996 9.999960}
+test format-4.10 {e and f formats} {
+ format "%20f %-20f %020f" -9.99996 -9.99996 9.99996
+} { -9.999960 -9.999960 0000000000009.999960}
+test format-4.11 {e and f formats} {
+ format "%-020f %020f" -9.99996 -9.99996 9.99996
+} {-9.999960 -000000000009.999960}
+test format-4.12 {e and f formats} {
+ format "%.0e %#.0e" -9.99996 -9.99996 9.99996
+} {-1e+01 -1.e+01}
+test format-4.13 {e and f formats} {
+ format "%.0f %#.0f" -9.99996 -9.99996 9.99996
+} {-10 -10.}
+test format-4.14 {e and f formats} {
+ format "%.4f %.5f %.6f" -9.99996 -9.99996 9.99996
+} {-10.0000 -9.99996 9.999960}
+test format-4.15 {e and f formats} {
+ format "%3.0f %3.0f %3.0f %3.0f" 1.0 1.1 1.01 1.001
+} { 1 1 1 1}
+test format-4.16 {e and f formats} {
+ format "%3.1f %3.1f %3.1f %3.1f" 0.0 0.1 0.01 0.001
+} {0.0 0.1 0.0 0.0}
+
+test format-5.1 {g-format} {
+ format "%.3g" 12341.0
+} {1.23e+04}
+test format-5.2 {g-format} {
+ format "%.3G" 1234.12345
+} {1.23E+03}
+test format-5.3 {g-format} {
+ format "%.3g" 123.412345
+} {123}
+test format-5.4 {g-format} {
+ format "%.3g" 12.3412345
+} {12.3}
+test format-5.5 {g-format} {
+ format "%.3g" 1.23412345
+} {1.23}
+test format-5.6 {g-format} {
+ format "%.3g" 1.23412345
+} {1.23}
+test format-5.7 {g-format} {
+ format "%.3g" .123412345
+} {0.123}
+test format-5.8 {g-format} {
+ format "%.3g" .012341
+} {0.0123}
+test format-5.9 {g-format} {
+ format "%.3g" .0012341
+} {0.00123}
+test format-5.10 {g-format} {
+ format "%.3g" .00012341
+} {0.000123}
+test format-5.11 {g-format} {
+ format "%.3g" .00001234
+} {1.23e-05}
+test format-5.12 {g-format} {
+ format "%.4g" 9999.6
+} {1e+04}
+test format-5.13 {g-format} {
+ format "%.4g" 999.96
+} {1000}
+test format-5.14 {g-format} {
+ format "%.3g" 1.0
+} {1}
+test format-5.15 {g-format} {
+ format "%.3g" .1
+} {0.1}
+test format-5.16 {g-format} {
+ format "%.3g" .01
+} {0.01}
+test format-5.17 {g-format} {
+ format "%.3g" .001
+} {0.001}
+test format-5.18 {g-format} {
+ format "%.3g" .00001
+} {1e-05}
+test format-5.19 {g-format} {
+ format "%#.3g" 1234.0
+} {1.23e+03}
+test format-5.20 {g-format} {
+ format "%#.3G" 9999.5
+} {1.00E+04}
+
+test format-6.1 {floating-point zeroes} {
+ format "%e %f %g" 0.0 0.0 0.0 0.0
+} {0.000000e+00 0.000000 0}
+test format-6.2 {floating-point zeroes} {
+ format "%.4e %.4f %.4g" 0.0 0.0 0.0 0.0
+} {0.0000e+00 0.0000 0}
+test format-6.3 {floating-point zeroes} {
+ format "%#.4e %#.4f %#.4g" 0.0 0.0 0.0 0.0
+} {0.0000e+00 0.0000 0.000}
+test format-6.4 {floating-point zeroes} {
+ format "%.0e %.0f %.0g" 0.0 0.0 0.0 0.0
+} {0e+00 0 0}
+test format-6.5 {floating-point zeroes} {
+ format "%#.0e %#.0f %#.0g" 0.0 0.0 0.0 0.0
+} {0.e+00 0. 0.}
+test format-6.6 {floating-point zeroes} {
+ format "%3.0f %3.0f %3.0f %3.0f" 0.0 0.0 0.0 0.0
+} { 0 0 0 0}
+test format-6.7 {floating-point zeroes} {
+ format "%3.0f %3.0f %3.0f %3.0f" 1.0 1.1 1.01 1.001
+} { 1 1 1 1}
+test format-6.8 {floating-point zeroes} {
+ format "%3.1f %3.1f %3.1f %3.1f" 0.0 0.1 0.01 0.001
+} {0.0 0.1 0.0 0.0}
+
+test format-7.1 {various syntax features} {
+ format "%*.*f" 12 3 12.345678901
+} { 12.346}
+test format-7.2 {various syntax features} {
+ format "%0*.*f" 12 3 12.345678901
+} {00000012.346}
+test format-7.3 {various syntax features} {
+ format "\*\t\\n"
+} {* \n}
+
+test format-8.1 {error conditions} {
+ catch format
+} 1
+test format-8.2 {error conditions} {
+ catch format msg
+ set msg
+} {wrong # args: should be "format formatString ?arg arg ...?"}
+test format-8.3 {error conditions} {
+ catch {format %*d}
+} 1
+test format-8.4 {error conditions} {
+ catch {format %*d} msg
+ set msg
+} {not enough arguments for all format specifiers}
+test format-8.5 {error conditions} {
+ catch {format %*.*f 12}
+} 1
+test format-8.6 {error conditions} {
+ catch {format %*.*f 12} msg
+ set msg
+} {not enough arguments for all format specifiers}
+test format-8.7 {error conditions} {
+ catch {format %*.*f 12 3}
+} 1
+test format-8.8 {error conditions} {
+ catch {format %*.*f 12 3} msg
+ set msg
+} {not enough arguments for all format specifiers}
+test format-8.9 {error conditions} {
+ list [catch {format %*d x 3} msg] $msg
+} {1 {expected integer but got "x"}}
+test format-8.10 {error conditions} {
+ list [catch {format %*.*f 2 xyz 3} msg] $msg
+} {1 {expected integer but got "xyz"}}
+test format-8.11 {error conditions} {
+ catch {format %d 2a}
+} 1
+test format-8.12 {error conditions} {
+ catch {format %d 2a} msg
+ set msg
+} {expected integer but got "2a"}
+test format-8.13 {error conditions} {
+ catch {format %c 2x}
+} 1
+test format-8.14 {error conditions} {
+ catch {format %c 2x} msg
+ set msg
+} {expected integer but got "2x"}
+test format-8.15 {error conditions} {
+ catch {format %f 2.1z}
+} 1
+test format-8.16 {error conditions} {
+ catch {format %f 2.1z} msg
+ set msg
+} {expected number but got "2.1z"}
+test format-8.17 {error conditions} {
+ catch {format ab%}
+} 1
+test format-8.18 {error conditions} {
+ catch {format ab% 12} msg
+ set msg
+} {format string ended in middle of field specifier}
+test format-8.19 {error conditions} {
+ catch {format %q x}
+} 1
+test format-8.20 {error conditions} {
+ catch {format %q x} msg
+ set msg
+} {bad field specifier "q"}
+test format-8.21 {error conditions} {
+ catch {format %d}
+} 1
+test format-8.22 {error conditions} {
+ catch {format %d} msg
+ set msg
+} {not enough arguments for all format specifiers}
+test format-8.23 {error conditions} {
+ catch {format "%d %d" 24 xyz} msg
+ set msg
+} {expected integer but got "xyz"}
+
+test format-9.1 {long result} {
+ set a {1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 1 2 3 4 5 6 7 8 9 0 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}
+ format {1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG %s %s} $a $a
+} {1111 2222 3333 4444 5555 6666 7777 8888 9999 aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG 1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 1 2 3 4 5 6 7 8 9 0 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ 1 2 3 4 5 6 7 8 9 0 a b c d e f g h i j k l m n o p q r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X Y Z}
+
+test format-10.1 {"h" format specifier} {
+ format %hd 0xffff
+} -1
+test format-10.2 {"h" format specifier} {
+ format %hx 0x10fff
+} fff
+test format-10.3 {"h" format specifier} {
+ format %hd 0x10000
+} 0
+
+test format-11.1 {XPG3 %$n specifiers} {
+ format {%2$d %1$d} 4 5
+} {5 4}
+test format-11.2 {XPG3 %$n specifiers} {
+ format {%2$d %1$d %1$d %3$d} 4 5 6
+} {5 4 4 6}
+test format-11.3 {XPG3 %$n specifiers} {
+ list [catch {format {%2$d %3$d} 4 5} msg] $msg
+} {1 {"%n$" argument index out of range}}
+test format-11.4 {XPG3 %$n specifiers} {
+ list [catch {format {%2$d %0$d} 4 5 6} msg] $msg
+} {1 {"%n$" argument index out of range}}
+test format-11.5 {XPG3 %$n specifiers} {
+ list [catch {format {%d %1$d} 4 5 6} msg] $msg
+} {1 {cannot mix "%" and "%n$" conversion specifiers}}
+test format-11.6 {XPG3 %$n specifiers} {
+ list [catch {format {%2$d %d} 4 5 6} msg] $msg
+} {1 {cannot mix "%" and "%n$" conversion specifiers}}
+test format-11.7 {XPG3 %$n specifiers} {
+ list [catch {format {%2$d %3d} 4 5 6} msg] $msg
+} {1 {cannot mix "%" and "%n$" conversion specifiers}}
+test format-11.8 {XPG3 %$n specifiers} {
+ format {%2$*d %3$d} 1 10 4
+} { 4 4}
+test format-11.9 {XPG3 %$n specifiers} {
+ format {%2$.*s %4$d} 1 5 abcdefghijklmnop 44
+} {abcde 44}
+test format-11.10 {XPG3 %$n specifiers} {
+ list [catch {format {%2$*d} 4} msg] $msg
+} {1 {"%n$" argument index out of range}}
+test format-11.11 {XPG3 %$n specifiers} {
+ list [catch {format {%2$*d} 4 5} msg] $msg
+} {1 {"%n$" argument index out of range}}
+test format-11.12 {XPG3 %$n specifiers} {
+ list [catch {format {%2$*d} 4 5 6} msg] $msg
+} {0 { 6}}
+
+test format-12.1 {negative width specifiers} {
+ format "%*d" -47 25
+} {25 }
+test format-13.1 {tcl_precision fuzzy comparison} {
+ catch {unset a}
+ catch {unset b}
+ catch {unset c}
+ catch {unset d}
+ set a 0.0000000000001
+ set b 0.00000000000001
+ set c 0.00000000000000001
+ set d [expr $a + $b + $c]
+ format {%0.10f %0.12f %0.15f %0.17f} $d $d $d $d
+} {0.0000000000 0.000000000000 0.000000000000110 0.00000000000011001}
+test format-13.2 {tcl_precision fuzzy comparison} {
+ catch {unset a}
+ catch {unset b}
+ catch {unset c}
+ catch {unset d}
+ set a 0.000000000001
+ set b 0.000000000000005
+ set c 0.0000000000000008
+ set d [expr $a + $b + $c]
+ format {%0.10f %0.12f %0.15f %0.17f} $d $d $d $d
+} {0.0000000000 0.000000000001 0.000000000001006 0.00000000000100580}
+test format-13.3 {tcl_precision fuzzy comparison} {
+ catch {unset a}
+ catch {unset b}
+ catch {unset c}
+ set a 0.00000000000099
+ set b 0.000000000000011
+ set c [expr $a + $b]
+ format {%0.10f %0.12f %0.15f %0.17f} $c $c $c $c
+} {0.0000000000 0.000000000001 0.000000000001001 0.00000000000100100}
+test format-13.4 {tcl_precision fuzzy comparison} {
+ catch {unset a}
+ catch {unset b}
+ catch {unset c}
+ set a 0.444444444444
+ set b 0.33333333333333
+ set c [expr $a + $b]
+ format {%0.10f %0.12f %0.15f %0.16f} $c $c $c $c
+} {0.7777777778 0.777777777777 0.777777777777330 0.7777777777773300}
+test format-13.5 {tcl_precision fuzzy comparison} {
+ catch {unset a}
+ catch {unset b}
+ catch {unset c}
+ set a 0.444444444444
+ set b 0.99999999999999
+ set c [expr $a + $b]
+ format {%0.10f %0.12f %0.15f} $c $c $c
+} {1.4444444444 1.444444444444 1.444444444443990}
+test format-14.1 {testing MAX_FLOAT_SIZE for 0 and 1} {
+ format {%s} ""
+} {}
+test format-14.2 {testing MAX_FLOAT_SIZE for 0 and 1} {
+ format {%s} "a"
+} {a}
+
+test format-15.1 {testing %0..s 0 padding for chars/strings} {
+ format %05s a
+} {0000a}
+test format-15.2 {testing %0..s 0 padding for chars/strings} {
+ format "% 5s" a
+} { a}
+test format-15.3 {testing %0..s 0 padding for chars/strings} {
+ format %5s a
+} { a}
+test format-15.4 {testing %0..s 0 padding for chars/strings} {
+ format %05c 61
+} {0000=}
+
+set a "0123456789"
+set b ""
+for {set i 0} {$i < 290} {incr i} {
+ append b $a
+}
+for {set i 290} {$i < 400} {incr i} {
+ test format-15.[expr $i -290] {testing MAX_FLOAT_SIZE} {
+ format {%s} $b
+ } $b
+ append b "x"
+}
+
+# cleanup
+catch {unset a}
+catch {unset b}
+catch {unset c}
+catch {unset d}
+
+testreport
diff --git a/tests/jim.test b/tests/jim.test
index b414c25..1fcead3 100644
--- a/tests/jim.test
+++ b/tests/jim.test
@@ -2279,11 +2279,11 @@ 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
+ string map [list \u00fc ue UE \u00dc] "a\u00fcueUE\000EU"
+} aueue\u00dc\0EU
test string-10.13 {string map, -nocase unicode} {
- string map -nocase [list \374 ue UE \334] "a\374ueUE\000EU"
-} aue\334\334\0EU
+ string map -nocase [list \u00fc ue UE \u00dc] "a\u00fcueUE\000EU"
+} aue\u00dc\u00dc\0EU
test string-10.14 {string map, -nocase null arguments} {
string map -nocase {{} abc} foo
} foo
@@ -2352,9 +2352,9 @@ test split-1.10 {basic split commands} {
test split-1.11 {basic split commands} {
split "12,3,45" {,}
} {12 3 45}
-#test split-1.12 {basic split commands} {
-# split "\u0001ab\u0001cd\u0001\u0001ef\u0001" \1
-#} {{} ab cd {} ef {}}
+test split-1.12 {basic split commands} {
+ split "\u0001ab\u0001cd\u0001\u0001ef\u0001" \1
+} {{} ab cd {} ef {}}
test split-1.13 {basic split commands} {
split "12,34,56," {,}
} {12 34 56 {}}
diff --git a/tests/lsort.test b/tests/lsort.test
index e03a834..fb04644 100644
--- a/tests/lsort.test
+++ b/tests/lsort.test
@@ -170,8 +170,9 @@ test lsort-3.19 {SortCompare procedure, -decreasing option} {
lsort -decreasing -integer {35 21 0x20 30 023 100 8}
} {100 35 0x20 30 21 023 8}
+ifutf8 {
test lsort-4.26 {DefaultCompare procedure, signed characters} {
- set l [lsort [list "abc\200" "abc"]]
+ set l [lsort [list "abc\u80" "abc"]]
set viewlist {}
foreach s $l {
set viewelem ""
@@ -189,5 +190,6 @@ test lsort-4.26 {DefaultCompare procedure, signed characters} {
}
set viewlist
} [list "abc" "abc\\200"]
+}
testreport
diff --git a/tests/misc.test b/tests/misc.test
index 21e79f3..bca04ee 100644
--- a/tests/misc.test
+++ b/tests/misc.test
@@ -329,5 +329,8 @@ test return-1.3 "return can rethrow no error" {
list $rc $msg [info exists opts(-errorinfo)]
} {0 {from a} 0}
+test stringreverse-1.1 "Containing nulls" {
+ string reverse abc\0def
+} "fed\0cba"
testreport
diff --git a/tests/scan.test b/tests/scan.test
index 159f3e8..63e9751 100644
--- a/tests/scan.test
+++ b/tests/scan.test
@@ -467,18 +467,20 @@ test scan-7.5 {string and character scanning} {
set a {}; set b {}; set c {}
list [scan "aaaaaabc aaabcdefg + + XYZQR" {%*4[a] %s %*4[a]%s%*4[ +]%c} a b c] $a $b $c
} {3 aabc bcdefg 43}
-
-# Unicode tests
-
-
-
-
-
-
-
-
-
-
+ifutf8 {
+ test scan-7.6 {string and character scanning, unicode} {
+ set a {}; set b {}; set c {}; set d {}
+ list [scan "abc d\u00c7fghijk dum " "%s %3s %20s %s" a b c d] $a $b $c $d
+ } "4 abc d\u00c7f ghijk dum"
+ test scan-7.7 {string and character scanning, unicode} {
+ set a {}; set b {}
+ list [scan "ab\u00c7cdef" "ab%c%c" a b] $a $b
+ } "2 199 99"
+ test scan-7.8 {string and character scanning, unicode} {
+ set a {}; set b {}
+ list [scan "ab\ufeffdef" "%\[ab\ufeff\]" a] $a
+ } "1 ab\ufeff"
+}
test scan-8.1 {error conditions} {
catch {scan a}
diff --git a/tests/string.test b/tests/string.test
index 782d7bf..220b70e 100644
--- a/tests/string.test
+++ b/tests/string.test
@@ -404,11 +404,13 @@ test string-7.14 {string last, start index} {
string last ba badbad end-2
} 0
test string-7.15 {string last, start index} {
- string last \334a \334ad\334ad 0
+ string last \u00dca \u00dcad\u00dcad 0
} -1
-test string-7.16 {string last, start index} {
- string last \334a \334ad\334ad end-1
-} 3
+ifutf8 {
+ test string-7.16 {string last, start index} {
+ string last \u00dca \u00dcad\u00dcad end-1
+ } 3
+}
test string-9.1 {string length} {
list [catch {string length} msg]
@@ -457,11 +459,11 @@ 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
+ string map [list \u00fc ue UE \u00dc] "a\u00fcueUE\000EU"
+} aueue\u00dc\0EU
test string-10.13 {string map, -nocase unicode} {
- string map -nocase [list \374 ue UE \334] "a\374ueUE\000EU"
-} aue\334\334\0EU
+ string map -nocase [list \u00fc ue UE \u00dc] "a\u00fcueUE\000EU"
+} aue\u00dc\u00dc\0EU
test string-10.14 {string map, -nocase null arguments} {
string map -nocase {{} abc} foo
} foo
diff --git a/tests/stringmatch.test b/tests/stringmatch.test
new file mode 100644
index 0000000..b964ed4
--- /dev/null
+++ b/tests/stringmatch.test
@@ -0,0 +1,228 @@
+# This file is a Tcl script to test the code in the file tclUtil.c.
+# This file is organized in the standard fashion for Tcl tests.
+#
+# Copyright (c) 1995-1998 Sun Microsystems, Inc.
+# Copyright (c) 1998-1999 by Scriptics Corporation.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+# RCS: @(#) $Id: util.test,v 1.7.2.1 2001/07/16 23:14:13 hobbs Exp $
+
+source testing.tcl
+
+test stringmatch-5.1 {Tcl_StringMatch} {
+ string match ab*c abc
+} 1
+test stringmatch-5.2 {Tcl_StringMatch} {
+ string match ab**c abc
+} 1
+test stringmatch-5.3 {Tcl_StringMatch} {
+ string match ab* abcdef
+} 1
+test stringmatch-5.4 {Tcl_StringMatch} {
+ string match *c abc
+} 1
+test stringmatch-5.5 {Tcl_StringMatch} {
+ string match *3*6*9 0123456789
+} 1
+test stringmatch-5.6 {Tcl_StringMatch} {
+ string match *3*6*9 01234567890
+} 0
+test stringmatch-5.7 {Tcl_StringMatch: UTF-8} {
+ string match *u \u4e4fu
+} 1
+test stringmatch-5.8 {Tcl_StringMatch} {
+ string match a?c abc
+} 1
+ifutf8 {
+ test stringmatch-5.9 {Tcl_StringMatch: UTF-8} {
+ # skip one character in string
+
+ string match a?c a\u4e4fc
+ } 1
+}
+test stringmatch-5.10 {Tcl_StringMatch} {
+ string match a??c abc
+} 0
+test stringmatch-5.11 {Tcl_StringMatch} {
+ string match ?1??4???8? 0123456789
+} 1
+test stringmatch-5.12 {Tcl_StringMatch} {
+ string match {[abc]bc} abc
+} 1
+ifutf8 {
+ test stringmatch-5.13 {Tcl_StringMatch: UTF-8} {
+ # string += Tcl_UtfToUniChar(string, &ch);
+
+ string match "\[\u4e4fxy\]bc" "\u4e4fbc"
+ } 1
+}
+test stringmatch-5.14 {Tcl_StringMatch} {
+ # if ((*pattern == ']') || (*pattern == '\0'))
+ # badly formed pattern
+
+ string match {[]} {[]}
+} 0
+test stringmatch-5.15 {Tcl_StringMatch} {
+ # if ((*pattern == ']') || (*pattern == '\0'))
+ # badly formed pattern
+
+ string match {[} {[}
+} 0
+test stringmatch-5.16 {Tcl_StringMatch} {
+ string match {a[abc]c} abc
+} 1
+ifutf8 {
+ test stringmatch-5.17 {Tcl_StringMatch: UTF-8} {
+ # pattern += Tcl_UtfToUniChar(pattern, &endChar);
+ # get 1 UTF-8 character
+
+ string match "a\[a\u4e4fc]c" "a\u4e4fc"
+ } 1
+}
+test stringmatch-5.18 {Tcl_StringMatch: UTF-8} {
+ # pattern += Tcl_UtfToUniChar(pattern, &endChar);
+ # proper advance: wrong answer would match on UTF trail byte of \u4e4f
+
+ string match {a[a\u4e4fc]c} a\u008fc
+} 0
+test stringmatch-5.19 {Tcl_StringMatch: UTF-8} {
+ # pattern += Tcl_UtfToUniChar(pattern, &endChar);
+ # proper advance.
+
+ string match {a[a\u4e4fc]c} "acc"
+} 1
+test stringmatch-5.20 {Tcl_StringMatch} {
+ string match {a[xyz]c} abc
+} 0
+test stringmatch-5.21 {Tcl_StringMatch} {
+ string match {12[2-7]45} 12345
+} 1
+test stringmatch-5.22 {Tcl_StringMatch: UTF-8 range} {
+ string match "\[\u4e00-\u4e4f]" "0"
+} 0
+ifutf8 {
+ test stringmatch-5.23 {Tcl_StringMatch: UTF-8 range} {
+ string match "\[\u4e00-\u4e4f]" "\u4e33"
+ } 1
+ test stringmatch-5.24 {Tcl_StringMatch: UTF-8 range} {
+ string match "\[\u4e00-\u4e4f]" "\uff08"
+ } 0
+}
+test stringmatch-5.25 {Tcl_StringMatch} {
+ string match {12[ab2-4cd]45} 12345
+} 1
+test stringmatch-5.26 {Tcl_StringMatch} {
+ string match {12[ab2-4cd]45} 12b45
+} 1
+test stringmatch-5.27 {Tcl_StringMatch} {
+ string match {12[ab2-4cd]45} 12d45
+} 1
+test stringmatch-5.28 {Tcl_StringMatch} {
+ string match {12[ab2-4cd]45} 12145
+} 0
+test stringmatch-5.29 {Tcl_StringMatch} {
+ string match {12[ab2-4cd]45} 12545
+} 0
+test stringmatch-5.30 {Tcl_StringMatch: forwards range} {
+ string match {[k-w]} "z"
+} 0
+test stringmatch-5.31 {Tcl_StringMatch: forwards range} {
+ string match {[k-w]} "w"
+} 1
+test stringmatch-5.32 {Tcl_StringMatch: forwards range} {
+ string match {[k-w]} "r"
+} 1
+test stringmatch-5.33 {Tcl_StringMatch: forwards range} {
+ string match {[k-w]} "k"
+} 1
+test stringmatch-5.34 {Tcl_StringMatch: forwards range} {
+ string match {[k-w]} "a"
+} 0
+test stringmatch-5.35 {Tcl_StringMatch: reverse range} {
+ string match {[w-k]} "z"
+} 0
+test stringmatch-5.36 {Tcl_StringMatch: reverse range} {
+ string match {[w-k]} "w"
+} 1
+test stringmatch-5.37 {Tcl_StringMatch: reverse range} {
+ string match {[w-k]} "r"
+} 1
+test stringmatch-5.38 {Tcl_StringMatch: reverse range} {
+ string match {[w-k]} "k"
+} 1
+test stringmatch-5.39 {Tcl_StringMatch: reverse range} {
+ string match {[w-k]} "a"
+} 0
+test stringmatch-5.40 {Tcl_StringMatch: skip correct number of ']'} {
+ string match {[A-]x} Ax
+} 0
+test stringmatch-5.41 {Tcl_StringMatch: skip correct number of ']'} {
+ string match {[A-]]x} Ax
+} 1
+test stringmatch-5.42 {Tcl_StringMatch: skip correct number of ']'} {
+ string match {[A-]]x} \ue1x
+} 0
+ifutf8 {
+ test stringmatch-5.43 {Tcl_StringMatch: skip correct number of ']'} {
+ string match \[A-]\ue1]x \ue1x
+ } 1
+}
+test stringmatch-5.44 {Tcl_StringMatch: skip correct number of ']'} {
+ string match {[A-]h]x} hx
+} 1
+test stringmatch-5.45 {Tcl_StringMatch} {
+ # if (*pattern == '\0')
+ # badly formed pattern, still treats as a set
+
+ string match {[a} a
+} 1
+test stringmatch-5.46 {Tcl_StringMatch} {
+ string match {a\*b} a*b
+} 1
+test stringmatch-5.47 {Tcl_StringMatch} {
+ string match {a\*b} ab
+} 0
+test stringmatch-5.48 {Tcl_StringMatch} {
+ string match {a\*\?\[\]\\\x} "a*?\[\]\\x"
+} 1
+test stringmatch-5.49 {Tcl_StringMatch} {
+ string match ** ""
+} 1
+test stringmatch-5.50 {Tcl_StringMatch} {
+ string match *. ""
+} 0
+test stringmatch-5.51 {Tcl_StringMatch} {
+ string match "" ""
+} 1
+
+# 'string match' doesn't support ^, which is different
+# from 'scan'
+
+test stringmatch-6.1 {bracket in charset} {
+ string match {a[]b]c} {a]c}
+} 0
+
+test stringmatch-6.2 {bracket in charset} {
+ string match {a[]b]c} {abc}
+} 0
+
+test stringmatch-6.3 {charset with ^} {
+ string match {a[^]b]c} {axc}
+} 0
+
+test stringmatch-6.4 {charset with ^} {
+ string match {a[^]b]c} {a]c}
+} 0
+
+test stringmatch-6.5 {charset with ^} {
+ string match {a[^bc]d} {axd}
+} 0
+
+test stringmatch-6.6 {charset with ^} {
+ string match {a[\]]c} {a]c}
+} 0
+
+
+testreport
diff --git a/tests/testing.tcl b/tests/testing.tcl
index 1fde188..33e3a7e 100644
--- a/tests/testing.tcl
+++ b/tests/testing.tcl
@@ -29,6 +29,14 @@ proc package-or-skip {name} {
}
}
+set test(utf8) 0
+if {[string length "\xc2\xb5"] == 1} {
+ set test(utf8) 1
+}
+proc bytestring {x} {
+ return $x
+}
+
catch {
# Tcl-only things
info tclversion
@@ -39,6 +47,16 @@ catch {
}
proc script_source {script} {
}
+ set test(utf8) 1
+ rename bytestring ""
+ package require tcltest
+ interp alias {} bytestring {} ::tcltest::bytestring
+}
+
+proc ifutf8 {code} {
+ if {$::test(utf8)} {
+ uplevel 1 $code
+ }
}
proc section {name} {
diff --git a/tests/utf8.test b/tests/utf8.test
new file mode 100644
index 0000000..ba39128
--- /dev/null
+++ b/tests/utf8.test
@@ -0,0 +1,336 @@
+source testing.tcl
+
+ifutf8 {
+
+section "string tests"
+
+test utf8-1.1 "Pattern matching - ?" {
+ string match "abc?def" "abc\u00b5def"
+} 1
+
+test utf8-1.2 "Pattern matching - ?" {
+ string match "abc?def" "abc\u2704def"
+} 1
+
+test utf8-1.3 "Pattern utf-8 literal" {
+ string match "ab\u00b5\u2704?" "ab\u00b5\u2704x"
+} 1
+
+test utf8-1.4 "Pattern utf-8 char sets" {
+ string match "a\[b\u00b5\]\u2704?" "a\u00b5\u2704x"
+} 1
+
+test utf8-1.5 "Pattern utf-8 char sets" {
+ string match "a\[b\u00b5\]\u2704?" "a\u00b6\u2704x"
+} 0
+test utf8-1.6 "Pattern utf-8 char sets" {
+ string match "a\[b\u00b5\]\u2704?" "ab\u2704x"
+} 1
+test utf8-1.7 "Pattern utf-8 char sets" {
+ string match "a\[b\u00b5\]?" "a\u2704x"
+} 0
+test utf8-1.8 "Pattern utf-8 char sets" {
+ string match "a\[\u00b5-\u00c3\]" "a\ubd"
+} 1
+test utf8-1.9 "Pattern utf-8 char sets" {
+ string match "a\[\u00b5-\u00c3\]" "a\uc4"
+} 0
+
+test utf8-2.1 "Pattern utf-8 nocase" {
+ string match -nocase "a\u1edc\u1ef4*" "A\u1edd\u1ef5XX"
+} 1
+
+test utf8-2.2 "Pattern utf-8 case difference" {
+ string match "a\u1edc\u1ef4*" "A\u1edd\u1ef5XX"
+} 0
+
+test utf8-3.1 "lsearch -glob" {
+ lsearch -glob {1 d a\u00b5xyb c} a\ub5*b
+} 2
+
+test utf8-3.2 "switch -glob" {
+ switch -glob -- a\ub5xyb a\ub5*b { set x 1 } default { set x 0 }
+ set x
+} 1
+
+set x "\ub5test"
+test utf8-3.3 "info procs" {
+ proc $x {} { info procs \[\ub5X]???? }
+ $x
+} $x
+
+test utf8-3.3 "info commands" {
+ info commands \[\ub5X]????
+} $x
+
+test utf8-3.4 "proc name with invalid utf-8" {
+ catch { proc ab\xc2 {} {} } msg
+} 0
+
+test utf8-3.5 "rename to invalid name" {
+ catch { rename ab\xc2 ab\xc3 } msg
+} 0
+
+catch {rename ab\xc3 ""}
+
+test utf8-4.1 "split with utf-8" {
+ split "zy\u2702xw" x
+} "zy\u2702 w"
+
+test utf8-4.2 "split with utf-8" {
+ split "zy\u2702xw" \u2702
+} "zy xw"
+
+test utf8-4.2 "split with utf-8" {
+ split "zy\u2702xw" {}
+} "z y \u2702 x w"
+
+test utf8-5.1 "string first with utf-8" {
+ string first w "zy\u2702xw"
+} 4
+
+test utf8-5.2 "string first with utf-8" {
+ string first \u2702 "\ub5zy\u2702xw"
+} 3
+
+test utf8-5.3 "string first with utf-8" {
+ string first \u2704 "\ub5zy\u2702xw"
+} -1
+
+test utf8-5.4 "string first with utf-8" {
+ string first \u2702 "\ub5zy\u2702xw\u2702BB"
+} 3
+
+test utf8-6.1 "string last with utf-8" {
+ string last w "zy\u2702xw"
+} 4
+
+test utf8-6.2 "string last with utf-8" {
+ string last \u2702 "\ub5zy\u2702xw"
+} 3
+
+test utf8-6.3 "string last with utf-8" {
+ string last \u2704 "\ub5zy\u2702xw"
+} -1
+
+test utf8-6.4 "string last with utf-8" {
+ string last \u2702 "\ub5zy\u2702xw\u2702BB"
+} 6
+
+test utf8-7.1 "string reverse" {
+ string reverse \ub5Test\u2702
+} \u2702tseT\ub5
+
+# This file contains a collection of tests for tclUtf.c
+# Sourcing this file into Tcl runs the tests and generates output for
+# errors. No output means no errors were found.
+#
+# Copyright (c) 1997 Sun Microsystems, Inc.
+# Copyright (c) 1998-1999 by Scriptics Corporation.
+#
+# See the file "license.terms" for information on usage and redistribution
+# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
+# RCS: @(#) $Id: utf.test,v 1.7 2000/04/10 17:19:05 ericm Exp $
+
+catch {unset x}
+
+section "utf tests"
+
+test utf-1.1 {Tcl_UniCharToUtf: 1 byte sequences} {
+ set x \u01
+} [bytestring "\x01"]
+test utf-1.2 {Tcl_UniCharToUtf: 2 byte sequences} {
+ set x "\u80"
+} [bytestring "\xc2\x80"]
+test utf-1.3 {Tcl_UniCharToUtf: 2 byte sequences} {
+ set x "\ue0"
+} [bytestring "\xc3\xa0"]
+test utf-1.4 {Tcl_UniCharToUtf: 3 byte sequences} {
+ set x "\u4e4e"
+} [bytestring "\xe4\xb9\x8e"]
+
+test utf-2.1 {Tcl_UtfToUniChar: low ascii} {
+ string length "abc"
+} {3}
+test utf-2.4 {Tcl_UtfToUniChar: lead (2-byte) followed by trail} {
+ string length [bytestring "\xC2\xa2"]
+} {1}
+test utf-2.7 {Tcl_UtfToUniChar: lead (3-byte) followed by 2 trail} {
+ string length [bytestring "\xE4\xb9\x8e"]
+} {1}
+
+test utf-3.1 {Tcl_UtfCharComplete} {
+} {}
+
+test utf-4.1 {Tcl_NumUtfChars: zero length} {
+ string length ""
+} {0}
+test utf-4.2 {Tcl_NumUtfChars: length 1} {
+ string length [bytestring "\xC2\xA2"]
+} {1}
+test utf-4.3 {Tcl_NumUtfChars: long string} {
+ string length [bytestring "abc\xC2\xA2\xe4\xb9\x8e\uA2\u4e4e"]
+} {7}
+
+test utf-5.1 {Tcl_UtfFindFirsts} {
+} {}
+
+test utf-6.1 {Tcl_UtfNext} {
+} {}
+
+test utf-7.1 {Tcl_UtfPrev} {
+} {}
+
+test utf-8.1 {Tcl_UniCharAtIndex: index = 0} {
+ string index abcd 0
+} {a}
+test utf-8.2 {Tcl_UniCharAtIndex: index = 0} {
+ string index \u4e4e\u25a 0
+} "\u4e4e"
+test utf-8.3 {Tcl_UniCharAtIndex: index > 0} {
+ string index abcd 2
+} {c}
+test utf-8.4 {Tcl_UniCharAtIndex: index > 0} {
+ string index \u4e4e\u25a\uff\u543 2
+} "\uff"
+
+test utf-9.1 {Tcl_UtfAtIndex: index = 0} {
+ string range abcd 0 2
+} {abc}
+test utf-9.2 {Tcl_UtfAtIndex: index > 0} {
+ string range \u4e4e\u25a\uff\u543klmnop 1 5
+} "\u25a\uff\u543kl"
+
+
+test utf-10.1 {Tcl_UtfBackslash: dst == NULL} {
+ set x \n
+} {
+}
+test utf-10.2 {Tcl_UtfBackslash: \u subst} {
+ set x \ua2
+} [bytestring "\xc2\xa2"]
+test utf-10.3 {Tcl_UtfBackslash: longer \u subst} {
+ set x \u4e21
+} [bytestring "\xe4\xb8\xa1"]
+test utf-10.4 {Tcl_UtfBackslash: stops at first non-hex} {
+ set x \u4e2k
+} "[bytestring \xd3\xa2]k"
+test utf-10.5 {Tcl_UtfBackslash: stops after 4 hex chars} {
+ set x \u4e216
+} "[bytestring \xe4\xb8\xa1]6"
+proc bsCheck {char num} {
+ global errNum
+ test utf-10.$errNum "backslash substitution ($num)" {
+ scan $char %c value
+ set value
+ } $num
+ incr errNum
+}
+set errNum 6
+bsCheck \b 8
+bsCheck \e 101
+bsCheck \f 12
+bsCheck \n 10
+bsCheck \r 13
+bsCheck \t 9
+bsCheck \v 11
+bsCheck \{ 123
+bsCheck \} 125
+bsCheck \[ 91
+bsCheck \] 93
+bsCheck \$ 36
+bsCheck \ 32
+bsCheck \; 59
+bsCheck \\ 92
+bsCheck \Ca 67
+bsCheck \Ma 77
+bsCheck \CMa 67
+# prior to 8.3, this returned 8, as \8 as accepted as an
+# octal value - but it isn't! [Bug: 3975]
+bsCheck \8a 56
+bsCheck \14 12
+bsCheck \141 97
+bsCheck b\0 98
+bsCheck \x 120
+bsCheck \xa 10
+bsCheck \xA 10
+bsCheck \x41 65
+#bsCheck \x541 65
+bsCheck \u 117
+bsCheck \uk 117
+bsCheck \u41 65
+bsCheck \ua 10
+bsCheck \uA 10
+bsCheck \ue0 224
+bsCheck \ua1 161
+bsCheck \u4e21 20001
+
+test utf-11.1 {Tcl_UtfToUpper} {
+ string toupper {}
+} {}
+test utf-11.2 {Tcl_UtfToUpper} {
+ string toupper abc
+} ABC
+test utf-11.3 {Tcl_UtfToUpper} {
+ string toupper \u00e3ab
+} \u00c3AB
+test utf-11.4 {Tcl_UtfToUpper} {
+ string toupper \u01e3ab
+} \u01e2AB
+
+test utf-12.1 {Tcl_UtfToLower} {
+ string tolower {}
+} {}
+test utf-12.2 {Tcl_UtfToLower} {
+ string tolower ABC
+} abc
+test utf-12.3 {Tcl_UtfToLower} {
+ string tolower \u00c3AB
+} \u00e3ab
+test utf-12.4 {Tcl_UtfToLower} {
+ string tolower \u01e2AB
+} \u01e3ab
+
+
+test utf-14.1 {Tcl_UtfNcasecmp} {
+ string compare -nocase a b
+} -1
+test utf-14.2 {Tcl_UtfNcasecmp} {
+ string compare -nocase b a
+} 1
+test utf-14.3 {Tcl_UtfNcasecmp} {
+ string compare -nocase B a
+} 1
+test utf-14.4 {Tcl_UtfNcasecmp} {
+ string compare -nocase aBcB abca
+} 1
+
+test utf-15.1 {Tcl_UniCharToUpper, negative delta} {
+ string toupper aA
+} AA
+test utf-15.2 {Tcl_UniCharToUpper, positive delta} {
+ string toupper \u0178\u00ff
+} \u0178\u0178
+test utf-15.3 {Tcl_UniCharToUpper, no delta} {
+ string toupper !
+} !
+
+test utf-16.1 {Tcl_UniCharToLower, negative delta} {
+ string tolower aA
+} aa
+test utf-16.2 {Tcl_UniCharToLower, positive delta} {
+ string tolower \u0178\u00ff
+} \u00ff\u00ff
+test utf-17.1 {Tcl_UniCharToLower, no delta} {
+ string tolower !
+} !
+
+test utf-18.1 {append counts correctly} {
+ set x \u2702XYZ
+ append x \u2702XYZ
+ list [string length $x] [string bytelength $x]
+} {8 12}
+
+testreport
+}