blob: ed53fe5ef32ba8a0ed3fd201669ca29ae3fdae47 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
source [file dirname [info script]]/testing.tcl
set list {b d a c z}
proc sorter {a v1 v2} {
set ::arg $a
return [string compare $v1 $v2]
}
proc test_lsort_cmd {test cmd list exp} {
lsort -command $cmd $list
if {$::arg != $exp} {
error "$test: Failed"
}
}
test lsortcmd-1.1 "Sort with one arg" {
lsort -command "sorter arg1" $list
set arg
} {arg1}
test lsortcmd-1.2 "Sort with one arg containg spaces" {
lsort -command {sorter "arg with space"} $list
set arg
} {arg with space}
test lsortcmd-1.3 "Sort with arg as list containg spaces" {
lsort -command [list sorter [list arg with list "last with spaces"]] $list
set arg
} {arg with list {last with spaces}}
testreport
|