From 48650316e3373be33455bab6db0a33546169c906 Mon Sep 17 00:00:00 2001 From: aspect Date: Thu, 19 Feb 2015 02:34:43 +0000 Subject: (core ticket [32b6159246]) Fix for [lreplace l x y] where y 0 && idx2 > 0 && idx2 < idx1) { + if (idx1 >= 0 && idx2 > 0 && idx2 < idx1) { idx2 = idx1 - 1; } else if (idx1 < 0 && idx2 < 0 && idx2 < idx1) { idx2 = idx1 - 1; diff --git a/tests/lreplace.test b/tests/lreplace.test index b976788..44f3ac2 100644 --- a/tests/lreplace.test +++ b/tests/lreplace.test @@ -137,6 +137,12 @@ test lreplace-4.1 {Bug ccc2c2cc98: lreplace edge case} { test lreplace-4.2 {Bug ccc2c2cc98: lreplace edge case} { lreplace { } 1 1 } {} +test lreplace-4.3 {lreplace edge case} { + lreplace {1 2 3} 2 0 +} {1 2 3} +test lreplace-4.4 {lreplace edge case} { + lreplace {1 2 3 4 5} 3 1 +} {1 2 3 4 5} # cleanup catch {unset foo} -- cgit v0.12