raco test: run ".scrbl" files by default; check cmdline args for all files
To test a file that ends in".ss", ".scm", etc., add a
`test-command-line-arguments` entry to an "info.rkt" file.
original commit: e44b15c032
This commit is contained in:
parent
74702c1f94
commit
51e419cfc2
|
@ -17,6 +17,10 @@
|
||||||
setup/collects
|
setup/collects
|
||||||
setup/getinfo)
|
setup/getinfo)
|
||||||
|
|
||||||
|
(define rx:default-suffixes #rx#"\\.(?:rkt|scrbl)$")
|
||||||
|
;; For any other file suffix, a `test-command-line-arguments`
|
||||||
|
;; entry is required in "info.rkt".
|
||||||
|
|
||||||
(define submodules '()) ; '() means "default"
|
(define submodules '()) ; '() means "default"
|
||||||
(define first-avail? #f)
|
(define first-avail? #f)
|
||||||
(define run-anyways? #t)
|
(define run-anyways? #t)
|
||||||
|
@ -384,7 +388,8 @@
|
||||||
m))
|
m))
|
||||||
(apply string-append
|
(apply string-append
|
||||||
(for/list ([a (in-list args)])
|
(for/list ([a (in-list args)])
|
||||||
(format " ~s" (format "~a" a))))))
|
(format " ~s" (format "~a" a)))))
|
||||||
|
(flush-output))
|
||||||
id)))
|
id)))
|
||||||
(begin0
|
(begin0
|
||||||
(dynamic-require* mod 0 args try-config?)
|
(dynamic-require* mod 0 args try-config?)
|
||||||
|
@ -419,7 +424,8 @@
|
||||||
#:sema continue-sema)))]
|
#:sema continue-sema)))]
|
||||||
[(and (file-exists? p)
|
[(and (file-exists? p)
|
||||||
(or (not check-suffix?)
|
(or (not check-suffix?)
|
||||||
(regexp-match #rx#"\\.rkt$" (path->bytes p)))
|
(regexp-match rx:default-suffixes p)
|
||||||
|
(get-cmdline p #f))
|
||||||
(not (omit-path? p)))
|
(not (omit-path? p)))
|
||||||
(define args (get-cmdline p))
|
(define args (get-cmdline p))
|
||||||
(parameterize ([current-directory (let-values ([(base name dir?) (split-path p)])
|
(parameterize ([current-directory (let-values ([(base name dir?) (split-path p)])
|
||||||
|
@ -616,9 +622,9 @@
|
||||||
(and (path? base)
|
(and (path? base)
|
||||||
(omit-path? base))))))
|
(omit-path? base))))))
|
||||||
|
|
||||||
(define (get-cmdline p)
|
(define (get-cmdline p [default null])
|
||||||
(let ([p (normalize-info-path p)])
|
(let ([p (normalize-info-path p)])
|
||||||
(hash-ref command-line-arguments p null)))
|
(hash-ref command-line-arguments p default)))
|
||||||
|
|
||||||
;; --------------------------------------------------
|
;; --------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user