Skip to content

Commit

Permalink
Update tests for cider--debug-prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhan0 committed Oct 17, 2019
1 parent 271a979 commit 4583220
Showing 1 changed file with 46 additions and 22 deletions.
68 changes: 46 additions & 22 deletions test/cider-debug-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,54 @@
(require 'clojure-mode)
(require 'cider-debug)

(setq print-length nil)
(describe "cider--debug-prompt"
(it "changes the font face to `cider-debug-prompt-face' for the first char"
(expect (equal-including-properties
(cider--debug-prompt (nrepl-dict "a" "a" "b" "b" "c" "c"))
#("a b c\n"
0 1 (face cider-debug-prompt-face)
1 2 (face default)
2 3 (face cider-debug-prompt-face)
3 4 (face default)
4 5 (face cider-debug-prompt-face)
5 6 (face default)))))

(it "handles multiple chars not separated by spaces"
(expect (equal-including-properties
(cider--debug-prompt (nrepl-dict "a" "abc" "b" "cba"))
#("abc cba\n"
0 1 (face cider-debug-prompt-face)
1 5 (face default)
5 6 (face cider-debug-prompt-face)
6 8 (face default))))

(expect (equal-including-properties
(cider--debug-prompt (nrepl-dict "a" "abc"))
#("abc\n" 0 1 (face cider-debug-prompt-face) 1 4 (face default))))))
(let ((cider-debug-prompt-commands '((?a "abc" "abc") (?x "xyz" "xyz"))))
(cider--debug-propertize-prompt-commands)
(expect (equal-including-properties
(cider--debug-prompt '("abc" "xyz"))
#(" abc xyz\n"
0 1 (face default)
1 2 (face cider-debug-prompt-face)
2 5 (face default)
5 6 (face cider-debug-prompt-face)
6 9 (face default))))))

(it "Uses the display name and handles multiple chars not separated by spaces"
(let ((cider-debug-prompt-commands '((?a "abc" "cba") (?x "xyz" "yxz"))))
(cider--debug-propertize-prompt-commands)
(expect (equal-including-properties
(cider--debug-prompt '("abc" "xyz"))
#(" cba yxz\n"
0 3 (face default)
3 4 (face cider-debug-prompt-face)
4 6 (face default)
6 7 (face cider-debug-prompt-face)
7 9 (face default))))
(expect (equal-including-properties
(cider--debug-prompt '("abc"))
#(" cba\n"
0 3 (face default)
3 4 (face cider-debug-prompt-face)
4 5 (face default))))))

(it "filters and displays commands in the order specified by cider-debug-prompt-commands"
(let ((cider-debug-prompt-commands '((?a "abc" "abc")
(?z "xyz" "xyz")
(?d "def" nil)
(?g "ghi" "ghi"))))
(cider--debug-propertize-prompt-commands)
(expect (equal-including-properties
(cider--debug-prompt '("ghi" "def" "abc" "pqr" "xyz" ))
#(" abc xyz ghi\n"
0 1 (face default)
1 2 (face cider-debug-prompt-face)
2 7 (face default)
7 8 (face cider-debug-prompt-face)
8 9 (face default)
9 10 (face cider-debug-prompt-face)
10 13 (face default)))))))

(describe "cider--debug-move-point"
(it "navigates the clojure sexp's guided by the given coordinates"
Expand Down

0 comments on commit 4583220

Please sign in to comment.