summaryrefslogtreecommitdiffstats
path: root/tests/lindex.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2018-03-11 12:33:16 (GMT)
committerdgp <dgp@users.sourceforge.net>2018-03-11 12:33:16 (GMT)
commitc7e8d507d9233725a4629931bbceeea7ac23f699 (patch)
treecedf1bdd26675be6cadb2414a4057c19611f5868 /tests/lindex.test
parentcb242c0d50a43eddaa567d50717b5367658eb934 (diff)
parente7be4a19a0cdf781b241095a0aba272ff7b35ffd (diff)
downloadtcl-c7e8d507d9233725a4629931bbceeea7ac23f699.zip
tcl-c7e8d507d9233725a4629931bbceeea7ac23f699.tar.gz
tcl-c7e8d507d9233725a4629931bbceeea7ac23f699.tar.bz2
merge 8.7
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 4802e28..9de08c1 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