1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 21:40:33 +02:00

* 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.
This commit is contained in:
Marius Vollmer 2004-09-22 14:32:47 +00:00
parent e4cbd1d8aa
commit d7e4c2da23
2 changed files with 6 additions and 9 deletions

View file

@ -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))))

View file

@ -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")))