leiningen/test/test_plugin.clj

47 lines
1.7 KiB
Clojure
Raw Normal View History

(ns test-plugin
(:use [leiningen.plugin]
[leiningen.util.file :only (unique-lein-tmp-dir
delete-file-recursively)]
[leiningen.compile :only (platform-nullsink)]
[leiningen.core :only (read-project defproject)]
[clojure.java.io :only (file)])
(:use [clojure.test]))
(deftest test-plugin-standalone-filename
(is (= (plugin-standalone-filename "tehgroup" "tehname" "0.0.1")
"tehgroup-tehname-0.0.1.jar"))
(is (= (plugin-standalone-filename nil "tehname" "0.0.1")
"tehname-0.0.1.jar")))
(deftest test-extract-name-and-group
(is (= (extract-name-and-group "tehgroup/tehname")
["tehname" "tehgroup"]))
(is (= (extract-name-and-group "tehname")
["tehname" nil])))
(deftest test-help
(is (= "Arguments: ([subtask project-name version])
Manage user-level plugins.
Subtasks available:
install Download, package, and install plugin jarfile into
~/.lein/plugins
2010-11-09 04:49:26 +00:00
Syntax: lein plugin install [GROUP/]ARTIFACT-ID VERSION
You can use the same syntax here as when listing Leiningen
dependencies.
uninstall Delete the plugin jarfile
2010-11-09 04:49:26 +00:00
Syntax: lein plugin uninstall [GROUP/]ARTIFACT-ID VERSION\n"
(with-out-str (plugin "help")))))
(defonce test-project (read-project "test_projects/sample/project.clj"))
(deftest test-install
(with-out-str
(leiningen.install/install test-project)
(binding [plugins-path (unique-lein-tmp-dir)
leiningen.install/install (constantly nil)]
(install "nomnomnom" "0.5.0-SNAPSHOT")
(is (.exists (file plugins-path "nomnomnom-0.5.0-SNAPSHOT.jar")))
(delete-file-recursively plugins-path))))