forked from technomancy/leiningen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_plugin.clj
46 lines (39 loc) · 1.7 KB
/
test_plugin.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(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
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
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))))