Skip to content

Commit

Permalink
Update leiningen.core.main tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
technomancy committed Jan 16, 2012
1 parent d8190b1 commit d5ceec1
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
5 changes: 5 additions & 0 deletions leiningen-core/test/leiningen/bluuugh.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(ns leiningen.bluuugh)

(defn ^:no-project-needed bluuugh
[project]
(println "This is a dummy task for tests."))
40 changes: 40 additions & 0 deletions leiningen-core/test/leiningen/core/test/main.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
(ns leiningen.core.test.main
(:use [clojure.test]
[leiningen.core.main]))

(deftest test-group-args-empty-args
(is (= [[]] (group-args []))))

(deftest test-group-args-single-task
(is (= [["pom"]] (group-args ["pom"]))))

(deftest test-group-args-without-args
(is (= [["clean"] ["deps"] ["test"]]
(group-args ["clean," "deps," "test"]))))

(deftest test-group-args-with-args
(is (= [["test" "test-core"] ["version"]]
(group-args ["test" "test-core," "version"]))))

(deftest test-group-args-with-long-chain
(is (= [["help" "help"] ["help" "version"] ["version"]
["test" "test-compile"]]
(group-args '("help" "help," "help" "version," "version,"
"test" "test-compile")))))

(deftest test-matching-arity
(is (not (matching-arity? (resolve-task "bluuugh") ["bogus" "arg" "s"])))
(is (matching-arity? (resolve-task "bluuugh") []))
(is (matching-arity? (resolve-task "var-args") []))
(is (matching-arity? (resolve-task "var-args") ["test-core" "hey"]))
(is (not (matching-arity? (resolve-task "one-or-two") [])))
(is (matching-arity? (resolve-task "one-or-two") ["clojure"]))
(is (matching-arity? (resolve-task "one-or-two") ["clojure" "2"]))
(is (not (matching-arity? (resolve-task "one-or-two") ["clojure" "2" "3"]))))

(deftest test-version-satisfies
(is (version-satisfies? "1.5.0" "1.4.2"))
(is (not (version-satisfies? "1.4.2" "1.5.0")))
(is (version-satisfies? "1.2.3" "1.1.1"))
(is (version-satisfies? "1.2.0" "1.2"))
(is (version-satisfies? "1.2" "1")))
6 changes: 6 additions & 0 deletions leiningen-core/test/leiningen/one_or_two.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(ns leiningen.one-or-two)

(defn one-or-two
"Dummy task for tests"
([project one])
([project one two]))
4 changes: 4 additions & 0 deletions leiningen-core/test/leiningen/var_args.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
(ns leiningen.var-args)

(defn var-args [project & args]
(println "a dummy task for tests."))

0 comments on commit d5ceec1

Please sign in to comment.