Skip to content

Commit

Permalink
Workaround for :test-selectors and #878.
Browse files Browse the repository at this point in the history
Gotta love how quote silently discards metadata wooooo.
  • Loading branch information
technomancy committed Feb 26, 2013
1 parent 66ed481 commit ff0f5a6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bin/lein
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Ensure this file is executable via chmod a+x lein, then place it
# Ensure this file is executable via `chmod a+x lein`, then place it
# somewhere on your $PATH, like ~/bin. The rest of Leiningen will be
# installed upon first run into the ~/.lein/self-installs directory.

Expand Down
2 changes: 2 additions & 0 deletions bin/release
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ echo "Also deploy this release of leiningen-core to Clojars."
# git push && git push --tags
# git checkout preview && git merge master && git push
# Drop version back to SNAPSHOT

# TODO: update windows install instructions on leiningen.org for 2.1
3 changes: 2 additions & 1 deletion leiningen-core/src/leiningen/core/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@
(atom {:default [:base :user :provided :dev]
:base {:resource-paths ["dev-resources"]
:jvm-opts ["-XX:+TieredCompilation" "-XX:TieredStopAtLevel=1"]
:test-selectors {:default '(constantly true)}
:test-selectors {:default (with-meta '(constantly true)
{:displace true})}
:checkout-deps-shares [:source-paths
:resource-paths
:compile-path]}
Expand Down
7 changes: 6 additions & 1 deletion leiningen-core/test/leiningen/core/test/project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,12 @@
:profiles
{:bar {:foo ^{:replace true, :a 3, :b 2} [3 4]}}}))
(merge-profiles [:bar])
:foo meta))))))
:foo meta))))
(testing "that built-in ^:replace values are properly replaced"
(is (= '(constantly false)
(-> (make {:test-selectors {:default '(constantly false)}})
(merge-profiles [:base])
:test-selectors :default))))))

(def test-profiles (atom {:qa {:resource-paths ["/etc/myapp"]}
:test {:resource-paths ["test/hi"]}
Expand Down
5 changes: 3 additions & 2 deletions src/leiningen/test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

(defn- form-for-select-namespaces [namespaces selectors]
`(reduce (fn [acc# [f# args#]]
(if (vector? f#)
(if (vector? f#)
(filter #(apply (first f#) % args#) acc#)
acc#))
'~namespaces ~selectors))
Expand Down Expand Up @@ -172,7 +172,8 @@ specified test. A default :all test-selector is available to run all tests."
(let [project (project/merge-profiles project [:leiningen/test :test])
[nses selectors] (read-args tests project)
form (form-for-testing-namespaces nses nil (vec selectors))]
(try (when-let [n (eval/eval-in-project project form '(require 'clojure.test))]
(try (when-let [n (eval/eval-in-project project form
'(require 'clojure.test))]
(when (pos? n)
(throw (ex-info "Tests Failed" {:exit-code n}))))
(catch clojure.lang.ExceptionInfo e
Expand Down

0 comments on commit ff0f5a6

Please sign in to comment.