File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 5
5
[clojure.tools.cli :as cli])
6
6
(:refer-clojure :exclude [test]))
7
7
8
+ (defn- require-and-resolve
9
+ [sym]
10
+ (require (symbol (namespace sym)))
11
+ (resolve sym))
12
+
8
13
(defn- ns-filter
9
14
[{:keys [namespace namespace-regex]}]
10
15
(let [[include-ns include-regexes]
66
71
nses (->> dirs
67
72
(map io/file)
68
73
(mapcat find/find-namespaces-in-dir))
69
- nses (filter (ns-filter options) nses)]
74
+ nses (filter (ns-filter options) nses)
75
+ with-output (require-and-resolve
76
+ (:with-output options 'clojure.test/with-test-out))]
77
+ (when (not with-output)
78
+ (throw (ex-info " Specified with-output not found" {})))
70
79
(println (format " \n Running tests in %s" dirs))
71
80
(dorun (map require nses))
72
81
(try
73
82
(filter-vars! nses (var-filter options))
74
- (apply test/run-tests (filter contains-tests? nses))
83
+ (binding [test/*test-out* (if (:output options)
84
+ (java.io.FileWriter. (:output options))
85
+ test/*test-out*)]
86
+ (let [test-nses (seq (filter contains-tests? nses))]
87
+ (eval `(~with-output (apply test/run-tests (quote ~test-nses))))))
75
88
(finally
76
89
(restore-vars! nses)))))
77
90
102
115
[" -e" " --exclude KEYWORD" " Exclude tests with this metadata keyword."
103
116
:parse-fn parse-kw
104
117
:assoc-fn accumulate]
118
+ [" -w" " --with-output SYMBOL" " Symbol indicating the with output wrapper."
119
+ :parse-fn symbol]
120
+ [" -o" " --output STRING" " String indicating path to file to write output to." ]
105
121
[" -H" " --test-help" " Display this help message" ]])
106
122
107
123
(defn- help
You can’t perform that action at this time.
0 commit comments