From 35ca4b65f9849f50090f01dfe4f5e5501fc09ae8 Mon Sep 17 00:00:00 2001 From: Robby Zambito Date: Thu, 23 Feb 2023 09:31:11 -0500 Subject: Update test to avoid undefined behavior --- test/run.scm | 10 +++++++--- 1 file 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 -- cgit