Skip to content

Commit 7fe0803

Browse files
abo-abopapercatlol
authored andcommitted
lispy-test.el (lispy-eval-other-window): Rewrite test
It doesn't work the same way as before, since `ivy-read' is used to select the value. However, `unread-command-events' don't seem to work in batch mode.
1 parent 06fd624 commit 7fe0803

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

lispy-test.el

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2549,24 +2549,21 @@ Insert KEY if there's no command."
25492549
lispy--eval-cond-msg))))
25502550

25512551
(ert-deftest lispy-eval-other-window ()
2552-
(setq lispy--eval-sym nil)
2553-
(should (string= (lispy-with-v el "(dolist |(s '(1 2 3))\n (message \"val: %d\" s))"
2554-
(lispy-eval-other-window)) "1"))
2555-
(should (string= (lispy-with-v el "(dolist |(s '(1 2 3))\n (message \"val: %d\" s))"
2556-
(lispy-eval-other-window)) "2"))
2557-
(should (string= (lispy-with-v el "(dolist |(s '(1 2 3))\n (message \"val: %d\" s))"
2558-
(lispy-eval-other-window)) "3"))
2559-
(should (string= (lispy-with-v el "(dolist |(s '(1 2 3))\n (message \"val: %d\" s))"
2560-
(lispy-eval-other-window)) "nil"))
2561-
(should (string= (lispy-with-v el "(dolist |(s '(1 2 3))\n (message \"val: %d\" s))"
2562-
(lispy-eval-other-window)) "1"))
2563-
(setq lispy--eval-sym nil)
2564-
(should (string= (lispy-with-v el "(mapcar |(lambda (s) (* s s)) '(1 2))"
2565-
(lispy-eval-other-window)) "1"))
2566-
(should (string= (lispy-with-v el "(mapcar |(lambda (s) (* s s)) '(1 2))"
2567-
(lispy-eval-other-window)) "2"))
2568-
(should (string= (lispy-with-v el "(mapcar |(lambda (s) (* s s)) '(1 2))"
2569-
(lispy-eval-other-window)) "nil")))
2552+
(unless noninteractive
2553+
(cl-labels ((p (keys)
2554+
(setq s nil)
2555+
(setq unread-command-events (listify-key-sequence (kbd keys)))
2556+
(lispy-eval-other-window)))
2557+
(should (string= (lispy-with-v el "(dolist |(s '(1 2 3))\n (message \"val: %d\" s))"
2558+
(p "C-m")) "1"))
2559+
(should (string= (lispy-with-v el "(dolist |(s '(1 2 3))\n (message \"val: %d\" s))"
2560+
(p "C-n C-m")) "2"))
2561+
(should (string= (lispy-with-v el "(dolist |(s '(1 2 3))\n (message \"val: %d\" s))"
2562+
(p "C-n C-n C-m")) "3"))
2563+
(should (string= (lispy-with-v el "(mapcar |(lambda (s) (* s s)) '(1 2))"
2564+
(p "C-m")) "1"))
2565+
(should (string= (lispy-with-v el "(mapcar |(lambda (s) (* s s)) '(1 2))"
2566+
(p "C-n C-m")) "2")))))
25702567

25712568
(ert-deftest lispy-ace-char ()
25722569
(should (string= (lispy-with "|(cons 'norwegian 'blue)"

0 commit comments

Comments
 (0)