Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0eb3b3c
Showing
4 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
pom.xml | ||
*jar | ||
/lib/ | ||
/classes/ | ||
.lein-failures | ||
.lein-deps-sum |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# lein-expectations | ||
|
||
A leiningen plugin to make running tests written using [expectations](https://github.com/jaycfields/expectations) library. | ||
|
||
## Usage | ||
|
||
In your project.clj: | ||
|
||
:dev-dependencies [[lein-expectations "0.0.1"]] | ||
|
||
or install as a plugin: | ||
|
||
$ lein plugin install lein-expectations "0.0.1" | ||
|
||
To run all your tests: | ||
|
||
$ lein expectations | ||
|
||
To run specific test namespaces: | ||
|
||
$ lein expectations my.test.namespace1 my.test.namespace2 | ||
|
||
To run test namespaces by regex: | ||
|
||
$ lein expectations my.tests.foo.* my.tests.bar.* | ||
|
||
## License | ||
|
||
Copyright (C) 2011 FIXME | ||
|
||
Distributed under the Eclipse Public License, the same as Clojure. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
(defproject lein-expectations "1.0.0-SNAPSHOT" | ||
:description "FIXME: write description" | ||
:dependencies [[org.clojure/clojure "1.2.1"]] | ||
:eval-in-leiningen true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
(ns leiningen.expectations | ||
(:use [leiningen.compile :only [eval-in-project]] | ||
[leiningen.util.ns :only [namespaces-in-dir]])) | ||
|
||
(defn matching-ns? | ||
[to-match] | ||
(fn [ns] | ||
(if (empty? to-match) | ||
ns | ||
(->> (for [m to-match | ||
:let [m (re-pattern m)]] | ||
(re-matches m (name ns))) | ||
(some identity))))) | ||
|
||
(defn expectations | ||
"Executes expectation tests in your project. | ||
By default all test namespaces will be run, or you can specify | ||
which namespaces to run using regex syntax to filter." | ||
[project & args] | ||
(let [ns (->> (namespaces-in-dir (:test-path project)) | ||
(filter (matching-ns? args)))] | ||
(eval-in-project | ||
project | ||
`(do | ||
(doseq [n# '~ns] | ||
(require n# :reload))) | ||
nil | ||
nil | ||
'(require ['expectations])))) | ||
|