From d7e4c2da23feae8c135384af3d4ace1130d7c517 Mon Sep 17 00:00:00 2001 From: Marius Vollmer Date: Wed, 22 Sep 2004 14:32:47 +0000 Subject: [PATCH] * tests/ports.test ("string ports"): Copy string literal so that it can be modified. * tests/srfi-13.test ("string-copy!"): Likewise. * tests/strings.test ("substring/shared"): Likewise. --- test-suite/tests/srfi-13.test | 2 +- test-suite/tests/strings.test | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/test-suite/tests/srfi-13.test b/test-suite/tests/srfi-13.test index bbdc49cc5..372a467db 100644 --- a/test-suite/tests/srfi-13.test +++ b/test-suite/tests/srfi-13.test @@ -379,7 +379,7 @@ (pass-if "non-empty string" (string=? "welld, oh yeah!" (let* ((s "hello") - (t "world, oh yeah!")) + (t (string-copy "world, oh yeah!"))) (string-copy! t 1 s 1 3) t)))) diff --git a/test-suite/tests/strings.test b/test-suite/tests/strings.test index 544c8eb9c..86cf48774 100644 --- a/test-suite/tests/strings.test +++ b/test-suite/tests/strings.test @@ -20,11 +20,8 @@ (use-modules (test-suite lib)) -;; FIXME: As soon as guile supports immutable strings, this has to be -;; replaced with the appropriate error type and message. -(define exception:immutable-string - (cons 'some-error-type "^trying to modify an immutable string")) - +(define exception:read-only-string + (cons 'misc-error "^string is read-only")) (with-test-prefix "string=?" @@ -78,8 +75,8 @@ (with-test-prefix "string-set!" - (expect-fail-exception "string constant" - exception:immutable-string + (pass-if-exception "string constant" + exception:read-only-string (string-set! "abc" 1 #\space))) (with-test-prefix "substring-move!" @@ -103,7 +100,7 @@ (string=? str2 "fooFOOfoo")))) (pass-if "modify double indirectly" - (let* ((str1 "foofoofoo") + (let* ((str1 (string-copy "foofoofoo")) (str2 (substring/shared str1 2 7))) (string-upcase! (substring/shared str2 1 4)) (string=? str1 "fooFOOfoo"))) -- 2.20.1