summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobby Zambito <contact@robbyzambito.me>2023-02-23 09:31:11 -0500
committerRobby Zambito <contact@robbyzambito.me>2023-02-23 09:31:11 -0500
commit35ca4b65f9849f50090f01dfe4f5e5501fc09ae8 (patch)
tree5f0cd3ef91f903ea0157f3da2f19ace912cf80bf
parent8ff958316381d4814c5648167ed08dc356382f99 (diff)
Update test to avoid undefined behavior
-rw-r--r--test/run.scm10
1 files changed, 7 insertions, 3 deletions
diff --git a/test/run.scm b/test/run.scm
index 38d28de..91d57ca 100644
--- a/test/run.scm
+++ b/test/run.scm
@@ -178,10 +178,14 @@
(point->y p))))
(test-assert "should not be able to mutate immutable record fields using json-object-set!"
- (guard (_ (else #t))
+ (guard (e ((or (eq? e 'could-mutate)
+ (eq? e 'no-error)) #f)
+ (else #t))
(let ((p (point 1 2)))
- (json-object-set! p 'x #f)
- (point->x p))))
+ (set! p (json-object-set! p 'x #f))
+ (if (not (point->x p))
+ (raise 'could-mutate)
+ (raise 'no-error)))))
(test-assert "(json (object)) should meet the record predicate with only the correct keys"
(point? (json