Skip to content

Commit

Permalink
Better unquote testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Nov 12, 2010
1 parent 26f315f commit e75c6d3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/leiningen/core.clj
Expand Up @@ -11,7 +11,7 @@
(walk (fn [item]
(cond (and (seq? item) (= `unquote (first item))) (second item)
;; needed if we want fn literals to be usable by eval-in-project
(or (list? item) (symbol? item)) (list 'quote item)
(or (seq? item) (symbol? item)) (list 'quote item)
:else (unquote-project item)))
identity
args))
Expand Down
15 changes: 8 additions & 7 deletions test/test_core.clj
@@ -1,13 +1,7 @@
(ns test-core
(:require leiningen.core :reload-all)
(:use [leiningen.core] :reload-all)
(:use [clojure.test]))

;; testing private vars is awesome!

(def make-groups @#'leiningen.core/make-groups)

(def matching-arity? @#'leiningen.core/matching-arity?)

(deftest test-make-groups-empty-args
(is (= [[]] (make-groups []))))

Expand Down Expand Up @@ -37,3 +31,10 @@
(is (matching-arity? "version" nil []))
(is (not (matching-arity? "test" nil [])))
(is (not (matching-arity? "test" nil ["test-core"]))))

(deftest test-unquote
(let [project (binding [*ns* (find-ns 'leiningen.core)]
(read-project "test_projects/sample/project.clj"))]
(is (= ['org.clojure/clojure "1.1.0-master-SNAPSHOT"]
(first (:dependencies project))))
(is (= '(fn [_] (> (rand) 0.5))))))
1 change: 1 addition & 0 deletions test_projects/sample/project.clj
Expand Up @@ -16,4 +16,5 @@
:bin "bin/nom"}
:test-selectors {:integration :integration
:default (complement :integration)
:random (fn [_] (> (rand) ~(float 1/2)))
:all (constantly true)})

0 comments on commit e75c6d3

Please sign in to comment.