leiningen/test/test_run.clj
2010-10-28 21:12:24 -07:00

29 lines
892 B
Clojure

(ns test-run
(:use [clojure.test]
[clojure.java.io :only [delete-file]]
[leiningen.core :only [read-project]]
[leiningen.run]))
(def out-file "/tmp/lein-test")
(def project (binding [*ns* (find-ns 'leiningen.core)]
(read-project "test_projects/tricky-name/project.clj")))
(use-fixtures :each (fn [f]
(delete-file out-file :silently)
(f)))
(deftest test-basic
(is (zero? (run project "1")))
(is (= "nom:1" (slurp out-file))))
(deftest test-alt-main
(is (zero? (run project "-m" "org.domain.tricky-name.munch" "1")))
(is (= ":munched (\"1\")" (slurp out-file))))
(deftest test-aliases
(is (zero? (run project ":bbb" "1")))
(is (= "BRUNCH" (slurp out-file)))
(delete-file out-file :silently)
(is (zero? (run project ":mmm" "1")))
(is (= ":munched (\"1\")" (slurp out-file))))