Skip to content

Commit fa75d3d

Browse files
a2379shirok
authored andcommittedJan 20, 2025·
Make SRFI 64 test-group set up a runner if needed
1 parent 4f06f3b commit fa75d3d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed
 

‎lib/srfi/64.scm

+7-6
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@
141141
;;; Gauche specific hooks
142142
;;;
143143

144-
;; Called when enetering a new group.
144+
;; Called when entering a new group.
145145
(define (gauche-test-group-hook runner suite-name)
146146
;; [Gauche] SRFI-64's test-begin/test-end is effectively our grouping.
147147
;; We indent the message according to te group nesting level
@@ -385,14 +385,15 @@
385385
(define-syntax test-group
386386
(syntax-rules ()
387387
((test-group suite-name . body)
388-
(let ((r (test-runner-current)))
388+
(let ((r (or (test-runner-current) (test-runner-create))))
389389
;; Ideally should also set line-number, if available.
390390
(test-result-alist! r (list (cons 'test-name suite-name)))
391391
(if (%test-should-execute r)
392-
(dynamic-wind
393-
(lambda () (test-begin suite-name))
394-
(lambda () . body)
395-
(lambda () (test-end suite-name))))))))
392+
(test-with-runner
393+
r (dynamic-wind
394+
(lambda () (test-begin suite-name))
395+
(lambda () . body)
396+
(lambda () (test-end suite-name)))))))))
396397

397398
(define-syntax test-group-with-cleanup
398399
(syntax-rules ()

0 commit comments

Comments
 (0)
Please sign in to comment.