Skip to content

Commit

Permalink
[srfi64-extras] don't customise srfi64 test-runner
Browse files Browse the repository at this point in the history
it was causing more trouble than it's worth
  • Loading branch information
christopherlam committed Apr 29, 2024
1 parent 8fb5a6a commit 06d679a
Showing 1 changed file with 11 additions and 26 deletions.
37 changes: 11 additions & 26 deletions bindings/guile/test/srfi64-extras.scm
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,14 @@
(use-modules (srfi srfi-64))

(export gnc:test-runner)
(define (gnc:test-runner)
(let ((runner (test-runner-null))
(num-passed 0)
(num-failed 0))
(test-runner-on-test-end! runner
(lambda (runner)
(format #t "[~a] line:~a, test: ~a\n"
(test-result-ref runner 'result-kind)
(test-result-ref runner 'source-line)
(test-runner-test-name runner))
(case (test-result-kind runner)
((pass xpass) (set! num-passed (1+ num-passed)))
((fail xfail)
(if (test-result-ref runner 'expected-value)
(format #t "~a\n -> expected: ~s\n -> obtained: ~s\n"
(string-join (test-runner-group-path runner) "/")
(test-result-ref runner 'expected-value)
(test-result-ref runner 'actual-value)))
(set! num-failed (1+ num-failed)))
(else #t))))
(test-runner-on-final! runner
(lambda (runner)
(format #t "Source:~a\npass = ~a, fail = ~a\n"
(test-result-ref runner 'source-file) num-passed num-failed)
(zero? num-failed)))
runner))
(define gnc:test-runner test-runner-simple)

;; note this file contained a customisation for the srfi-64
;; test-runner, logging all passing and failing tests, and calling
;; (exit num-failed-tests) which would then be reported by "ninja
;; check" as a test failure. Unfortunately the guile coverage test
;; required removing the premature exit with exitlevel, therefore
;; ninja wouldn't be capable of detecting test failures anymore. This
;; is now a stub module to use the default test-runner-simple as
;; provided in srfi-64, which returns non-zero exitlevel on test
;; failures.

0 comments on commit 06d679a

Please sign in to comment.