(use-modules (srfi srfi-64) (weeb struct)) (test-begin "weeb-struct") (test-group "instantiation" (define-struct x y) (let ((p (make-struct 10 20))) (test-eqv 10 ((record-accessor 'x) p)) (test-eqv 20 ((record-accessor 'y) p)))) (test-group "with-accessors" (define-struct name age) (let ((p (make-struct "Alice" 30))) (with-accessors (p name age) (test-eqv "Alice" name) (test-eqv 30 age)))) (test-group "call-with-slots" (define-struct x y) (let ((c (make-struct 5 15))) (call-with-slots c (lambda (x y) (test-eqv 5 x) (test-eqv 15 y))))) (test-group "error-handling" (define-struct ) (test-error #t (make-struct 1))) (test-end "weeb-struct")