Skip to content

Commit aa272c8

Browse files
committed
Define test-with-runner macro before its use
Unlike R6RS, R[57]RS don't have explicit definition of macro expansion process. Some implementations may require a macro to be defined before its use appear, even in rhs of definitions.
1 parent 09d497d commit aa272c8

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

testing.scm

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,15 @@
921921
(test-result-alist! r '())
922922
(%test-error r #t expr)))))))
923923

924+
(define-syntax test-with-runner
925+
(syntax-rules ()
926+
((test-with-runner runner form ...)
927+
(let ((saved-runner (test-runner-current)))
928+
(dynamic-wind
929+
(lambda () (test-runner-current runner))
930+
(lambda () form ...)
931+
(lambda () (test-runner-current saved-runner)))))))
932+
924933
(define (test-apply first . rest)
925934
(if (test-runner? first)
926935
(test-with-runner first (apply test-apply rest))
@@ -940,15 +949,6 @@
940949
(test-with-runner r (apply test-apply first rest))
941950
((test-runner-on-final r) r))))))
942951

943-
(define-syntax test-with-runner
944-
(syntax-rules ()
945-
((test-with-runner runner form ...)
946-
(let ((saved-runner (test-runner-current)))
947-
(dynamic-wind
948-
(lambda () (test-runner-current runner))
949-
(lambda () form ...)
950-
(lambda () (test-runner-current saved-runner)))))))
951-
952952
;;; Predicates
953953

954954
(define (%test-match-nth n count)

0 commit comments

Comments
 (0)