Adding module**, when-testing, and raco test

original commit: b73444a0f3
This commit is contained in:
Jay McCarthy 2012-03-09 15:54:07 -07:00
parent f2dbacc73f
commit 9741ae6d98
6 changed files with 42 additions and 0 deletions

View File

@ -6,6 +6,7 @@
("pack" compiler/commands/pack "pack files/collections into a .plt archive" 10) ("pack" compiler/commands/pack "pack files/collections into a .plt archive" 10)
("unpack" compiler/commands/unpack "unpack files/collections from a .plt archive" 10) ("unpack" compiler/commands/unpack "unpack files/collections from a .plt archive" 10)
("decompile" compiler/commands/decompile "decompile bytecode" #f) ("decompile" compiler/commands/decompile "decompile bytecode" #f)
("test" compiler/commands/test "run all tests associated with a set of paths" #f)
("expand" compiler/commands/expand "macro-expand source" #f) ("expand" compiler/commands/expand "macro-expand source" #f)
("distribute" compiler/commands/exe-dir "prepare executable(s) in a directory for distribution" #f) ("distribute" compiler/commands/exe-dir "prepare executable(s) in a directory for distribution" #f)
("ctool" compiler/commands/ctool "compile and link C-based extensions" #f) ("ctool" compiler/commands/ctool "compile and link C-based extensions" #f)

View File

@ -0,0 +1,28 @@
#lang racket/base
(require racket/cmdline
racket/match
racket/path
raco/command-name)
(define do-test
(match-lambda
[(? string? s)
(do-test (string->path s))]
[(? path? p)
(cond
[(directory-exists? p)
(for-each
(λ (dp)
(do-test (build-path p dp)))
(directory-list p))]
[(file-exists? p)
(define mod `(submod (file ,(path->string p)) test))
(when (module-declared? mod #t)
(dynamic-require mod #f))]
[else
(error 'test "Given path ~e does not exist" p)])]))
(command-line
#:program (short-program+command-name)
#:args files+directories
(for-each do-test files+directories))

View File

@ -0,0 +1,4 @@
#lang racket/base
(error 'dont-run)
(module test racket/base
(printf "a\n"))

View File

@ -0,0 +1,4 @@
#lang racket/base
(error 'dont-run)
(module test racket/base
(printf "b\n"))

View File

@ -0,0 +1,4 @@
#lang racket/base
(error 'dont-run)
(module test racket/base
(printf "c\n"))

View File

@ -0,0 +1 @@
#lang racket/base