summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--module/rnrs/hashtables.scm5
-rw-r--r--test-suite/tests/r6rs-hashtables.test6
2 files changed, 7 insertions, 4 deletions
diff --git a/module/rnrs/hashtables.scm b/module/rnrs/hashtables.scm
index 98d2d7616..5773eb1a8 100644
--- a/module/rnrs/hashtables.scm
+++ b/module/rnrs/hashtables.scm
@@ -122,8 +122,9 @@
(define (hashtable-set! hashtable key obj)
(if (r6rs:hashtable-mutable? hashtable)
- (hash-table-set! (r6rs:hashtable-wrapped-table hashtable) key obj))
- *unspecified*)
+ (hash-table-set! (r6rs:hashtable-wrapped-table hashtable) key obj)
+ (assertion-violation
+ 'hashtable-set! "Hashtable is immutable." hashtable)))
(define (hashtable-delete! hashtable key)
(if (r6rs:hashtable-mutable? hashtable)
diff --git a/test-suite/tests/r6rs-hashtables.test b/test-suite/tests/r6rs-hashtables.test
index c7812c5b3..dbf685995 100644
--- a/test-suite/tests/r6rs-hashtables.test
+++ b/test-suite/tests/r6rs-hashtables.test
@@ -20,6 +20,7 @@
(define-module (test-suite test-rnrs-hashtable)
:use-module (ice-9 receive)
:use-module ((rnrs hashtables) :version (6))
+ :use-module ((rnrs exceptions) :version (6))
:use-module (srfi srfi-1)
:use-module (test-suite lib))
@@ -130,8 +131,9 @@
(pass-if "hashtable-copy with mutability #f produces immutable copy"
(let ((copied-table (hashtable-copy (make-eq-hashtable) #f)))
- (hashtable-set! copied-table 'foo 1)
- (not (hashtable-ref copied-table 'foo #f)))))
+ (guard (exc (else #t))
+ (hashtable-set! copied-table 'foo 1)
+ #f))))
(with-test-prefix "hashtable-clear!"
(pass-if "hashtable-clear! removes all values from hashtable"