doc corrections and improvements related to submodules
In particular, add `module+' to the Guide.
original commit: 876bc6f02b
This commit is contained in:
parent
95ed87abd4
commit
32da9b50bb
|
@ -7,38 +7,37 @@
|
||||||
(define submodule 'test)
|
(define submodule 'test)
|
||||||
(define run-anyways? #f)
|
(define run-anyways? #f)
|
||||||
|
|
||||||
(define do-test
|
(define (do-test e [check-suffix? #f])
|
||||||
(match-lambda
|
(match e
|
||||||
[(? string? s)
|
[(? string? s)
|
||||||
(do-test (string->path s))]
|
(do-test (string->path s))]
|
||||||
[(? path? p)
|
[(? path? p)
|
||||||
(define ps (path->string p))
|
(cond
|
||||||
(cond
|
|
||||||
[(directory-exists? p)
|
[(directory-exists? p)
|
||||||
(for-each
|
(for-each
|
||||||
(λ (dp)
|
(λ (dp)
|
||||||
(do-test (build-path p dp)))
|
(do-test (build-path p dp) #t))
|
||||||
(directory-list p))]
|
(directory-list p))]
|
||||||
[(and (file-exists? p)
|
[(and (file-exists? p)
|
||||||
(regexp-match #rx"\\.rkt$" ps))
|
(or (not check-suffix?)
|
||||||
(define fmod `(file ,ps))
|
(regexp-match #rx#"\\.rkt$" (path->bytes p))))
|
||||||
(define mod `(submod ,fmod ,submodule))
|
(define mod `(submod ,p ,submodule))
|
||||||
(cond
|
(cond
|
||||||
[(module-declared? mod #t)
|
[(module-declared? mod #t)
|
||||||
(dynamic-require mod #f)]
|
(dynamic-require mod #f)]
|
||||||
[(and run-anyways? (module-declared? fmod #t))
|
[(and run-anyways? (module-declared? p #t))
|
||||||
(dynamic-require fmod #f)])]
|
(dynamic-require p #f)])]
|
||||||
[(not (file-exists? p))
|
[(not (file-exists? p))
|
||||||
(error 'test "Given path ~e does not exist" p)])]))
|
(error 'test "Given path ~e does not exist" p)])]))
|
||||||
|
|
||||||
(command-line
|
(command-line
|
||||||
#:program (short-program+command-name)
|
#:program (short-program+command-name)
|
||||||
#:once-each
|
#:once-each
|
||||||
[("--submodule" "-s") submodule-str
|
[("--submodule" "-s") name
|
||||||
"Determines which submodule to load"
|
"Runs submodule <name> (defaults to `test')"
|
||||||
(set! submodule (string->symbol submodule-str))]
|
(set! submodule (string->symbol name))]
|
||||||
[("--run-if-absent" "-r")
|
[("--run-if-absent" "-r")
|
||||||
"When set, raco test will require the default module if the given submodule is not present."
|
"Require base module if submodule is absent"
|
||||||
(set! run-anyways? #t)]
|
(set! run-anyways? #t)]
|
||||||
#:args files+directories
|
#:args file-or-directory
|
||||||
(for-each do-test files+directories))
|
(for-each do-test file-or-directory))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user