summaryrefslogtreecommitdiff
path: root/test-suite/tests/strings.test
diff options
context:
space:
mode:
Diffstat (limited to 'test-suite/tests/strings.test')
-rw-r--r--test-suite/tests/strings.test28
1 files changed, 24 insertions, 4 deletions
diff --git a/test-suite/tests/strings.test b/test-suite/tests/strings.test
index fa8e6e1af..d892b7077 100644
--- a/test-suite/tests/strings.test
+++ b/test-suite/tests/strings.test
@@ -1,23 +1,25 @@
;;;; strings.test --- test suite for Guile's string functions -*- scheme -*-
;;;; Jim Blandy <jimb@red-bean.com> --- August 1999
;;;;
-;;;; Copyright (C) 1999, 2001, 2004, 2005, 2006, 2008, 2009, 2010 Free Software Foundation, Inc.
-;;;;
+;;;; Copyright (C) 1999, 2001, 2004, 2005, 2006, 2008, 2009, 2010,
+;;;; 2011 Free Software Foundation, Inc.
+;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
;;;; License as published by the Free Software Foundation; either
;;;; version 3 of the License, or (at your option) any later version.
-;;;;
+;;;;
;;;; This library is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;;;; Lesser General Public License for more details.
-;;;;
+;;;;
;;;; You should have received a copy of the GNU Lesser General Public
;;;; License along with this library; if not, write to the Free Software
;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
(define-module (test-strings)
+ #:use-module ((system base compile) #:select (compile))
#:use-module (test-suite lib))
(define exception:read-only-string
@@ -241,6 +243,24 @@
(not (string? 'abc))))
;;
+;; literals
+;;
+
+(with-test-prefix "literals"
+
+ ;; The "Storage Model" section of R5RS reads: "In such systems literal
+ ;; constants and the strings returned by `symbol->string' are
+ ;; immutable objects". `eval' doesn't support it yet, but it doesn't
+ ;; really matter because `eval' doesn't coalesce repeated constants,
+ ;; unlike the bytecode compiler.
+
+ (pass-if-exception "literals are constant"
+ exception:read-only-string
+ (compile '(string-set! "literal string" 0 #\x)
+ #:from 'scheme
+ #:to 'value)))
+
+;;
;; string-null?
;;