Don't add alias-help as public API in lein.help.
Also add in a couple of tests to ensure that aliases print docstrings.
This commit is contained in:
parent
772017d3aa
commit
c86a69333e
2 changed files with 16 additions and 1 deletions
|
@ -64,7 +64,7 @@
|
|||
|
||||
(declare help-for)
|
||||
|
||||
(defn alias-help
|
||||
(defn- alias-help
|
||||
"Returns a string containing help for an alias, or nil if the string is not an
|
||||
alias."
|
||||
[aliases task-name]
|
||||
|
|
|
@ -43,3 +43,18 @@
|
|||
(let [m (get-subtasks-and-docstrings-for (second (resolve-task "plugin")))]
|
||||
(is (= ["install" "uninstall"]
|
||||
(sort (keys m))))))
|
||||
|
||||
(deftest test-alias-docstrings
|
||||
(testing "default alias docstrings"
|
||||
(is (re-find #"is an alias for" (help-for {} "--version")))
|
||||
(is (re-find #"is an alias" (help-for {} "-o")))
|
||||
(is (re-find #"not found" (help-for {} "not-a-task"))))
|
||||
(testing "own alias docstrings"
|
||||
(let [custom-aliases {:aliases {"foobar" ^{:doc "Foos the bar."}
|
||||
["foo" "bar"],
|
||||
"vsn" "version"
|
||||
"multipart" ["multi" "part"]}}]
|
||||
(is (re-find #"is an alias for" (help-for custom-aliases "vsn")))
|
||||
(is (re-find #"is an alias" (help-for custom-aliases "multipart")))
|
||||
(is (re-find #"Foos the bar\." (help-for custom-aliases "foobar")))
|
||||
(is (re-find #"not found" (help-for custom-aliases "not-a-task"))))))
|
||||
|
|
Loading…
Reference in a new issue