Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 91f1d6b632
Fetching contributors…

Cannot retrieve contributors at this time

file 36 lines (33 sloc) 1.017 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
(ns lazytest.runner.console
  (:use lazytest.find
lazytest.suite
lazytest.test-case
lazytest.focus
lazytest.color)
  (:import lazytest.ExpectationFailed))

(defn- run-test-case [tc]
  (let [result (try-test-case tc)]
    (if (:pass? result)
      (print (colorize "." :green))
      (print (colorize "F" :red)))
    (flush)
    result))

(defn- run-test-seq [s]
  (let [results (doall (map (fn [x]
(cond (test-seq? x) (run-test-seq x)
(test-case? x) (run-test-case x)
:else (throw (IllegalArgumentException.
"Non-test given to run-suite."))))
s))]
    (suite-result s results)))

(defn run-tests
  "Runs tests defined in the given namespaces, with colored green dots
indicating passing tests and red 'F's indicating falied tests."
  [& namespaces]
  (let [ste (apply find-suite namespaces)
tree (filter-tree (expand-tree ste))]
    (when (focused? tree)
      (println "=== FOCUSED TESTS ONLY ==="))
    (let [result (run-test-seq tree)]
      (newline)
      result)))
Something went wrong with that request. Please try again.