summaryrefslogtreecommitdiffstats
path: root/tests/lrange.test
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2018-03-15 21:53:00 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2018-03-15 21:53:00 (GMT)
commitdb41a49d9cd891820e877f97e213d478d1ce6e1d (patch)
treed336ccb6018daac740c9e216c5a735f7196907a8 /tests/lrange.test
parent69868ee129e5fe87ad3e38afa7b92208974af881 (diff)
parentdf06afadcfb949909d6a640b77fe234e266dc848 (diff)
downloadtcl-db41a49d9cd891820e877f97e213d478d1ce6e1d.zip
tcl-db41a49d9cd891820e877f97e213d478d1ce6e1d.tar.gz
tcl-db41a49d9cd891820e877f97e213d478d1ce6e1d.tar.bz2
merge 8.7
Diffstat (limited to 'tests/lrange.test')
-rw-r--r--tests/lrange.test18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/lrange.test b/tests/lrange.test
index 02b9c65..a5367a4 100644
--- a/tests/lrange.test
+++ b/tests/lrange.test
@@ -90,6 +90,24 @@ test lrange-3.1 {Bug 3588366: end-offsets before start} {
lrange $l 0 end-5
}} {1 2 3 4 5}
} {}
+
+test lrange-3.2 {compiled with static indices out of range, negative} {
+ list [lrange {a b c} -1 -2] [lrange {a b c} -2 -1] [lrange {a b c} -3 -2] [lrange {a b c} -2 -3]
+} [lrepeat 4 {}]
+test lrange-3.3 {compiled with calculated indices out of range, negative constant} {
+ list [lrange {a b c} 0-1 -1-1] [lrange {a b c} -2+0 0-1] [lrange {a b c} -2-1 -2+1] [lrange {a b c} -2+1 -2-1]
+} [lrepeat 4 {}]
+test lrange-3.4 {compiled with calculated indices out of range, after end} {
+ list [lrange {a b c} end+1 end+2] [lrange {a b c} end+2 end+1] [lrange {a b c} end+2 end+3] [lrange {a b c} end+3 end+2]
+} [lrepeat 4 {}]
+
+test lrange-3.5 {compiled with calculated indices, start out of range (negative)} {
+ list [lrange {a b c} -1 1] [lrange {a b c} -1+0 end-1] [lrange {a b c} -2 1] [lrange {a b c} -2+0 0+1]
+} [lrepeat 4 {a b}]
+test lrange-3.6 {compiled with calculated indices, end out of range (after end)} {
+ list [lrange {a b c} 1 end+1] [lrange {a b c} 1+0 2+1] [lrange {a b c} 1 end+1] [lrange {a b c} end-1 3+1]
+} [lrepeat 4 {b c}]
+
# cleanup
::tcltest::cleanupTests