Skip to content

Commit

Permalink
dude
Browse files Browse the repository at this point in the history
  • Loading branch information
borkdude committed Jan 2, 2024
1 parent e1d52ef commit f094164
Showing 1 changed file with 13 additions and 20 deletions.
33 changes: 13 additions & 20 deletions test/babashka/cli_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -356,31 +356,24 @@
(testing "distinguish options at every level"
(d/deflet
(def spec {:foo {:coerce :keyword}})
(def tree {:spec spec
"foo" {"bar" {"baz" {:spec spec
:fn identity}
:fn identity
:spec spec}
:spec spec
:fn identity}})
(def table [{:spec spec}
{:cmds ["foo"]
:spec spec
:fn identity}
{:cmds ["foo" "bar"]
:fn identity
:spec spec}
{:cmds ["foo" "bar" "baz"]
:spec spec
:fn identity}])
(is (submap?
{:dispatch ["foo" "bar"],
:opts {:foo :dude3},
:opts-tree {:foo :dude1, "foo" {:foo :dude2}},
:args ["bar" "arg1"]}
(cli/dispatch-tree
tree
["--foo" "dude1" "foo" "--foo" "dude2" "bar" "--foo" "dude3" "bar" "arg1"])))

(def tree {:spec spec
:cmd "foo"
:sub {:cmd "bar"
:sub {:cmd "bar"
:sub {:cmd "baz"
:fn identity
:spec spec}}
:spec spec
:fn identity}}))))
(cli/dispatch
table
["--foo" "dude1" "foo" "--foo" "dude2" "bar" "--foo" "dude3" "bar" "arg1"]))))))

(deftest no-keyword-opts-test (is (= {:query [:a :b :c]}
(cli/parse-opts
Expand Down

0 comments on commit f094164

Please sign in to comment.