diff options
-rw-r--r-- | jim.c | 2 | ||||
-rw-r--r-- | tests/coverage.test | 8 |
2 files changed, 9 insertions, 1 deletions
@@ -7414,7 +7414,7 @@ static void UpdateStringOfIndex(struct Jim_Obj *objPtr) } else { char buf[JIM_INTEGER_SPACE + 1]; - if (objPtr->internalRep.intValue >= 0) { + if (objPtr->internalRep.intValue >= 0 || objPtr->internalRep.intValue == -INT_MAX) { sprintf(buf, "%d", objPtr->internalRep.intValue); } else { diff --git a/tests/coverage.test b/tests/coverage.test index b99b273..95d6969 100644 --- a/tests/coverage.test +++ b/tests/coverage.test @@ -164,6 +164,14 @@ test index-4 {index > INT_MAX} debug-invstr { lindex {a b c} $x } {} +test index-5 {update string of index} debug-invstr { + set x -1 + lindex {a b c} $x + debug invstr $x + # x is now of index type with no string rep + set x +} {-2147483647} + test cmd-1 {standard -commands} jim { expr {"length" in [string -commands]} } {1} |