-
Notifications
You must be signed in to change notification settings - Fork 12
/
daemons-shepherd-test.el
31 lines (28 loc) · 1.07 KB
/
daemons-shepherd-test.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
(load-file "./daemons-shepherd.el")
(ert-deftest shepherd-parse-list-item-test ()
(let ((input "+ compton")
(expected '("compton" ["compton" "started"])))
(should (equal expected
(daemons-shepherd--parse-list-item input)))))
(ert-deftest shepherd-is-service-line-test ()
(let ((input " - redshift"))
(should (daemons-shepherd--item-is-service-p input)))
(let ((input " + gpg-agent"))
(should (daemons-shepherd--item-is-service-p input)))
(let ((input "Started:"))
(should (not (daemons-shepherd--item-is-service-p input))))
(let ((input "Stopped:"))
(should (not (daemons-shepherd--item-is-service-p input)))))
(ert-deftest shepherd-list-test ()
(let* ((dummy-output "
Started:
+ compton
+ root
Stopped:
- gpg-agent")
(daemons--shell-command-to-string-fun (lambda (_) dummy-output))
(expected '(("compton" ["compton" "started"])
("root" ["root" "started"])
("gpg-agent" ["gpg-agent" "stopped"]))))
(should (equal expected
(daemons-shepherd--list)))))