now catching errors from running files (Issue #5)
This commit is contained in:
parent
471105c343
commit
afea19c4b8
|
@ -8,5 +8,5 @@ before_install:
|
|||
|
||||
script:
|
||||
- /usr/racket/bin/raco pkg install $TRAVIS_BUILD_DIR
|
||||
- /usr/racket/bin/raco test $TRAVIS_BUILD_DIR
|
||||
- /usr/racket/bin/raco test -Q $TRAVIS_BUILD_DIR
|
||||
- /usr/racket/bin/raco cover -c coveralls -d $TRAVIS_BUILD_DIR/coverage -p $TRAVIS_BUILD_DIR
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
unstable/syntax
|
||||
racket/runtime-path
|
||||
rackunit
|
||||
unstable/error
|
||||
"private/shared.rkt")
|
||||
|
||||
|
||||
|
@ -40,6 +41,9 @@
|
|||
(for ([p paths])
|
||||
(vprintf "running file: ~s\n" p)
|
||||
(define old-check (current-check-handler))
|
||||
(with-handlers ([void (lambda (x)
|
||||
(set! tests-failed #t)
|
||||
(error-display x))])
|
||||
(parameterize* ([current-namespace ns]
|
||||
[current-check-handler
|
||||
(lambda x
|
||||
|
@ -50,7 +54,7 @@
|
|||
(namespace-require `(file ,p))
|
||||
(define submod `(submod (file ,p) test))
|
||||
(when (module-declared? submod)
|
||||
(namespace-require submod))))
|
||||
(namespace-require submod)))))
|
||||
(not tests-failed)))
|
||||
|
||||
(define (make-better-test-compile)
|
||||
|
|
2
info.rkt
2
info.rkt
|
@ -10,3 +10,5 @@
|
|||
'(("cover" (submod cover/raco main) "a code coverage tool" 30)))
|
||||
|
||||
(define scribblings '(("scribblings/cover.scrbl" (multi-page))))
|
||||
|
||||
(define test-omit-paths (list "tests/error-file.rkt"))
|
||||
|
|
2
tests/error-file.rkt
Normal file
2
tests/error-file.rkt
Normal file
|
@ -0,0 +1,2 @@
|
|||
#lang racket
|
||||
(error "this is supposed to happend")
|
18
tests/error.rkt
Normal file
18
tests/error.rkt
Normal file
|
@ -0,0 +1,18 @@
|
|||
#lang racket
|
||||
(require "../main.rkt" rackunit)
|
||||
|
||||
(test-begin
|
||||
(after
|
||||
(define (do-test files)
|
||||
(apply test-files! files)
|
||||
(define c (get-test-coverage))
|
||||
(define covered
|
||||
(map (compose path->string last explode-path) files))
|
||||
(for-each
|
||||
(lambda (x) (check-not-false (member x covered)))
|
||||
files)
|
||||
(clear-coverage!))
|
||||
(define files (list "error-file.rkt" "prog.rkt"))
|
||||
(do-test files)
|
||||
(do-test (reverse files))
|
||||
(clear-coverage!)))
|
Loading…
Reference in New Issue
Block a user