diff options
author | Ludovic Courtès <ludo@gnu.org> | 2008-10-09 22:32:16 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2008-10-09 22:32:16 +0200 |
commit | 1ffa692322ef03890f7d15aadeb79cffaa0f105d (patch) | |
tree | 17482f3f6118b0bd8341c0e99ec094bbe5705933 | |
parent | 45a9f4304955599ee4e772069e56d131401695dd (diff) | |
download | guile-1ffa692322ef03890f7d15aadeb79cffaa0f105d.tar.gz |
Add test case to make sure `read' returns mutable strings.
* test-suite/tests/reader.test ("reading")["returned strings are
mutable"]: New test, as reported by szgyg <szgyg@ludens.elte.hu>.
-rw-r--r-- | test-suite/tests/reader.test | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/test-suite/tests/reader.test b/test-suite/tests/reader.test index 0b13cf1c0..b068c716d 100644 --- a/test-suite/tests/reader.test +++ b/test-suite/tests/reader.test @@ -88,7 +88,14 @@ (pass-if "CR recognized as a token delimiter" ;; In 1.8.3, character 0x0d was not recognized as a delimiter. - (equal? (read-string "one\x0dtwo") 'one))) + (equal? (read-string "one\x0dtwo") 'one)) + + (pass-if "returned strings are mutable" + ;; Per R5RS Section 3.4, "Storage Model", `read' is supposed to return + ;; mutable objects. + (let ((str (with-input-from-string "\"hello, world\"" read))) + (string-set! str 0 #\H) + (string=? str "Hello, world")))) (pass-if-exception "radix passed to number->string can't be zero" |