added -p and -c flags for Issue #18
This commit is contained in:
parent
1f9f11147c
commit
52bacd73d3
2
info.rkt
2
info.rkt
|
@ -2,7 +2,7 @@
|
|||
(define name "cover")
|
||||
(define collection "cover")
|
||||
(define deps '("base" "errortrace-lib" "rackunit-lib"
|
||||
"syntax-color-lib"))
|
||||
"syntax-color-lib" "compiler-lib"))
|
||||
(define build-deps
|
||||
'("racket-doc" "scribble-lib" "typed-racket-doc"))
|
||||
|
||||
|
|
19
raco.rkt
19
raco.rkt
|
@ -6,7 +6,10 @@
|
|||
racket/function
|
||||
"main.rkt"
|
||||
(only-in "private/contracts.rkt" coverage-gen/c)
|
||||
"private/shared.rkt")
|
||||
"private/shared.rkt"
|
||||
(only-in (submod compiler/commands/test paths) collection-paths)
|
||||
pkg/lib)
|
||||
|
||||
|
||||
(module+ test
|
||||
(require rackunit racket/runtime-path racket/set))
|
||||
|
@ -18,6 +21,7 @@
|
|||
(define exclude-paths '())
|
||||
(define include-exts '())
|
||||
(define submod 'test)
|
||||
(define expansion-type 'dir)
|
||||
|
||||
(define args
|
||||
(command-line
|
||||
|
@ -45,9 +49,20 @@
|
|||
[("-s" "--submodule") s
|
||||
"Run the given submodule instead of the test submodule"
|
||||
(set! submod (string->symbol s))]
|
||||
#:once-any
|
||||
[("-c" "--collection") "Interprets the arguments as collections whose content should be tested (in the same way as directory content)."
|
||||
(set! expansion-type 'collection)]
|
||||
[("-p" "--package") "Interprets the arguments as packages whose contents should be tested (in the same way as directory content)."
|
||||
(set! expansion-type 'package)]
|
||||
#:args (file . files)
|
||||
(cons file files)))
|
||||
(define files (expand-directories args include-exts))
|
||||
(define path-expand
|
||||
(case expansion-type
|
||||
[(dir) expand-directories]
|
||||
[(collection) (lambda (a b) (expand-directories (flatten (map collection-paths a)) b))]
|
||||
[(package) (lambda (a b)
|
||||
(expand-directories (map pkg-directory a) b))]))
|
||||
(define files (path-expand args include-exts))
|
||||
(define generate-coverage
|
||||
(hash-ref (get-formats) output-format
|
||||
(lambda _ (error 'cover "given unknown coverage output format: ~s" output-format))))
|
||||
|
|
|
@ -38,4 +38,11 @@ The @exec{raco cover} command accepts the following flags:
|
|||
--- enable verbose logging}
|
||||
@item{@Flag{s} or @DFlag{submod}
|
||||
--- run the given submodule instead of the test submodule.}
|
||||
]
|
||||
@item{@Flag{c} or @DFlag{collection}
|
||||
--- Interprets the arguments as collections whose content should be
|
||||
tested (in the same way as directory content).}
|
||||
@item{@Flag{p} or @DFlag{package}
|
||||
--- Interprets the arguments as packages whose contents should be tested
|
||||
(in the same way as directory content). All package scopes are searched
|
||||
for the first, most specific
|
||||
@tech[#:doc '(lib "pkg/scribblings/pkg.scrbl")]{package scope}.}]
|
||||
|
|
Loading…
Reference in New Issue
Block a user