Trim bootstrap jimsh
[jimtcl.git] / tests / lsortcmd.test
blobed53fe5ef32ba8a0ed3fd201669ca29ae3fdae47
1 source [file dirname [info script]]/testing.tcl
3 set list {b d a c z}
5 proc sorter {a v1 v2} {
6         set ::arg $a
7         return [string compare $v1 $v2]
10 proc test_lsort_cmd {test cmd list exp} {
11         lsort -command $cmd $list
12         if {$::arg != $exp} {
13                 error "$test: Failed"
14         }
17 test lsortcmd-1.1 "Sort with one arg" {
18         lsort -command "sorter arg1" $list
19         set arg
20 } {arg1}
22 test lsortcmd-1.2 "Sort with one arg containg spaces" {
23         lsort -command {sorter "arg with space"} $list
24         set arg
25 } {arg with space}
27 test lsortcmd-1.3 "Sort with arg as list containg spaces" {
28         lsort -command [list sorter [list arg with list "last with spaces"]] $list
29         set arg
30 } {arg with list {last with spaces}}
32 testreport