Skip to content

Commit

Permalink
Add test for target that fails
Browse files Browse the repository at this point in the history
  • Loading branch information
psibi committed Jun 25, 2022
1 parent 0c0b852 commit 42048cc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions test/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,7 @@ plan:

push2 version1 version2:
echo {{version1}} {{version2}}

# A target that will fail
fail:
exit 1
16 changes: 14 additions & 2 deletions test/justl-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

(ert-deftest justl--get-recipies-test ()
(should (equal
(list "default" "build-cmd" "plan" "push" "push2")
(list "default" "build-cmd" "plan" "push" "push2" "fail")
(justl--get-recipies))))

(ert-deftest justl--list-to-recipe-test ()
Expand Down Expand Up @@ -189,6 +189,18 @@
(kill-buffer (justl--buffer-name))
(kill-buffer justl--output-process-buffer))

(ert-deftest justl--fail-recipe ()
(justl)
(with-current-buffer (justl--buffer-name)
(search-forward "fail")
(justl-exec-recipe)
(justl--wait-till-exit justl--output-process-buffer))
(with-current-buffer justl--output-process-buffer
(let ((buf-string (buffer-substring-no-properties (point-min) (point-max))))
(should (s-contains? "exited abnormally" buf-string))))
(kill-buffer (justl--buffer-name))
(kill-buffer justl--output-process-buffer))

(ert-deftest justl--find-justfiles-check ()
(should (equal (f-filename (justl--find-justfiles default-directory)) "justfile")))

Expand All @@ -199,7 +211,7 @@
(should (member (list "push" nil) recipies))
(should (member (list "push2" nil) recipies))))

;; (ert "justl--**")
(ert "justl--**")

(provide 'justl-test)
;;; justl-test.el ends here

0 comments on commit 42048cc

Please sign in to comment.