Skip to content

Commit dc2b31b

Browse files
committed
Add tests for run-with-arguments
1 parent d2783bd commit dc2b31b

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

src/alas.janet

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
(file_repository/save new-plan-string file-path)
5858
errors/no-error)))))))
5959

60-
(defn- run-with-arguments [arguments]
60+
(defn run-with-arguments [arguments]
6161
(def file-path (arguments :default))
6262
(if file-path
6363
(run-with-file-path arguments file-path)

test/alas_test.janet

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,18 @@
2222
[errors exit-status] (alas/run-with-file-path arguments "./test/examples/unparsable-todo.md")]
2323
(test (empty? errors) false)
2424
(test exit-status 4)))
25+
26+
## —————————————————————————————————————————————————————————————————————————————————————————————————
27+
## Test run-with-arguments
28+
29+
(deftest "returns exit status 0 when there were no errors"
30+
(let [arguments {"skip-backup" true "stats" true :default "./test/examples/todo.md"}
31+
[errors exit-status] (alas/run-with-arguments arguments)]
32+
(test (empty? errors) true)
33+
(test exit-status 0)))
34+
35+
(deftest "returns exit status 2 when when the file path is missing"
36+
(let [arguments {"skip-backup" true "stats" true}
37+
[errors exit-status] (alas/run-with-arguments arguments)]
38+
(test (empty? errors) false)
39+
(test exit-status 2)))

0 commit comments

Comments
 (0)