diff --git a/test/babashka/cli_test.cljc b/test/babashka/cli_test.cljc index 885fe24..06f3eaa 100644 --- a/test/babashka/cli_test.cljc +++ b/test/babashka/cli_test.cljc @@ -361,7 +361,8 @@ (testing "spec can be overriden" (d/deflet - (def table [{:cmds ["foo" "bar"] :fn identity :spec {:version {:coerce :string}}} + (def table [{:cmds ["foo" "bar"] :fn identity :spec {:version {:coerce :string} + }} {:cmds ["foo"] :fn identity :spec {:version {:coerce :boolean} :dude {:coerce :boolean}}}]) (is (submap? {:opts {:version true}, :args ["2010"]} @@ -376,7 +377,16 @@ (-> (cli/dispatch table ["foo" "--dude" "bar" "--version" "2010"]) - :opts)))))) + :opts))) + (testing "specific spec replaces less specific spec (no merge)" + (is (= {:dude "some-value"} + (-> (cli/dispatch + table + ["foo" "bar" "--dude" "some-value"]) + :opts)))))) + ;; TODO: args->opts conflinct with subcommand + ;; TODO: more specific specs should not be merged, but overwritten + ) (deftest table->tree-test (testing "internal represenation"