diff options
author | jakub-w <jakub-w@riseup.net> | 2021-04-22 15:13:55 +0200 |
---|---|---|
committer | Daniel Llorens <lloda@sarc.name> | 2021-05-05 12:29:47 +0200 |
commit | f10bc1a864c3ca63bf40062cf25aed8630d814ce (patch) | |
tree | d5917c683a367e661162f0d8c504fde9e70154ba /module/srfi | |
parent | 5969490f55e5a167a3eb2573a3c5241c0ce079f3 (diff) | |
download | guile-f10bc1a864c3ca63bf40062cf25aed8630d814ce.tar.gz |
[srfi-64] Fix a bug with test-end removing globally installed test-runner
* testing.scm (%test-begin, %test-end): When (test-runner-current) is
not set, create a new one like before but also add a finalizer that
will remove it after the test is finished. Previously the test runner
was getting unset unconditionally.
See https://srfi-email.schemers.org/srfi-64/msg/16468240/
Diffstat (limited to 'module/srfi')
-rw-r--r-- | module/srfi/srfi-64/testing.scm | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/module/srfi/srfi-64/testing.scm b/module/srfi/srfi-64/testing.scm index 37792cd0f..cdaab140f 100644 --- a/module/srfi/srfi-64/testing.scm +++ b/module/srfi/srfi-64/testing.scm @@ -278,7 +278,11 @@ (define (%test-begin suite-name count) (if (not (test-runner-current)) - (test-runner-current (test-runner-create))) + (let ((r (test-runner-create))) + (test-runner-current r) + (test-runner-on-final! r + (let ((old-final (test-runner-on-final r))) + (lambda (r) (old-final r) (test-runner-current #f)))))) (let ((runner (test-runner-current))) ((test-runner-on-group-begin runner) runner suite-name count) (%test-runner-skip-save! runner @@ -433,9 +437,8 @@ (%test-runner-fail-list! r (car (%test-runner-fail-save r))) (%test-runner-fail-save! r (cdr (%test-runner-fail-save r))) (%test-runner-count-list! r (cdr count-list)) - (cond ((null? (test-runner-group-stack r)) - ((test-runner-on-final r) r) - (test-runner-current #f)))))) + (if (null? (test-runner-group-stack r)) + ((test-runner-on-final r) r))))) (define-syntax test-group (syntax-rules () |