tasks output test

This commit is contained in:
Michiel Borkent 2021-04-11 12:49:42 +02:00
parent 7194763c32
commit bd0495f88b
2 changed files with 4 additions and 7 deletions

View file

@ -122,10 +122,11 @@
(let [tasks (:tasks @bb-edn)]
(if (seq tasks)
(let [names (keys tasks)
raw-names (filter symbol? names)
names (map str raw-names)
names (filter symbol? names)
names (map str names)
names (remove #(str/starts-with? % "-") names)
names (remove #(:private (get tasks (symbol %))) names)
names (sort names)
longest (apply max (map count names))
fmt (str "%1$-" longest "s")]
(println "The following tasks are available:")

View file

@ -90,11 +90,7 @@
{:task '(+ 1 2 3)
:private true}}}
(let [res (test-utils/bb nil "tasks")]
(is (str/includes? res "The following tasks are available:"))
(is (str/includes? res "task1 task1 doc"))
(is (str/includes? res "task2 task2 doc"))
(is (not (str/includes? res "task3")))
(is (not (str/includes? res "task4"))))))
(is (= "The following tasks are available:\n\ntask1 task1 doc\ntask2 task2 doc\n" res)))))
;; TODO:
;; Do we want to support the same parsing as the clj CLI?