Permalink
Browse files

Fix tests for new pomegranate and newnew versions.

  • Loading branch information...
1 parent 15e1213 commit 30c0fdbafd838eeabf9a1d5645e3f78a710f990d @technomancy technomancy committed Apr 10, 2012
Showing with 47 additions and 38 deletions.
  1. +10 −2 test/leiningen/test/help.clj
  2. +4 −3 test/leiningen/test/new.clj
  3. +33 −33 test/leiningen/test/pom.clj
@@ -8,9 +8,17 @@
(def formatted-help @#'leiningen.help/formatted-help)
(def resolve-task @#'leiningen.help/resolve-task)
-(deftest blank-subtask-help-for-new
+(deftest blank-subtask-help-for-pom
+ (let [subtask-pom (apply subtask-help-for (resolve-task "pom"))]
+ (is (= nil subtask-pom))))
+
+(deftest subtask-help-for-new
(let [subtask-help (apply subtask-help-for (resolve-task "new"))]
- (is (= nil subtask-help))))
+ (is (re-find #"Subtasks available" subtask-help))
+ (is (re-find #"default\s+A general project template." subtask-help))
+ (is (re-find #"plugin\s+A leiningen plugin project template." subtask-help))
+ (is (re-find #"template\s+A meta-template for 'lein new' templates."
+ subtask-help))))
(deftest test-docstring-formatting
(is (= "This is an
@@ -9,11 +9,12 @@
(is (= #{"README.md" "project.clj" "src" "core.clj" "test"
"test_new_proj" "core_test.clj" ".gitignore"}
(set (map (memfn getName) (rest (file-seq (file "test-new-proj")))))))
- (delete-file-recursively (file "test-new-proj") false))
+ (delete-file-recursively (file "test-new-proj") :silently))
(deftest test-new-with-group-and-project-name
(leiningen.new/new nil "orgname/a-project")
(is (= #{"README.md" "project.clj" "orgname" "src" "core.clj" "test"
"a_project" "core_test.clj" ".gitignore"}
- (set (map (memfn getName) (rest (file-seq (file "a-project")))))))
- (delete-file-recursively (file "a-project") false))
+ (set (map (memfn getName)
+ (rest (file-seq (file "orgname.a-project")))))))
+ (delete-file-recursively (file "orgname.a-project") :silently))
@@ -93,13 +93,13 @@
"no extensions")
(is (= "target/classes" (first-in xml [:project :build :outputDirectory]))
"classes directory is included")
- (is (= ["org.clojure" "rome" "ring"]
+ (is (= ["clojure-complete" "org.clojure" "rome" "ring"]
(map #(first-in % [:dependency :groupId])
(deep-content xml [:project :dependencies]))))
- (is (= ["clojure" "rome" "ring"]
+ (is (= ["clojure-complete" "clojure" "rome" "ring"]
(map #(first-in % [:dependency :artifactId])
(deep-content xml [:project :dependencies]))))
- (is (= ["1.1.0" "0.9" "1.0.0"]
+ (is (= ["0.2.1" "1.1.0" "0.9" "1.0.0"]
(map #(first-in % [:dependency :version])
(deep-content xml [:project :dependencies]))))))
@@ -109,16 +109,16 @@
sample-project
:test
{:dependencies '[[peridot "0.0.5"]]})))]
- (is (= ["org.clojure" "rome" "ring" "peridot"]
+ (is (= ["clojure-complete" "org.clojure" "rome" "ring" "peridot"]
(map #(first-in % [:dependency :groupId])
(deep-content xml [:project :dependencies]))))
- (is (= ["clojure" "rome" "ring" "peridot"]
+ (is (= ["clojure-complete" "clojure" "rome" "ring" "peridot"]
(map #(first-in % [:dependency :artifactId])
(deep-content xml [:project :dependencies]))))
- (is (= ["1.1.0" "0.9" "1.0.0" "0.0.5"]
+ (is (= ["0.2.1" "1.1.0" "0.9" "1.0.0" "0.0.5"]
(map #(first-in % [:dependency :version])
(deep-content xml [:project :dependencies]))))
- (is (= [nil nil nil "test"]
+ (is (= [nil nil nil nil "test"]
(map #(first-in % [:dependency :scope])
(deep-content xml [:project :dependencies]))))))
@@ -128,16 +128,16 @@
sample-project
:dev
{:dependencies '[[peridot "0.0.5"]]})))]
- (is (= ["org.clojure" "rome" "ring" "peridot"]
+ (is (= ["clojure-complete" "org.clojure" "rome" "ring" "peridot"]
(map #(first-in % [:dependency :groupId])
(deep-content xml [:project :dependencies]))))
- (is (= ["clojure" "rome" "ring" "peridot"]
+ (is (= ["clojure-complete" "clojure" "rome" "ring" "peridot"]
(map #(first-in % [:dependency :artifactId])
(deep-content xml [:project :dependencies]))))
- (is (= ["1.1.0" "0.9" "1.0.0" "0.0.5"]
+ (is (= ["0.2.1" "1.1.0" "0.9" "1.0.0" "0.0.5"]
(map #(first-in % [:dependency :version])
(deep-content xml [:project :dependencies]))))
- (is (= [nil nil nil "test"]
+ (is (= [nil nil nil nil "test"]
(map #(first-in % [:dependency :scope])
(deep-content xml [:project :dependencies]))))))
@@ -154,34 +154,34 @@
[[ring-mock
:classifier "cla"
:extension "dom"]]]]})))]
- (is (= ["peridot" "org.clojure" "rome" "ring"]
+ (is (= ["peridot" "clojure-complete" "org.clojure" "rome" "ring"]
(map #(first-in % [:dependency :groupId])
(deep-content xml [:project :dependencies]))))
- (is (= [ "peridot" "clojure" "rome" "ring"]
+ (is (= ["peridot" "clojure-complete" "clojure" "rome" "ring"]
(map #(first-in % [:dependency :artifactId])
(deep-content xml [:project :dependencies]))))
- (is (= ["0.0.5" "1.1.0" "0.9" "1.0.0"]
+ (is (= ["0.0.5" "0.2.1" "1.1.0" "0.9" "1.0.0"]
(map #(first-in % [:dependency :version])
(deep-content xml [:project :dependencies]))))
- (is (= ["provided" nil nil nil]
+ (is (= ["provided" nil nil nil nil]
(map #(first-in % [:dependency :scope])
(deep-content xml [:project :dependencies]))))
- (is (= ["true" nil nil nil]
+ (is (= ["true" nil nil nil nil]
(map #(first-in % [:dependency :optional])
(deep-content xml [:project :dependencies]))))
- (is (= ["sources" nil nil nil]
+ (is (= ["sources" nil nil nil nil]
(map #(first-in % [:dependency :classifier])
(deep-content xml [:project :dependencies]))))
- (is (= ["pom" nil nil nil]
+ (is (= ["pom" nil nil nil nil]
(map #(first-in % [:dependency :type])
(deep-content xml [:project :dependencies]))))
- (is (= ["ring-mock" nil nil nil]
+ (is (= ["ring-mock" nil nil nil nil]
(map #(first-in % [:dependency :exclusions :exclusion :artifactId])
(deep-content xml [:project :dependencies]))))
- (is (= ["cla" nil nil nil]
+ (is (= ["cla" nil nil nil nil]
(map #(first-in % [:dependency :exclusions :exclusion :classifier])
(deep-content xml [:project :dependencies]))))
- (is (= ["dom" nil nil nil]
+ (is (= ["dom" nil nil nil nil]
(map #(first-in % [:dependency :exclusions :exclusion :type])
(deep-content xml [:project :dependencies])))))
(let [xml (xml/parse-str
@@ -191,25 +191,25 @@
:scope "provided"
:exclusions
[ring-mock]]]})))]
- (is (= ["peridot" "org.clojure" "rome" "ring"]
+ (is (= ["peridot" "clojure-complete" "org.clojure" "rome" "ring"]
(map #(first-in % [:dependency :groupId])
(deep-content xml [:project :dependencies]))))
- (is (= [ "peridot" "clojure" "rome" "ring"]
+ (is (= ["peridot" "clojure-complete" "clojure" "rome" "ring"]
(map #(first-in % [:dependency :artifactId])
(deep-content xml [:project :dependencies]))))
- (is (= ["0.0.5" "1.1.0" "0.9" "1.0.0"]
+ (is (= ["0.0.5" "0.2.1" "1.1.0" "0.9" "1.0.0"]
(map #(first-in % [:dependency :version])
(deep-content xml [:project :dependencies]))))
- (is (= ["provided" nil nil nil]
+ (is (= ["provided" nil nil nil nil]
(map #(first-in % [:dependency :scope])
(deep-content xml [:project :dependencies]))))
- (is (= ["ring-mock" nil nil nil]
+ (is (= ["ring-mock" nil nil nil nil]
(map #(first-in % [:dependency :exclusions :exclusion :artifactId])
(deep-content xml [:project :dependencies]))))
- (is (= [nil nil nil nil]
+ (is (every? nil?
(map #(first-in % [:dependency :exclusions :exclusion :classifier])
(deep-content xml [:project :dependencies]))))
- (is (= [nil nil nil nil]
+ (is (every? nil?
(map #(first-in % [:dependency :exclusions :exclusion :type])
(deep-content xml [:project :dependencies]))))))
@@ -218,16 +218,16 @@
(make-pom (with-profile
sample-project
:dev {:dependencies '[[rome "0.8"]]})))]
- (is (= ["org.clojure" "rome" "ring" "rome"]
+ (is (= ["clojure-complete" "org.clojure" "rome" "ring" "rome"]
(map #(first-in % [:dependency :groupId])
(deep-content xml [:project :dependencies]))))
- (is (= ["clojure" "rome" "ring" "rome"]
+ (is (= ["clojure-complete" "clojure" "rome" "ring" "rome"]
(map #(first-in % [:dependency :artifactId])
(deep-content xml [:project :dependencies]))))
- (is (= ["1.1.0" "0.9" "1.0.0" "0.8"]
+ (is (= ["0.2.1" "1.1.0" "0.9" "1.0.0" "0.8"]
(map #(first-in % [:dependency :version])
(deep-content xml [:project :dependencies]))))
- (is (= [nil nil nil "test"]
+ (is (= [nil nil nil nil "test"]
(map #(first-in % [:dependency :scope])
(deep-content xml [:project :dependencies]))))))
@@ -251,7 +251,7 @@
((partial mapcat :content))))))
(deftest test-pom-handles-global-exclusions
- (is (= [["clojure"] ["clojure"] ["clojure"]]
+ (is (= [["clojure"] ["clojure"] ["clojure"] ["clojure"]]
(-> (make-pom (with-profile sample-project
{:exclusions '[org.clojure/clojure]}))
xml/parse-str

0 comments on commit 30c0fdb

Please sign in to comment.