Skip to content

Commit

Permalink
Don't add alias-help as public API in lein.help.
Browse files Browse the repository at this point in the history
Also add in a couple of tests to ensure that aliases print docstrings.
  • Loading branch information
hypirion committed Sep 7, 2013
1 parent 772017d commit c86a693
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/leiningen/help.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
15 changes: 15 additions & 0 deletions test/leiningen/test/help.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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"))))))

0 comments on commit c86a693

Please sign in to comment.