aboutsummaryrefslogtreecommitdiff
path: root/tests/lsort.test
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2013-11-10 12:57:59 +1000
committerSteve Bennett <steveb@workware.net.au>2013-12-11 06:07:00 +1000
commitee08ea6a4454de6b8dca0f14446a6b8b29cc1458 (patch)
tree9c7275210b4072ed93f94f418233d247e6b67280 /tests/lsort.test
parente18a8843ab70d6b3d20c7b384e7aef762474d7be (diff)
downloadjimtcl-ee08ea6a4454de6b8dca0f14446a6b8b29cc1458.zip
jimtcl-ee08ea6a4454de6b8dca0f14446a6b8b29cc1458.tar.gz
jimtcl-ee08ea6a4454de6b8dca0f14446a6b8b29cc1458.tar.bz2
Add support for lsort -unique
Signed-off-by: Steve Bennett <steveb@workware.net.au>
Diffstat (limited to 'tests/lsort.test')
-rw-r--r--tests/lsort.test9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/lsort.test b/tests/lsort.test
index b3096a7..a1e5500 100644
--- a/tests/lsort.test
+++ b/tests/lsort.test
@@ -17,7 +17,7 @@ test lsort-1.1 {Tcl_LsortObjCmd procedure} jim {
} {1 {wrong # args: should be "lsort ?options? list"}}
test lsort-1.2 {Tcl_LsortObjCmd procedure} jim {
list [catch {lsort -foo {1 3 2 5}} msg] $msg
-} {1 {bad option "-foo": must be -ascii, -command, -decreasing, -increasing, -index, -integer, -nocase, or -real}}
+} {1 {bad option "-foo": must be -ascii, -command, -decreasing, -increasing, -index, -integer, -nocase, -real, or -unique}}
test lsort-1.3 {Tcl_LsortObjCmd procedure, default options} {
lsort {d e c b a \{ d35 d300}
} {a b c d d300 d35 e \{}
@@ -182,6 +182,13 @@ test lsort-3.19 {SortCompare procedure, -decreasing option} {
test lsort-3.20 {SortCompare procedure, -real option} -body {
lsort -real {6...4 3}
} -returnCodes error -result {expected number but got "6...4"}
+test lsort-3.21 {lsort, unique sort} {
+ lsort -integer -unique {3 1 2 3 1 4 3}
+} {1 2 3 4}
+test lsort-3.22 {lsort, unique sort with index} {
+ # lsort -unique should return the last unique item
+ lsort -unique -index 0 {{a b} {c b} {a c} {d a}}
+} {{a c} {c b} {d a}}
test lsort-4.26 {DefaultCompare procedure, signed characters} utf8 {
set l [lsort [list "abc\u80" "abc"]]