Skip to content

Commit

Permalink
Make SRFI 64 test-group set up a runner if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
a2379 authored and shirok committed Jan 20, 2025
1 parent 4f06f3b commit fa75d3d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/srfi/64.scm
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
;;; Gauche specific hooks
;;;

;; Called when enetering a new group.
;; Called when entering a new group.
(define (gauche-test-group-hook runner suite-name)
;; [Gauche] SRFI-64's test-begin/test-end is effectively our grouping.
;; We indent the message according to te group nesting level
Expand Down Expand Up @@ -385,14 +385,15 @@
(define-syntax test-group
(syntax-rules ()
((test-group suite-name . body)
(let ((r (test-runner-current)))
(let ((r (or (test-runner-current) (test-runner-create))))
;; Ideally should also set line-number, if available.
(test-result-alist! r (list (cons 'test-name suite-name)))
(if (%test-should-execute r)
(dynamic-wind
(lambda () (test-begin suite-name))
(lambda () . body)
(lambda () (test-end suite-name))))))))
(test-with-runner
r (dynamic-wind
(lambda () (test-begin suite-name))
(lambda () . body)
(lambda () (test-end suite-name)))))))))

(define-syntax test-group-with-cleanup
(syntax-rules ()
Expand Down

0 comments on commit fa75d3d

Please sign in to comment.