From 058a5ef8474fb62f711d53e2fc8e2fa68fbb8996 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Sun, 20 Dec 2020 08:58:50 +1000 Subject: core: commands that take an index now use integer expressions This means that instead of just [list index 2+1], we can now do [list index end-$n*2+1] This applies to: lindex, linsert, lreplace, lset, lrange, lsort, regexp, regsub string index,first,last,range Also add tests for both direct integer expressions and indexes. Still needs doc update. Signed-off-by: Steve Bennett --- tests/lsort.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tests/lsort.test') diff --git a/tests/lsort.test b/tests/lsort.test index 5808b89..dd5a019 100644 --- a/tests/lsort.test +++ b/tests/lsort.test @@ -51,7 +51,7 @@ test lsort-1.11 {Tcl_LsortObjCmd procedure, -index option} { } {1 {"-index" option must be followed by list index}} test lsort-1.12 {Tcl_LsortObjCmd procedure, -index option} { list [catch {lsort -index foo {1 3 2 5}} msg] $msg -} {1 {bad index "foo": must be integer?[+-]integer? or end?[+-]integer?}} +} {1 {bad index "foo": must be intexpr or end?[+-]intexpr?}} test lsort-1.13 {Tcl_LsortObjCmd procedure, -index option} { lsort -index end -integer {{2 25} {10 20 50 100} {3 16 42} 1} } {1 {2 25} {3 16 42} {10 20 50 100}} -- cgit v1.1