diff --git a/test-suite/tests/strings.test b/test-suite/tests/strings.test index 7393bc8ec..c6df15844 100644 --- a/test-suite/tests/strings.test +++ b/test-suite/tests/strings.test @@ -1,7 +1,7 @@ ;;;; strings.test --- test suite for Guile's string functions -*- scheme -*- ;;;; Jim Blandy --- August 1999 ;;;; -;;;; Copyright (C) 1999,2001,2004-2006,2008-2011,2013,2015,2018,2020 +;;;; Copyright (C) 1999,2001,2004-2006,2008-2011,2013,2015,2018,2020,2023 ;;;; Free Software Foundation, Inc. ;;;; ;;;; This library is free software; you can redistribute it and/or @@ -504,7 +504,7 @@ ;; string-ref ;; -(with-test-prefix "string-ref" +(with-test-prefix/c&e "string-ref" (pass-if-exception "empty string" exception:out-of-range @@ -518,9 +518,18 @@ exception:out-of-range (string-ref "hello" 123)) - (pass-if-exception "negative index" - exception:out-of-range - (string-ref "hello" -1)) + (pass-if-equal "negative index" ; + '(0 upper -1) + (catch 'out-of-range + (lambda () + (string-ref "hello" -1)) + (lambda args + (let ((bounds+index (list-ref args 3))) + ;; At -O2, the out-of-range error is raised when converting + ;; "-1" to uint64, so the upper bound that's reported is + ;; UINT64_MAX. + (list (list-ref bounds+index 0) 'upper + (list-ref bounds+index 2)))))) (pass-if "regular string, ASCII char" (char=? (string-ref "GNU Guile" 4) #\G))