changes test to allow for multi directory testing
This commit is contained in:
parent
347652b226
commit
44ffe1b078
|
@ -2,19 +2,27 @@
|
||||||
(require better-test racket/runtime-path rackunit)
|
(require better-test racket/runtime-path rackunit)
|
||||||
|
|
||||||
(define (test-dir d)
|
(define (test-dir d)
|
||||||
(define program (string-append d "/prog.rkt"))
|
(define files
|
||||||
(define covered (string-append d "/coverage.rktl"))
|
(for*/list ([p (directory-list d)]
|
||||||
|
[s (in-value (path->string (build-path d p)))]
|
||||||
|
#:when (regexp-match #rx"\\.rkt$" s))
|
||||||
|
s))
|
||||||
|
(define covered
|
||||||
|
(for/hash ([f files])
|
||||||
|
(values f
|
||||||
|
(path->string (path-replace-suffix f ".rktl")))))
|
||||||
|
|
||||||
(test-files! program)
|
(apply test-files! files)
|
||||||
|
|
||||||
(define actual-coverage (hash-ref (get-test-coverage) program))
|
(define coverage (get-test-coverage))
|
||||||
(define expected-coverage (ranges->numbers (with-input-from-file covered read)))
|
(for ([(program cover) covered])
|
||||||
|
(define actual-coverage (hash-ref coverage program))
|
||||||
(test-begin
|
(define expected-coverage (ranges->numbers (with-input-from-file cover read)))
|
||||||
(for ([i expected-coverage])
|
(test-begin
|
||||||
(check-true (covered? i actual-coverage)
|
(for ([i expected-coverage])
|
||||||
(format "expected char ~a to be covered, but it was not, in: ~s"
|
(check-true (covered? i actual-coverage)
|
||||||
i d))))
|
(format "expected char ~a to be covered, but it was not, in: ~s"
|
||||||
|
i program)))))
|
||||||
|
|
||||||
(clear-coverage!))
|
(clear-coverage!))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user