* tests/ports.test ("string ports"): Copy string literal so that
authorMarius Vollmer <mvo@zagadka.de>
Wed, 22 Sep 2004 14:32:47 +0000 (14:32 +0000)
committerMarius Vollmer <mvo@zagadka.de>
Wed, 22 Sep 2004 14:32:47 +0000 (14:32 +0000)
it can be modified.
* tests/srfi-13.test ("string-copy!"): Likewise.
* tests/strings.test ("substring/shared"): Likewise.

test-suite/tests/srfi-13.test
test-suite/tests/strings.test

index bbdc49c..372a467 100644 (file)
   (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))))
 
index 544c8eb..86cf487 100644 (file)
 
 (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!"
           (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")))