File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ (ns eca.main-test
2+ (:require
3+ [clojure.test :refer [are deftest is testing use-fixtures]]
4+ [eca.main :as main]
5+ [matcher-combinators.config]
6+ [matcher-combinators.matchers :as m]
7+ [matcher-combinators.test :refer [match?]]))
8+
9+ (use-fixtures :once #(binding [matcher-combinators.config/*use-abbreviation* true ] (% )))
10+
11+ (deftest parse-opts-test
12+ (are [args expected] (match? expected (#'main/parse-opts args))
13+ ; ; help
14+ [] {:options {:help m/absent}}
15+ [" --help" ] {:options {:help true }}
16+ [" -h" ] {:options {:help true }}
17+ ; ; version
18+ [] {:options {:version m/absent}}
19+ [" --version" ] {:options {:version true }}
20+ [" -v" ] {:options {:version m/absent}}
21+ ; ; verbose
22+ [] {:options {:verbose m/absent}}
23+ [" --verbose" ] {:options {:verbose true }}
24+ [" -v" ] {:options {:verbose m/absent}}
25+ #_()))
26+
27+ (deftest parse
28+ (testing " commands"
29+ (is (= nil (:action (#'main/parse []))))
30+ (is (= " server" (:action (#'main/parse [" server" ])))))
31+ (testing " final options"
32+ (is (string? (:exit-message (#'main/parse [" --help" ]))))
33+ (is (string? (:exit-message (#'main/parse [" -h" ]))))
34+ (is (string? (:exit-message (#'main/parse [" --version" ]))))))
You can’t perform that action at this time.
0 commit comments