Update tests for compile tests

The classpath was changed to use absolute paths for the checkout
dependencies.  They were pointing to the wrong directory since the
working directory would be the leiningen project instead of the
test project.

This adds the absolute paths for test projects back, as just
changing the classpath does not help for the other tasks.
This commit is contained in:
Nelson Morris 2011-12-02 22:52:49 -06:00
parent 24a89ee1d7
commit 5184b8017e
3 changed files with 18 additions and 7 deletions

View file

@ -23,7 +23,7 @@
(for [d (:checkout-deps-shares project [:source-path
:compile-path
:resources-path])]
(str (io/file "checkouts" (.getName dep) (d proj)))))))
(str (io/file (:root project) "checkouts" (.getName dep) (d proj)))))))
(defn resolve-dependencies
"Simply delegate regular dependencies to pomegranate. This will

View file

@ -3,8 +3,8 @@
(:use [clojure.test]
[clojure.java.io :only [file]]
[clojure.java.shell :only [with-sh-dir]]
[leiningen.core.eval :only [eval-in-project]]
[leiningen.compile]
[leiningen.core :only [read-project]]
[leiningen.test.helper :only [sample-project sample-failing-project
tricky-name-project dev-deps-project]]
[leiningen.util.file :only [delete-file-recursively]]))
@ -15,7 +15,7 @@
(delete-file-recursively
(file "test_projects" "sample_failing" "classes") true)
(f)))
(deftest test-compile
(is (zero? (compile sample-project)))
(is (.exists (file "test_projects" "sample"
@ -23,8 +23,8 @@
(is (pos? (compile sample-failing-project))))
(deftest test-plugin
(is (zero? (eval-in-project (assoc sample-project
:eval-in-leiningen true
(is (= :compiled (eval-in-project (assoc sample-project
:eval-in :leiningen
:skip-shutdown-agents true
:main nil)
'(do (require 'leiningen.compile)
@ -66,7 +66,7 @@
(deftest test-injection
(is (zero? (eval-in-project sample-project
'#'leiningen.util.injected/add-hook))))
'#'leiningen.core.injected/add-hook))))
(deftest test-compile-java-main
(is (zero? (compile dev-deps-project))))

View file

@ -8,9 +8,20 @@
(defn m2-dir [n v]
(io/file local-repo
(if (string? n) n (or (namespace n) (name n))) (name n) v))
(defn- prepend-root [project key root]
(assoc project key (str root java.io.File/separator (key project))))
(defn- read-test-project [name]
(project/read (format "test_projects/%s/project.clj" name)))
(let [project (project/read (format "test_projects/%s/project.clj" name))
root (:root project)]
(-> project
(prepend-root :source-path root)
(prepend-root :compile-path root)
(prepend-root :test-path root)
(prepend-root :resources-path root)
(prepend-root :dev-resources-path root)
(prepend-root :target-path root)
(prepend-root :native-path root))))
(def sample-project (read-test-project "sample"))