2009-11-14 23:00:46 +00:00
|
|
|
(ns test-compile
|
2010-09-22 03:16:56 +00:00
|
|
|
(:refer-clojure :exclude [compile])
|
|
|
|
(:use [leiningen.compile] :reload)
|
2009-11-14 23:00:46 +00:00
|
|
|
(:use [clojure.test]
|
2010-09-09 04:05:03 +00:00
|
|
|
[clojure.java.io :only [file]]
|
|
|
|
[clojure.java.shell :only [with-sh-dir sh]]
|
2010-09-22 03:16:56 +00:00
|
|
|
[leiningen.core :only [read-project]]
|
2010-09-09 04:05:03 +00:00
|
|
|
[leiningen.util.file :only [delete-file-recursively]]))
|
2009-11-14 23:00:46 +00:00
|
|
|
|
2010-09-22 03:16:56 +00:00
|
|
|
(use-fixtures :each (fn [f]
|
|
|
|
(delete-file-recursively
|
|
|
|
(file "test_projects" "sample" "classes") true)
|
|
|
|
(delete-file-recursively
|
|
|
|
(file "test_projects" "sample_failing" "classes") true)
|
|
|
|
(f)))
|
|
|
|
|
|
|
|
(defn make-project [root]
|
|
|
|
(binding [*ns* (find-ns 'leiningen.core)]
|
|
|
|
(read-project (.getAbsolutePath (file root "project.clj")))))
|
|
|
|
|
2009-11-14 23:00:46 +00:00
|
|
|
(deftest test-compile
|
2010-09-22 03:16:56 +00:00
|
|
|
(is (zero? (compile (make-project "test_projects/sample"))))
|
2010-08-25 01:14:24 +00:00
|
|
|
(is (.exists (file "test_projects" "sample"
|
|
|
|
"classes" "nom" "nom" "nom.class")))
|
2010-09-22 03:16:56 +00:00
|
|
|
(is (pos? (compile (make-project "test_projects/sample_failing")))))
|
2010-10-24 21:28:26 +00:00
|
|
|
|
|
|
|
(deftest test-plugin
|
|
|
|
(is (= (eval-in-project (assoc (make-project "test_projects/sample")
|
|
|
|
:eval-in-leiningen true
|
|
|
|
:main nil)
|
|
|
|
'(do (require 'leiningen.compile)
|
|
|
|
:compiled))
|
|
|
|
:compiled)))
|