mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 23:00:22 +02:00
Regression, scm_string fails to test for circular lists
* libguile/string.c (scm_string): Restores the functionality where scm_string tests for circular lists * test-suite/tests/strings.test: add test for circular lists
This commit is contained in:
parent
bd4911efd2
commit
3c7cf7f5c0
2 changed files with 12 additions and 1 deletions
|
@ -1015,10 +1015,11 @@ SCM_DEFINE (scm_string, "string", 0, 0, 1,
|
||||||
|
|
||||||
/* Verify that this is a list of chars. */
|
/* Verify that this is a list of chars. */
|
||||||
i = scm_ilength (chrs);
|
i = scm_ilength (chrs);
|
||||||
|
SCM_ASSERT (i >= 0, chrs, SCM_ARG1, FUNC_NAME);
|
||||||
|
|
||||||
len = (size_t) i;
|
len = (size_t) i;
|
||||||
rest = chrs;
|
rest = chrs;
|
||||||
|
|
||||||
SCM_ASSERT (len >= 0, chrs, SCM_ARG1, FUNC_NAME);
|
|
||||||
while (len > 0 && scm_is_pair (rest))
|
while (len > 0 && scm_is_pair (rest))
|
||||||
{
|
{
|
||||||
SCM elt = SCM_CAR (rest);
|
SCM elt = SCM_CAR (rest);
|
||||||
|
|
|
@ -447,7 +447,17 @@
|
||||||
(string-set! s 4 (integer->char #x010300))
|
(string-set! s 4 (integer->char #x010300))
|
||||||
(char=? (string-ref s 4) (integer->char #x010300)))))
|
(char=? (string-ref s 4) (integer->char #x010300)))))
|
||||||
|
|
||||||
|
;;
|
||||||
|
;; list->string
|
||||||
|
;;
|
||||||
|
(with-test-prefix "string"
|
||||||
|
|
||||||
|
(pass-if-exception "convert circular list to string"
|
||||||
|
exception:wrong-type-arg
|
||||||
|
(let ((foo (list #\a #\b #\c)))
|
||||||
|
(set-cdr! (cddr foo) (cdr foo))
|
||||||
|
(apply string foo))))
|
||||||
|
|
||||||
(with-test-prefix "string-split"
|
(with-test-prefix "string-split"
|
||||||
|
|
||||||
;; in guile 1.6.7 and earlier, character >=128 wasn't matched in the string
|
;; in guile 1.6.7 and earlier, character >=128 wasn't matched in the string
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue