summaryrefslogtreecommitdiffstats
path: root/tests/lindex.test
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2018-03-06 21:59:53 (GMT)
committersebres <sebres@users.sourceforge.net>2018-03-06 21:59:53 (GMT)
commitc68d043691c94408564f252d18ffce9db7afcdad (patch)
tree5a1460a54614cad65c05bc701af60e3f173f0d4c /tests/lindex.test
parent465d28aa75b2835484face7df25b073b09f81f7c (diff)
downloadtcl-c68d043691c94408564f252d18ffce9db7afcdad.zip
tcl-c68d043691c94408564f252d18ffce9db7afcdad.tar.gz
tcl-c68d043691c94408564f252d18ffce9db7afcdad.tar.bz2
try to fix [db36fa5122]: better compiled variants of several indices-related commands, test-cases extended
Diffstat (limited to 'tests/lindex.test')
-rw-r--r--tests/lindex.test9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/lindex.test b/tests/lindex.test
index b86e2e0..e513b62 100644
--- a/tests/lindex.test
+++ b/tests/lindex.test
@@ -79,6 +79,15 @@ test lindex-3.7 {indexes don't shimmer wide ints} {
set x [expr {(wide(1)<<31) - 2}]
list $x [lindex {1 2 3} $x] [incr x] [incr x]
} {2147483646 {} 2147483647 2147483648}
+test lindex-3.8 {compiled with static indices out of range, negative} {
+ list [lindex {a b c} -1] [lindex {a b c} -2] [lindex {a b c} -3]
+} [lrepeat 3 {}]
+test lindex-3.9 {compiled with calculated indices out of range, negative constant} {
+ list [lindex {a b c} -1-1] [lindex {a b c} -2+0] [lindex {a b c} -2+1]
+} [lrepeat 3 {}]
+test lindex-3.10 {compiled with calculated indices out of range, after end} {
+ list [lindex {a b c} end+1] [lindex {a b c} end+2] [lindex {a b c} end+3]
+} [lrepeat 3 {}]
# Indices relative to end