Skip to content

Commit b3e85d0

Browse files
committed
Improve messy command/group test
1 parent 1889391 commit b3e85d0

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

test/net/lewisship/cli_tools/messy_test.clj

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,7 @@
2626
(deftest simple-commands-work
2727
(is (match? {:status 0
2828
:out "simple: ok\n"}
29-
(dispatch "simp")))
30-
31-
(is (match? {:status 0
32-
:out "messy: kiwi ok\n"}
33-
(dispatch "messy" "kiwi"))))
29+
(dispatch "simp"))))
3430

3531
(deftest missing-positional-in-nested
3632
(is (match? {:status 1
@@ -41,11 +37,14 @@
4137
(is (match? {:out "nested: ok\n"}
4238
(dispatch "mess" "nest"))))
4339

40+
(deftest matches-command-when-cant-find-sub-command
41+
(is (match? {:out "messy: kiwi ok\n"}
42+
(dispatch "mess" "kiwi"))))
43+
4444
(comment
4545

4646
(defn capture [f & args]
47-
(let [{:keys [out err]} (binding [ansi/*color-enabled* false]
48-
(apply dispatch args))
47+
(let [{:keys [out err]} (apply dispatch args)
4948
captured (if (string/blank? out)
5049
err
5150
out)
@@ -54,8 +53,6 @@
5453
(println (str out-path ":"))
5554
(print captured)))
5655

57-
(dispatch "help" "--full" )
58-
5956
(capture "messy-full-help" "help" "--full")
6057

6158
(capture "messy-simple" "simple")

0 commit comments

Comments
 (0)