diff options
author | dgp <dgp@users.sourceforge.net> | 2018-03-09 22:18:30 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2018-03-09 22:18:30 (GMT) |
commit | 87fd09e44a51e90ebb71a1f46a5300859c62e99a (patch) | |
tree | 0cdf856871de94cc8600b76014a998f815070896 /tests/cmdIL.test | |
parent | f337281f750a928dcc07884286cc1f4cceeab809 (diff) | |
parent | cd4e0ec5deffef9dbc4331768ca660fef4590501 (diff) | |
download | tcl-87fd09e44a51e90ebb71a1f46a5300859c62e99a.zip tcl-87fd09e44a51e90ebb71a1f46a5300859c62e99a.tar.gz tcl-87fd09e44a51e90ebb71a1f46a5300859c62e99a.tar.bz2 |
[db36fa5122] Upgrade the index value parsing and encoding machinery.
Refactor many systems to make consistent use of it. Repairs many indexing
errors in corner cases.
Diffstat (limited to 'tests/cmdIL.test')
-rw-r--r-- | tests/cmdIL.test | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/cmdIL.test b/tests/cmdIL.test index 23a5f96..c83bd98 100644 --- a/tests/cmdIL.test +++ b/tests/cmdIL.test @@ -147,6 +147,12 @@ test cmdIL-1.36 {lsort -stride and -index: Bug 2918962} { {{b i g} 12345} {{d e m o} 34512} } } {{{b i g} 12345} {{d e m o} 34512} {{c o d e} 54321} {{b l a h} 94729}} +test cmdIL-1.37 {lsort -stride and -index} -body { + lsort -stride 2 -index -2 {a 2 b 1} +} -returnCodes error -result {index "-2" cannot select an element from any list} +test cmdIL-1.38 {lsort -stride and-index} -body { + lsort -stride 2 -index -1-1 {a 2 b 1} +} -returnCodes error -result {index "-1-1" cannot select an element from any list} # Can't think of any good tests for the MergeSort and MergeLists procedures, # except a bunch of random lists to sort. @@ -203,6 +209,33 @@ test cmdIL-3.4.1 {SortCompare procedure, -index option} -body { test cmdIL-3.5 {SortCompare procedure, -index option} -body { lsort -integer -index 2 {{20 10 13} {15}} } -returnCodes error -result {element 2 missing from sublist "15"} +test cmdIL-3.5.1 {SortCompare procedure, -index option (out of range, calculated index)} -body { + lsort -index 1+3 {{1 . c} {2 . b} {3 . a}} +} -returnCodes error -result {element 4 missing from sublist "1 . c"} +test cmdIL-3.5.2 {SortCompare procedure, -index option (out of range, calculated index)} -body { + lsort -index -1-1 {{1 . c} {2 . b} {3 . a}} +} -returnCodes error -result {index "-1-1" cannot select an element from any list} +test cmdIL-3.5.3 {SortCompare procedure, -index option (out of range, calculated index)} -body { + lsort -index -2 {{1 . c} {2 . b} {3 . a}} +} -returnCodes error -result {index "-2" cannot select an element from any list} +test cmdIL-3.5.4 {SortCompare procedure, -index option (out of range, calculated index)} -body { + lsort -index end-4 {{1 . c} {2 . b} {3 . a}} +} -returnCodes error -result {element -2 missing from sublist "1 . c"} +test cmdIL-3.5.5 {SortCompare procedure, -index option} { + lsort -index {} {a b} +} {a b} +test cmdIL-3.5.6 {SortCompare procedure, -index option} { + lsort -index {} [list a \{] +} {a \{} +test cmdIL-3.5.7 {SortCompare procedure, -index option (out of range, calculated index)} -body { + lsort -index end--1 {{1 . c} {2 . b} {3 . a}} +} -returnCodes error -result {index "end--1" cannot select an element from any list} +test cmdIL-3.5.8 {SortCompare procedure, -index option (out of range, calculated index)} -body { + lsort -index end+1 {{1 . c} {2 . b} {3 . a}} +} -returnCodes error -result {index "end+1" cannot select an element from any list} +test cmdIL-3.5.9 {SortCompare procedure, -index option (out of range, calculated index)} -body { + lsort -index end+2 {{1 . c} {2 . b} {3 . a}} +} -returnCodes error -result {index "end+2" cannot select an element from any list} test cmdIL-3.6 {SortCompare procedure, -index option} { lsort -integer -index 2 {{1 15 30} {2 5 25} {3 25 20}} } {{3 25 20} {2 5 25} {1 15 30}} |