]> code.delx.au - gnu-emacs-elpa/blob - packages/hydra/hydra-test.el
Merge commit '3b78e0e503f4763f8a2d77eeacfc91213ec5532e' from swiper
[gnu-emacs-elpa] / packages / hydra / hydra-test.el
1 ;;; hydra-test.el --- Tests for Hydra
2
3 ;; Copyright (C) 2015 Free Software Foundation, Inc.
4
5 ;; Author: Oleh Krehel
6
7 ;; This file is part of GNU Emacs.
8
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
13
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
21
22 ;;; Commentary:
23 ;;
24
25 ;;; Code:
26
27 (require 'ert)
28 (require 'hydra)
29
30 (ert-deftest hydra-red-error ()
31 (should
32 (equal
33 (macroexpand
34 '(defhydra hydra-error (global-map "M-g")
35 "error"
36 ("h" first-error "first")
37 ("j" next-error "next")
38 ("k" previous-error "prev")
39 ("SPC" hydra-repeat "rep" :bind nil)))
40 '(progn
41 (defun hydra-error/first-error nil "Create a hydra with a \"M-g\" body and the heads:
42
43 \"h\": `first-error',
44 \"j\": `next-error',
45 \"k\": `previous-error',
46 \"SPC\": `hydra-repeat'
47
48 The body can be accessed via `hydra-error/body'.
49
50 Call the head: `first-error'."
51 (interactive)
52 (hydra-default-pre)
53 (hydra-disable)
54 (catch (quote hydra-disable)
55 (condition-case err (prog1 t (call-interactively (function first-error)))
56 ((quit error)
57 (message "%S" err)
58 (unless hydra-lv (sit-for 0.8))
59 nil))
60 (when hydra-is-helpful (hydra-error/hint))
61 (setq hydra-last
62 (hydra-set-transient-map
63 (setq hydra-curr-map
64 (quote (keymap (7 . hydra-keyboard-quit)
65 (32 . hydra-repeat)
66 (107 . hydra-error/previous-error)
67 (106 . hydra-error/next-error)
68 (104 . hydra-error/first-error)
69 (switch-frame . hydra--handle-switch-frame)
70 (kp-subtract . hydra--negative-argument)
71 (kp-9 . hydra--digit-argument)
72 (kp-8 . hydra--digit-argument)
73 (kp-7 . hydra--digit-argument)
74 (kp-6 . hydra--digit-argument)
75 (kp-5 . hydra--digit-argument)
76 (kp-4 . hydra--digit-argument)
77 (kp-3 . hydra--digit-argument)
78 (kp-2 . hydra--digit-argument)
79 (kp-1 . hydra--digit-argument)
80 (kp-0 . hydra--digit-argument)
81 (57 . hydra--digit-argument)
82 (56 . hydra--digit-argument)
83 (55 . hydra--digit-argument)
84 (54 . hydra--digit-argument)
85 (53 . hydra--digit-argument)
86 (52 . hydra--digit-argument)
87 (51 . hydra--digit-argument)
88 (50 . hydra--digit-argument)
89 (49 . hydra--digit-argument)
90 (48 . hydra--digit-argument)
91 (45 . hydra--negative-argument)
92 (21 . hydra--universal-argument))))
93 t (lambda nil (hydra-cleanup))))))
94 (defun hydra-error/next-error nil "Create a hydra with a \"M-g\" body and the heads:
95
96 \"h\": `first-error',
97 \"j\": `next-error',
98 \"k\": `previous-error',
99 \"SPC\": `hydra-repeat'
100
101 The body can be accessed via `hydra-error/body'.
102
103 Call the head: `next-error'."
104 (interactive)
105 (hydra-default-pre)
106 (hydra-disable)
107 (catch (quote hydra-disable)
108 (condition-case err (prog1 t (call-interactively (function next-error)))
109 ((quit error)
110 (message "%S" err)
111 (unless hydra-lv (sit-for 0.8))
112 nil))
113 (when hydra-is-helpful (hydra-error/hint))
114 (setq hydra-last
115 (hydra-set-transient-map
116 (setq hydra-curr-map
117 (quote (keymap (7 . hydra-keyboard-quit)
118 (32 . hydra-repeat)
119 (107 . hydra-error/previous-error)
120 (106 . hydra-error/next-error)
121 (104 . hydra-error/first-error)
122 (switch-frame . hydra--handle-switch-frame)
123 (kp-subtract . hydra--negative-argument)
124 (kp-9 . hydra--digit-argument)
125 (kp-8 . hydra--digit-argument)
126 (kp-7 . hydra--digit-argument)
127 (kp-6 . hydra--digit-argument)
128 (kp-5 . hydra--digit-argument)
129 (kp-4 . hydra--digit-argument)
130 (kp-3 . hydra--digit-argument)
131 (kp-2 . hydra--digit-argument)
132 (kp-1 . hydra--digit-argument)
133 (kp-0 . hydra--digit-argument)
134 (57 . hydra--digit-argument)
135 (56 . hydra--digit-argument)
136 (55 . hydra--digit-argument)
137 (54 . hydra--digit-argument)
138 (53 . hydra--digit-argument)
139 (52 . hydra--digit-argument)
140 (51 . hydra--digit-argument)
141 (50 . hydra--digit-argument)
142 (49 . hydra--digit-argument)
143 (48 . hydra--digit-argument)
144 (45 . hydra--negative-argument)
145 (21 . hydra--universal-argument))))
146 t (lambda nil (hydra-cleanup))))))
147 (defun hydra-error/previous-error nil "Create a hydra with a \"M-g\" body and the heads:
148
149 \"h\": `first-error',
150 \"j\": `next-error',
151 \"k\": `previous-error',
152 \"SPC\": `hydra-repeat'
153
154 The body can be accessed via `hydra-error/body'.
155
156 Call the head: `previous-error'."
157 (interactive)
158 (hydra-default-pre)
159 (hydra-disable)
160 (catch (quote hydra-disable)
161 (condition-case err (prog1 t (call-interactively (function previous-error)))
162 ((quit error)
163 (message "%S" err)
164 (unless hydra-lv (sit-for 0.8))
165 nil))
166 (when hydra-is-helpful (hydra-error/hint))
167 (setq hydra-last
168 (hydra-set-transient-map
169 (setq hydra-curr-map
170 (quote (keymap (7 . hydra-keyboard-quit)
171 (32 . hydra-repeat)
172 (107 . hydra-error/previous-error)
173 (106 . hydra-error/next-error)
174 (104 . hydra-error/first-error)
175 (switch-frame . hydra--handle-switch-frame)
176 (kp-subtract . hydra--negative-argument)
177 (kp-9 . hydra--digit-argument)
178 (kp-8 . hydra--digit-argument)
179 (kp-7 . hydra--digit-argument)
180 (kp-6 . hydra--digit-argument)
181 (kp-5 . hydra--digit-argument)
182 (kp-4 . hydra--digit-argument)
183 (kp-3 . hydra--digit-argument)
184 (kp-2 . hydra--digit-argument)
185 (kp-1 . hydra--digit-argument)
186 (kp-0 . hydra--digit-argument)
187 (57 . hydra--digit-argument)
188 (56 . hydra--digit-argument)
189 (55 . hydra--digit-argument)
190 (54 . hydra--digit-argument)
191 (53 . hydra--digit-argument)
192 (52 . hydra--digit-argument)
193 (51 . hydra--digit-argument)
194 (50 . hydra--digit-argument)
195 (49 . hydra--digit-argument)
196 (48 . hydra--digit-argument)
197 (45 . hydra--negative-argument)
198 (21 . hydra--universal-argument))))
199 t (lambda nil (hydra-cleanup))))))
200 (unless (keymapp (lookup-key global-map (kbd "M-g")))
201 (define-key global-map (kbd "M-g")
202 nil))
203 (define-key global-map [134217831 104]
204 (function hydra-error/first-error))
205 (define-key global-map [134217831 106]
206 (function hydra-error/next-error))
207 (define-key global-map [134217831 107]
208 (function hydra-error/previous-error))
209 (defun hydra-error/hint nil
210 (if hydra-lv (lv-message (format #("error: [h]: first, [j]: next, [k]: prev, [SPC]: rep." 8 9 (face hydra-face-red)
211 20 21 (face hydra-face-red)
212 31 32 (face hydra-face-red)
213 42 45 (face hydra-face-red))))
214 (message (format #("error: [h]: first, [j]: next, [k]: prev, [SPC]: rep." 8 9 (face hydra-face-red)
215 20 21 (face hydra-face-red)
216 31 32 (face hydra-face-red)
217 42 45 (face hydra-face-red))))))
218 (defun hydra-error/body nil "Create a hydra with a \"M-g\" body and the heads:
219
220 \"h\": `first-error',
221 \"j\": `next-error',
222 \"k\": `previous-error',
223 \"SPC\": `hydra-repeat'
224
225 The body can be accessed via `hydra-error/body'."
226 (interactive)
227 (hydra-default-pre)
228 (hydra-disable)
229 (catch (quote hydra-disable)
230 (when hydra-is-helpful (hydra-error/hint))
231 (setq hydra-last
232 (hydra-set-transient-map
233 (setq hydra-curr-map
234 (quote (keymap (7 . hydra-keyboard-quit)
235 (32 . hydra-repeat)
236 (107 . hydra-error/previous-error)
237 (106 . hydra-error/next-error)
238 (104 . hydra-error/first-error)
239 (switch-frame . hydra--handle-switch-frame)
240 (kp-subtract . hydra--negative-argument)
241 (kp-9 . hydra--digit-argument)
242 (kp-8 . hydra--digit-argument)
243 (kp-7 . hydra--digit-argument)
244 (kp-6 . hydra--digit-argument)
245 (kp-5 . hydra--digit-argument)
246 (kp-4 . hydra--digit-argument)
247 (kp-3 . hydra--digit-argument)
248 (kp-2 . hydra--digit-argument)
249 (kp-1 . hydra--digit-argument)
250 (kp-0 . hydra--digit-argument)
251 (57 . hydra--digit-argument)
252 (56 . hydra--digit-argument)
253 (55 . hydra--digit-argument)
254 (54 . hydra--digit-argument)
255 (53 . hydra--digit-argument)
256 (52 . hydra--digit-argument)
257 (51 . hydra--digit-argument)
258 (50 . hydra--digit-argument)
259 (49 . hydra--digit-argument)
260 (48 . hydra--digit-argument)
261 (45 . hydra--negative-argument)
262 (21 . hydra--universal-argument))))
263 t (lambda nil (hydra-cleanup))))
264 (setq prefix-arg current-prefix-arg)))))))
265
266 (ert-deftest hydra-blue-toggle ()
267 (should
268 (equal
269 (macroexpand
270 '(defhydra hydra-toggle (:color blue)
271 "toggle"
272 ("t" toggle-truncate-lines "truncate")
273 ("f" auto-fill-mode "fill")
274 ("a" abbrev-mode "abbrev")
275 ("q" nil "cancel")))
276 '(progn
277 (defun hydra-toggle/toggle-truncate-lines-and-exit nil "Create a hydra with no body and the heads:
278
279 \"t\": `toggle-truncate-lines',
280 \"f\": `auto-fill-mode',
281 \"a\": `abbrev-mode',
282 \"q\": `nil'
283
284 The body can be accessed via `hydra-toggle/body'.
285
286 Call the head: `toggle-truncate-lines'."
287 (interactive)
288 (hydra-default-pre)
289 (hydra-disable)
290 (hydra-cleanup)
291 (catch (quote hydra-disable)
292 (call-interactively (function toggle-truncate-lines))))
293 (defun hydra-toggle/auto-fill-mode-and-exit nil "Create a hydra with no body and the heads:
294
295 \"t\": `toggle-truncate-lines',
296 \"f\": `auto-fill-mode',
297 \"a\": `abbrev-mode',
298 \"q\": `nil'
299
300 The body can be accessed via `hydra-toggle/body'.
301
302 Call the head: `auto-fill-mode'."
303 (interactive)
304 (hydra-default-pre)
305 (hydra-disable)
306 (hydra-cleanup)
307 (catch (quote hydra-disable)
308 (call-interactively (function auto-fill-mode))))
309 (defun hydra-toggle/abbrev-mode-and-exit nil "Create a hydra with no body and the heads:
310
311 \"t\": `toggle-truncate-lines',
312 \"f\": `auto-fill-mode',
313 \"a\": `abbrev-mode',
314 \"q\": `nil'
315
316 The body can be accessed via `hydra-toggle/body'.
317
318 Call the head: `abbrev-mode'."
319 (interactive)
320 (hydra-default-pre)
321 (hydra-disable)
322 (hydra-cleanup)
323 (catch (quote hydra-disable)
324 (call-interactively (function abbrev-mode))))
325 (defun hydra-toggle/nil nil "Create a hydra with no body and the heads:
326
327 \"t\": `toggle-truncate-lines',
328 \"f\": `auto-fill-mode',
329 \"a\": `abbrev-mode',
330 \"q\": `nil'
331
332 The body can be accessed via `hydra-toggle/body'.
333
334 Call the head: `nil'."
335 (interactive)
336 (hydra-default-pre)
337 (hydra-disable)
338 (hydra-cleanup)
339 (catch (quote hydra-disable)))
340 (defun hydra-toggle/hint nil
341 (if hydra-lv (lv-message (format #("toggle: [t]: truncate, [f]: fill, [a]: abbrev, [q]: cancel." 9 10 (face hydra-face-blue)
342 24 25 (face hydra-face-blue)
343 35 36 (face hydra-face-blue)
344 48 49 (face hydra-face-blue))))
345 (message (format #("toggle: [t]: truncate, [f]: fill, [a]: abbrev, [q]: cancel." 9 10 (face hydra-face-blue)
346 24 25 (face hydra-face-blue)
347 35 36 (face hydra-face-blue)
348 48 49 (face hydra-face-blue))))))
349 (defun hydra-toggle/body nil "Create a hydra with no body and the heads:
350
351 \"t\": `toggle-truncate-lines',
352 \"f\": `auto-fill-mode',
353 \"a\": `abbrev-mode',
354 \"q\": `nil'
355
356 The body can be accessed via `hydra-toggle/body'."
357 (interactive)
358 (hydra-default-pre)
359 (hydra-disable)
360 (catch (quote hydra-disable)
361 (when hydra-is-helpful (hydra-toggle/hint))
362 (setq hydra-last
363 (hydra-set-transient-map
364 (setq hydra-curr-map
365 (quote (keymap (7 . hydra-keyboard-quit)
366 (113 . hydra-toggle/nil)
367 (97 . hydra-toggle/abbrev-mode-and-exit)
368 (102 . hydra-toggle/auto-fill-mode-and-exit)
369 (116 . hydra-toggle/toggle-truncate-lines-and-exit)
370 (switch-frame . hydra--handle-switch-frame)
371 (kp-subtract . hydra--negative-argument)
372 (kp-9 . hydra--digit-argument)
373 (kp-8 . hydra--digit-argument)
374 (kp-7 . hydra--digit-argument)
375 (kp-6 . hydra--digit-argument)
376 (kp-5 . hydra--digit-argument)
377 (kp-4 . hydra--digit-argument)
378 (kp-3 . hydra--digit-argument)
379 (kp-2 . hydra--digit-argument)
380 (kp-1 . hydra--digit-argument)
381 (kp-0 . hydra--digit-argument)
382 (57 . hydra--digit-argument)
383 (56 . hydra--digit-argument)
384 (55 . hydra--digit-argument)
385 (54 . hydra--digit-argument)
386 (53 . hydra--digit-argument)
387 (52 . hydra--digit-argument)
388 (51 . hydra--digit-argument)
389 (50 . hydra--digit-argument)
390 (49 . hydra--digit-argument)
391 (48 . hydra--digit-argument)
392 (45 . hydra--negative-argument)
393 (21 . hydra--universal-argument))))
394 t (lambda nil (hydra-cleanup))))
395 (setq prefix-arg current-prefix-arg)))))))
396
397 (ert-deftest hydra-amaranth-vi ()
398 (should
399 (equal
400 (macroexpand
401 '(defhydra hydra-vi
402 (:pre
403 (set-cursor-color "#e52b50")
404 :post
405 (set-cursor-color "#ffffff")
406 :color amaranth)
407 "vi"
408 ("j" next-line)
409 ("k" previous-line)
410 ("q" nil "quit")))
411 '(progn
412 (defun hydra-vi/hydra-keyboard-quit-and-exit nil "Create a hydra with no body and the heads:
413
414 \"\a\": `hydra-keyboard-quit',
415 \"j\": `next-line',
416 \"k\": `previous-line',
417 \"q\": `nil'
418
419 The body can be accessed via `hydra-vi/body'.
420
421 Call the head: `hydra-keyboard-quit'."
422 (interactive)
423 (hydra-default-pre)
424 (set-cursor-color "#e52b50")
425 (hydra-disable)
426 (hydra-cleanup)
427 (catch (quote hydra-disable)
428 (call-interactively (function hydra-keyboard-quit))
429 (set-cursor-color "#ffffff")))
430 (defun hydra-vi/next-line nil "Create a hydra with no body and the heads:
431
432 \"\a\": `hydra-keyboard-quit',
433 \"j\": `next-line',
434 \"k\": `previous-line',
435 \"q\": `nil'
436
437 The body can be accessed via `hydra-vi/body'.
438
439 Call the head: `next-line'."
440 (interactive)
441 (hydra-default-pre)
442 (set-cursor-color "#e52b50")
443 (hydra-disable)
444 (catch (quote hydra-disable)
445 (condition-case err (prog1 t (call-interactively (function next-line)))
446 ((quit error)
447 (message "%S" err)
448 (unless hydra-lv (sit-for 0.8))
449 nil))
450 (when hydra-is-helpful (hydra-vi/hint))
451 (setq hydra-last
452 (hydra-set-transient-map
453 (setq hydra-curr-map
454 (quote (keymap (t lambda nil (interactive)
455 (message "An amaranth Hydra can only exit through a blue head")
456 (hydra-set-transient-map hydra-curr-map t)
457 (when hydra-is-helpful (unless hydra-lv (sit-for 0.8))
458 (hydra-vi/hint)))
459 (113 . hydra-vi/nil)
460 (107 . hydra-vi/previous-line)
461 (106 . hydra-vi/next-line)
462 (7 . hydra-vi/hydra-keyboard-quit-and-exit)
463 (switch-frame . hydra--handle-switch-frame)
464 (kp-subtract . hydra--negative-argument)
465 (kp-9 . hydra--digit-argument)
466 (kp-8 . hydra--digit-argument)
467 (kp-7 . hydra--digit-argument)
468 (kp-6 . hydra--digit-argument)
469 (kp-5 . hydra--digit-argument)
470 (kp-4 . hydra--digit-argument)
471 (kp-3 . hydra--digit-argument)
472 (kp-2 . hydra--digit-argument)
473 (kp-1 . hydra--digit-argument)
474 (kp-0 . hydra--digit-argument)
475 (57 . hydra--digit-argument)
476 (56 . hydra--digit-argument)
477 (55 . hydra--digit-argument)
478 (54 . hydra--digit-argument)
479 (53 . hydra--digit-argument)
480 (52 . hydra--digit-argument)
481 (51 . hydra--digit-argument)
482 (50 . hydra--digit-argument)
483 (49 . hydra--digit-argument)
484 (48 . hydra--digit-argument)
485 (45 . hydra--negative-argument)
486 (21 . hydra--universal-argument))))
487 t (lambda nil (hydra-cleanup))))))
488 (defun hydra-vi/previous-line nil "Create a hydra with no body and the heads:
489
490 \"\a\": `hydra-keyboard-quit',
491 \"j\": `next-line',
492 \"k\": `previous-line',
493 \"q\": `nil'
494
495 The body can be accessed via `hydra-vi/body'.
496
497 Call the head: `previous-line'."
498 (interactive)
499 (hydra-default-pre)
500 (set-cursor-color "#e52b50")
501 (hydra-disable)
502 (catch (quote hydra-disable)
503 (condition-case err (prog1 t (call-interactively (function previous-line)))
504 ((quit error)
505 (message "%S" err)
506 (unless hydra-lv (sit-for 0.8))
507 nil))
508 (when hydra-is-helpful (hydra-vi/hint))
509 (setq hydra-last
510 (hydra-set-transient-map
511 (setq hydra-curr-map
512 (quote (keymap (t lambda nil (interactive)
513 (message "An amaranth Hydra can only exit through a blue head")
514 (hydra-set-transient-map hydra-curr-map t)
515 (when hydra-is-helpful (unless hydra-lv (sit-for 0.8))
516 (hydra-vi/hint)))
517 (113 . hydra-vi/nil)
518 (107 . hydra-vi/previous-line)
519 (106 . hydra-vi/next-line)
520 (7 . hydra-vi/hydra-keyboard-quit-and-exit)
521 (switch-frame . hydra--handle-switch-frame)
522 (kp-subtract . hydra--negative-argument)
523 (kp-9 . hydra--digit-argument)
524 (kp-8 . hydra--digit-argument)
525 (kp-7 . hydra--digit-argument)
526 (kp-6 . hydra--digit-argument)
527 (kp-5 . hydra--digit-argument)
528 (kp-4 . hydra--digit-argument)
529 (kp-3 . hydra--digit-argument)
530 (kp-2 . hydra--digit-argument)
531 (kp-1 . hydra--digit-argument)
532 (kp-0 . hydra--digit-argument)
533 (57 . hydra--digit-argument)
534 (56 . hydra--digit-argument)
535 (55 . hydra--digit-argument)
536 (54 . hydra--digit-argument)
537 (53 . hydra--digit-argument)
538 (52 . hydra--digit-argument)
539 (51 . hydra--digit-argument)
540 (50 . hydra--digit-argument)
541 (49 . hydra--digit-argument)
542 (48 . hydra--digit-argument)
543 (45 . hydra--negative-argument)
544 (21 . hydra--universal-argument))))
545 t (lambda nil (hydra-cleanup))))))
546 (defun hydra-vi/nil nil "Create a hydra with no body and the heads:
547
548 \"\a\": `hydra-keyboard-quit',
549 \"j\": `next-line',
550 \"k\": `previous-line',
551 \"q\": `nil'
552
553 The body can be accessed via `hydra-vi/body'.
554
555 Call the head: `nil'."
556 (interactive)
557 (hydra-default-pre)
558 (set-cursor-color "#e52b50")
559 (hydra-disable)
560 (hydra-cleanup)
561 (catch (quote hydra-disable)
562 (set-cursor-color "#ffffff")))
563 (defun hydra-vi/hint nil
564 (if hydra-lv (lv-message (format #("vi: j, k, [q]: quit." 4 5 (face hydra-face-amaranth)
565 7 8 (face hydra-face-amaranth)
566 11 12 (face hydra-face-blue))))
567 (message (format #("vi: j, k, [q]: quit." 4 5 (face hydra-face-amaranth)
568 7 8 (face hydra-face-amaranth)
569 11 12 (face hydra-face-blue))))))
570 (defun hydra-vi/body nil "Create a hydra with no body and the heads:
571
572 \"\a\": `hydra-keyboard-quit',
573 \"j\": `next-line',
574 \"k\": `previous-line',
575 \"q\": `nil'
576
577 The body can be accessed via `hydra-vi/body'."
578 (interactive)
579 (hydra-default-pre)
580 (set-cursor-color "#e52b50")
581 (hydra-disable)
582 (catch (quote hydra-disable)
583 (when hydra-is-helpful (hydra-vi/hint))
584 (setq hydra-last
585 (hydra-set-transient-map
586 (setq hydra-curr-map
587 (quote (keymap (t lambda nil (interactive)
588 (message "An amaranth Hydra can only exit through a blue head")
589 (hydra-set-transient-map hydra-curr-map t)
590 (when hydra-is-helpful (unless hydra-lv (sit-for 0.8))
591 (hydra-vi/hint)))
592 (113 . hydra-vi/nil)
593 (107 . hydra-vi/previous-line)
594 (106 . hydra-vi/next-line)
595 (7 . hydra-vi/hydra-keyboard-quit-and-exit)
596 (switch-frame . hydra--handle-switch-frame)
597 (kp-subtract . hydra--negative-argument)
598 (kp-9 . hydra--digit-argument)
599 (kp-8 . hydra--digit-argument)
600 (kp-7 . hydra--digit-argument)
601 (kp-6 . hydra--digit-argument)
602 (kp-5 . hydra--digit-argument)
603 (kp-4 . hydra--digit-argument)
604 (kp-3 . hydra--digit-argument)
605 (kp-2 . hydra--digit-argument)
606 (kp-1 . hydra--digit-argument)
607 (kp-0 . hydra--digit-argument)
608 (57 . hydra--digit-argument)
609 (56 . hydra--digit-argument)
610 (55 . hydra--digit-argument)
611 (54 . hydra--digit-argument)
612 (53 . hydra--digit-argument)
613 (52 . hydra--digit-argument)
614 (51 . hydra--digit-argument)
615 (50 . hydra--digit-argument)
616 (49 . hydra--digit-argument)
617 (48 . hydra--digit-argument)
618 (45 . hydra--negative-argument)
619 (21 . hydra--universal-argument))))
620 t (lambda nil (hydra-cleanup))))
621 (setq prefix-arg current-prefix-arg)))))))
622
623 (ert-deftest defhydradio ()
624 (should (equal
625 (macroexpand
626 '(defhydradio hydra-test ()
627 (num "Num" [0 1 2 3 4 5 6 7 8 9 10])
628 (str "Str" ["foo" "bar" "baz"])))
629 '(progn
630 (defvar hydra-test/num 0
631 "Num")
632 (put 'hydra-test/num 'range [0 1 2 3 4 5 6 7 8 9 10])
633 (defun hydra-test/num ()
634 (hydra--cycle-radio 'hydra-test/num))
635 (defvar hydra-test/str "foo"
636 "Str")
637 (put 'hydra-test/str 'range ["foo" "bar" "baz"])
638 (defun hydra-test/str ()
639 (hydra--cycle-radio 'hydra-test/str))
640 (defvar hydra-test/names '(hydra-test/num hydra-test/str))))))
641
642 (ert-deftest hydra-blue-compat ()
643 (should
644 (equal
645 (macroexpand
646 '(defhydra hydra-toggle (:color blue)
647 "toggle"
648 ("t" toggle-truncate-lines "truncate")
649 ("f" auto-fill-mode "fill")
650 ("a" abbrev-mode "abbrev")
651 ("q" nil "cancel")))
652 (macroexpand
653 '(defhydra hydra-toggle (:exit t)
654 "toggle"
655 ("t" toggle-truncate-lines "truncate")
656 ("f" auto-fill-mode "fill")
657 ("a" abbrev-mode "abbrev")
658 ("q" nil "cancel"))))))
659
660 (ert-deftest hydra-amaranth-compat ()
661 (should
662 (equal
663 (macroexpand
664 '(defhydra hydra-vi
665 (:pre
666 (set-cursor-color "#e52b50")
667 :post
668 (set-cursor-color "#ffffff")
669 :color amaranth)
670 "vi"
671 ("j" next-line)
672 ("k" previous-line)
673 ("q" nil "quit")))
674 (macroexpand
675 '(defhydra hydra-vi
676 (:pre
677 (set-cursor-color "#e52b50")
678 :post
679 (set-cursor-color "#ffffff")
680 :foreign-keys warn)
681 "vi"
682 ("j" next-line)
683 ("k" previous-line)
684 ("q" nil "quit"))))))
685
686 (ert-deftest hydra-pink-compat ()
687 (should
688 (equal
689 (macroexpand
690 '(defhydra hydra-zoom (global-map "<f2>"
691 :color pink)
692 "zoom"
693 ("g" text-scale-increase "in")
694 ("l" text-scale-decrease "out")
695 ("q" nil "quit")))
696 (macroexpand
697 '(defhydra hydra-zoom (global-map "<f2>"
698 :foreign-keys run)
699 "zoom"
700 ("g" text-scale-increase "in")
701 ("l" text-scale-decrease "out")
702 ("q" nil "quit"))))))
703
704 (ert-deftest hydra-teal-compat ()
705 (should
706 (equal
707 (macroexpand
708 '(defhydra hydra-zoom (global-map "<f2>"
709 :color teal)
710 "zoom"
711 ("g" text-scale-increase "in")
712 ("l" text-scale-decrease "out")
713 ("q" nil "quit")))
714 (macroexpand
715 '(defhydra hydra-zoom (global-map "<f2>"
716 :foreign-keys warn
717 :exit t)
718 "zoom"
719 ("g" text-scale-increase "in")
720 ("l" text-scale-decrease "out")
721 ("q" nil "quit"))))))
722
723 (ert-deftest hydra-format-1 ()
724 (should (equal
725 (let ((hydra-fontify-head-function
726 'hydra-fontify-head-greyscale))
727 (hydra--format
728 'hydra-toggle
729 nil
730 "
731 _a_ abbrev-mode: %`abbrev-mode
732 _d_ debug-on-error: %`debug-on-error
733 _f_ auto-fill-mode: %`auto-fill-function
734 " '(("a" abbrev-mode nil)
735 ("d" toggle-debug-on-error nil)
736 ("f" auto-fill-mode nil)
737 ("g" golden-ratio-mode nil)
738 ("t" toggle-truncate-lines nil)
739 ("w" whitespace-mode nil)
740 ("q" nil "quit"))))
741 '(concat (format "%s abbrev-mode: %S
742 %s debug-on-error: %S
743 %s auto-fill-mode: %S
744 " "{a}" abbrev-mode "{d}" debug-on-error "{f}" auto-fill-function) "[[q]]: quit"))))
745
746 (ert-deftest hydra-format-2 ()
747 (should (equal
748 (let ((hydra-fontify-head-function
749 'hydra-fontify-head-greyscale))
750 (hydra--format
751 'bar
752 nil
753 "\n bar %s`foo\n"
754 '(("a" (quote t) "" :cmd-name bar/lambda-a)
755 ("q" nil "" :cmd-name bar/nil))))
756 '(concat (format " bar %s\n" foo) "{a}, [q]"))))
757
758 (ert-deftest hydra-format-3 ()
759 (should (equal
760 (let ((hydra-fontify-head-function
761 'hydra-fontify-head-greyscale))
762 (hydra--format
763 'bar
764 nil
765 "\n_<SPC>_ ^^ace jump\n"
766 '(("<SPC>" ace-jump-char-mode nil :cmd-name bar/ace-jump-char-mode))))
767 '(concat (format "%s ace jump\n" "{<SPC>}") ""))))
768
769 (ert-deftest hydra-format-4 ()
770 (should
771 (equal (hydra--format
772 nil
773 '(nil nil :hint nil)
774 "\n_j_,_k_"
775 '(("j" nil) ("k" nil)))
776 '(concat (format "%s,%s"
777 #("j" 0 1 (face hydra-face-blue))
778 #("k" 0 1 (face hydra-face-blue))) ""))))
779
780 (ert-deftest hydra-format-with-sexp-1 ()
781 (should (equal
782 (let ((hydra-fontify-head-function
783 'hydra-fontify-head-greyscale))
784 (hydra--format
785 'hydra-toggle nil
786 "\n_n_ narrow-or-widen-dwim %(progn (message \"checking\")(buffer-narrowed-p))asdf\n"
787 '(("n" narrow-to-region nil) ("q" nil "cancel"))))
788 '(concat (format "%s narrow-or-widen-dwim %Sasdf\n"
789 "{n}"
790 (progn
791 (message "checking")
792 (buffer-narrowed-p)))
793 "[[q]]: cancel"))))
794
795 (ert-deftest hydra-format-with-sexp-2 ()
796 (should (equal
797 (let ((hydra-fontify-head-function
798 'hydra-fontify-head-greyscale))
799 (hydra--format
800 'hydra-toggle nil
801 "\n_n_ narrow-or-widen-dwim %s(progn (message \"checking\")(buffer-narrowed-p))asdf\n"
802 '(("n" narrow-to-region nil) ("q" nil "cancel"))))
803 '(concat (format "%s narrow-or-widen-dwim %sasdf\n"
804 "{n}"
805 (progn
806 (message "checking")
807 (buffer-narrowed-p)))
808 "[[q]]: cancel"))))
809
810 (ert-deftest hydra-compat-colors-1 ()
811 (should (equal (hydra--head-color
812 '("e" (message "Exiting now") "blue")
813 '(nil nil :color blue))
814 'blue))
815 (should (equal (hydra--head-color
816 '("c" (message "Continuing") "red" :color red)
817 '(nil nil :color blue))
818 'red))
819 (should (equal (hydra--head-color
820 '("e" (message "Exiting now") "blue")
821 '(nil nil :exit t))
822 'blue))
823 (should (equal (hydra--head-color
824 '("j" next-line "" :exit t)
825 '(nil nil))
826 'blue))
827 (should (equal (hydra--head-color
828 '("c" (message "Continuing") "red" :exit nil)
829 '(nil nil :exit t))
830 'red))
831 (equal (hydra--head-color
832 '("a" abbrev-mode nil)
833 '(nil nil :color teal))
834 'teal)
835 (equal (hydra--head-color
836 '("a" abbrev-mode :exit nil)
837 '(nil nil :color teal))
838 'amaranth))
839
840 (ert-deftest hydra-compat-colors-2 ()
841 (should
842 (equal
843 (macroexpand
844 '(defhydra hydra-test (:color amaranth)
845 ("a" fun-a)
846 ("b" fun-b :color blue)
847 ("c" fun-c :color blue)
848 ("d" fun-d :color blue)
849 ("e" fun-e :color blue)
850 ("f" fun-f :color blue)))
851 (macroexpand
852 '(defhydra hydra-test (:color teal)
853 ("a" fun-a :color red)
854 ("b" fun-b)
855 ("c" fun-c)
856 ("d" fun-d)
857 ("e" fun-e)
858 ("f" fun-f))))))
859
860 (ert-deftest hydra-compat-colors-3 ()
861 (should
862 (equal
863 (macroexpand
864 '(defhydra hydra-test ()
865 ("a" fun-a)
866 ("b" fun-b :color blue)
867 ("c" fun-c :color blue)
868 ("d" fun-d :color blue)
869 ("e" fun-e :color blue)
870 ("f" fun-f :color blue)))
871 (macroexpand
872 '(defhydra hydra-test (:color blue)
873 ("a" fun-a :color red)
874 ("b" fun-b)
875 ("c" fun-c)
876 ("d" fun-d)
877 ("e" fun-e)
878 ("f" fun-f))))))
879
880 (ert-deftest hydra-compat-colors-4 ()
881 (should
882 (equal
883 (macroexpand
884 '(defhydra hydra-test ()
885 ("a" fun-a)
886 ("b" fun-b :exit t)
887 ("c" fun-c :exit t)
888 ("d" fun-d :exit t)
889 ("e" fun-e :exit t)
890 ("f" fun-f :exit t)))
891 (macroexpand
892 '(defhydra hydra-test (:exit t)
893 ("a" fun-a :exit nil)
894 ("b" fun-b)
895 ("c" fun-c)
896 ("d" fun-d)
897 ("e" fun-e)
898 ("f" fun-f))))))
899
900 (ert-deftest hydra-zoom-duplicate-1 ()
901 (should
902 (equal
903 (macroexpand
904 '(defhydra hydra-zoom ()
905 "zoom"
906 ("r" (text-scale-set 0) "reset")
907 ("0" (text-scale-set 0) :bind nil :exit t)
908 ("1" (text-scale-set 0) nil :bind nil :exit t)))
909 '(progn
910 (defun hydra-zoom/lambda-r nil "Create a hydra with no body and the heads:
911
912 \"r\": `(text-scale-set 0)',
913 \"0\": `(text-scale-set 0)',
914 \"1\": `(text-scale-set 0)'
915
916 The body can be accessed via `hydra-zoom/body'.
917
918 Call the head: `(text-scale-set 0)'."
919 (interactive)
920 (hydra-default-pre)
921 (hydra-disable)
922 (catch (quote hydra-disable)
923 (condition-case err (prog1 t (call-interactively (function (lambda nil (interactive)
924 (text-scale-set 0)))))
925 ((quit error)
926 (message "%S" err)
927 (unless hydra-lv (sit-for 0.8))
928 nil))
929 (when hydra-is-helpful (hydra-zoom/hint))
930 (setq hydra-last
931 (hydra-set-transient-map
932 (setq hydra-curr-map
933 (quote (keymap (7 . hydra-keyboard-quit)
934 (114 . hydra-zoom/lambda-r)
935 (switch-frame . hydra--handle-switch-frame)
936 (kp-subtract . hydra--negative-argument)
937 (kp-9 . hydra--digit-argument)
938 (kp-8 . hydra--digit-argument)
939 (kp-7 . hydra--digit-argument)
940 (kp-6 . hydra--digit-argument)
941 (kp-5 . hydra--digit-argument)
942 (kp-4 . hydra--digit-argument)
943 (kp-3 . hydra--digit-argument)
944 (kp-2 . hydra--digit-argument)
945 (kp-1 . hydra--digit-argument)
946 (kp-0 . hydra--digit-argument)
947 (57 . hydra--digit-argument)
948 (56 . hydra--digit-argument)
949 (55 . hydra--digit-argument)
950 (54 . hydra--digit-argument)
951 (53 . hydra--digit-argument)
952 (52 . hydra--digit-argument)
953 (51 . hydra--digit-argument)
954 (50 . hydra--digit-argument)
955 (49 . hydra-zoom/lambda-0-and-exit)
956 (48 . hydra-zoom/lambda-0-and-exit)
957 (45 . hydra--negative-argument)
958 (21 . hydra--universal-argument))))
959 t (lambda nil (hydra-cleanup))))))
960 (defun hydra-zoom/lambda-0-and-exit nil "Create a hydra with no body and the heads:
961
962 \"r\": `(text-scale-set 0)',
963 \"0\": `(text-scale-set 0)',
964 \"1\": `(text-scale-set 0)'
965
966 The body can be accessed via `hydra-zoom/body'.
967
968 Call the head: `(text-scale-set 0)'."
969 (interactive)
970 (hydra-default-pre)
971 (hydra-disable)
972 (hydra-cleanup)
973 (catch (quote hydra-disable)
974 (call-interactively (function (lambda nil (interactive)
975 (text-scale-set 0))))))
976 (defun hydra-zoom/hint nil
977 (if hydra-lv (lv-message (format #("zoom: [r 0]: reset." 7 8 (face hydra-face-red)
978 9 10 (face hydra-face-blue))))
979 (message (format #("zoom: [r 0]: reset." 7 8 (face hydra-face-red)
980 9 10 (face hydra-face-blue))))))
981 (defun hydra-zoom/body nil "Create a hydra with no body and the heads:
982
983 \"r\": `(text-scale-set 0)',
984 \"0\": `(text-scale-set 0)',
985 \"1\": `(text-scale-set 0)'
986
987 The body can be accessed via `hydra-zoom/body'."
988 (interactive)
989 (hydra-default-pre)
990 (hydra-disable)
991 (catch (quote hydra-disable)
992 (when hydra-is-helpful (hydra-zoom/hint))
993 (setq hydra-last
994 (hydra-set-transient-map
995 (setq hydra-curr-map
996 (quote (keymap (7 . hydra-keyboard-quit)
997 (114 . hydra-zoom/lambda-r)
998 (switch-frame . hydra--handle-switch-frame)
999 (kp-subtract . hydra--negative-argument)
1000 (kp-9 . hydra--digit-argument)
1001 (kp-8 . hydra--digit-argument)
1002 (kp-7 . hydra--digit-argument)
1003 (kp-6 . hydra--digit-argument)
1004 (kp-5 . hydra--digit-argument)
1005 (kp-4 . hydra--digit-argument)
1006 (kp-3 . hydra--digit-argument)
1007 (kp-2 . hydra--digit-argument)
1008 (kp-1 . hydra--digit-argument)
1009 (kp-0 . hydra--digit-argument)
1010 (57 . hydra--digit-argument)
1011 (56 . hydra--digit-argument)
1012 (55 . hydra--digit-argument)
1013 (54 . hydra--digit-argument)
1014 (53 . hydra--digit-argument)
1015 (52 . hydra--digit-argument)
1016 (51 . hydra--digit-argument)
1017 (50 . hydra--digit-argument)
1018 (49 . hydra-zoom/lambda-0-and-exit)
1019 (48 . hydra-zoom/lambda-0-and-exit)
1020 (45 . hydra--negative-argument)
1021 (21 . hydra--universal-argument))))
1022 t (lambda nil (hydra-cleanup))))
1023 (setq prefix-arg current-prefix-arg)))))))
1024
1025 (ert-deftest hydra-zoom-duplicate-2 ()
1026 (should
1027 (equal
1028 (macroexpand
1029 '(defhydra hydra-zoom ()
1030 "zoom"
1031 ("r" (text-scale-set 0) "reset")
1032 ("0" (text-scale-set 0) :bind nil :exit t)
1033 ("1" (text-scale-set 0) nil :bind nil)))
1034 '(progn
1035 (defun hydra-zoom/lambda-r nil "Create a hydra with no body and the heads:
1036
1037 \"r\": `(text-scale-set 0)',
1038 \"0\": `(text-scale-set 0)',
1039 \"1\": `(text-scale-set 0)'
1040
1041 The body can be accessed via `hydra-zoom/body'.
1042
1043 Call the head: `(text-scale-set 0)'."
1044 (interactive)
1045 (hydra-default-pre)
1046 (hydra-disable)
1047 (catch (quote hydra-disable)
1048 (condition-case err (prog1 t (call-interactively (function (lambda nil (interactive)
1049 (text-scale-set 0)))))
1050 ((quit error)
1051 (message "%S" err)
1052 (unless hydra-lv (sit-for 0.8))
1053 nil))
1054 (when hydra-is-helpful (hydra-zoom/hint))
1055 (setq hydra-last
1056 (hydra-set-transient-map
1057 (setq hydra-curr-map
1058 (quote (keymap (7 . hydra-keyboard-quit)
1059 (114 . hydra-zoom/lambda-r)
1060 (switch-frame . hydra--handle-switch-frame)
1061 (kp-subtract . hydra--negative-argument)
1062 (kp-9 . hydra--digit-argument)
1063 (kp-8 . hydra--digit-argument)
1064 (kp-7 . hydra--digit-argument)
1065 (kp-6 . hydra--digit-argument)
1066 (kp-5 . hydra--digit-argument)
1067 (kp-4 . hydra--digit-argument)
1068 (kp-3 . hydra--digit-argument)
1069 (kp-2 . hydra--digit-argument)
1070 (kp-1 . hydra--digit-argument)
1071 (kp-0 . hydra--digit-argument)
1072 (57 . hydra--digit-argument)
1073 (56 . hydra--digit-argument)
1074 (55 . hydra--digit-argument)
1075 (54 . hydra--digit-argument)
1076 (53 . hydra--digit-argument)
1077 (52 . hydra--digit-argument)
1078 (51 . hydra--digit-argument)
1079 (50 . hydra--digit-argument)
1080 (49 . hydra-zoom/lambda-r)
1081 (48 . hydra-zoom/lambda-0-and-exit)
1082 (45 . hydra--negative-argument)
1083 (21 . hydra--universal-argument))))
1084 t (lambda nil (hydra-cleanup))))))
1085 (defun hydra-zoom/lambda-0-and-exit nil "Create a hydra with no body and the heads:
1086
1087 \"r\": `(text-scale-set 0)',
1088 \"0\": `(text-scale-set 0)',
1089 \"1\": `(text-scale-set 0)'
1090
1091 The body can be accessed via `hydra-zoom/body'.
1092
1093 Call the head: `(text-scale-set 0)'."
1094 (interactive)
1095 (hydra-default-pre)
1096 (hydra-disable)
1097 (hydra-cleanup)
1098 (catch (quote hydra-disable)
1099 (call-interactively (function (lambda nil (interactive)
1100 (text-scale-set 0))))))
1101 (defun hydra-zoom/hint nil
1102 (if hydra-lv (lv-message (format #("zoom: [r 0]: reset." 7 8 (face hydra-face-red)
1103 9 10 (face hydra-face-blue))))
1104 (message (format #("zoom: [r 0]: reset." 7 8 (face hydra-face-red)
1105 9 10 (face hydra-face-blue))))))
1106 (defun hydra-zoom/body nil "Create a hydra with no body and the heads:
1107
1108 \"r\": `(text-scale-set 0)',
1109 \"0\": `(text-scale-set 0)',
1110 \"1\": `(text-scale-set 0)'
1111
1112 The body can be accessed via `hydra-zoom/body'."
1113 (interactive)
1114 (hydra-default-pre)
1115 (hydra-disable)
1116 (catch (quote hydra-disable)
1117 (when hydra-is-helpful (hydra-zoom/hint))
1118 (setq hydra-last
1119 (hydra-set-transient-map
1120 (setq hydra-curr-map
1121 (quote (keymap (7 . hydra-keyboard-quit)
1122 (114 . hydra-zoom/lambda-r)
1123 (switch-frame . hydra--handle-switch-frame)
1124 (kp-subtract . hydra--negative-argument)
1125 (kp-9 . hydra--digit-argument)
1126 (kp-8 . hydra--digit-argument)
1127 (kp-7 . hydra--digit-argument)
1128 (kp-6 . hydra--digit-argument)
1129 (kp-5 . hydra--digit-argument)
1130 (kp-4 . hydra--digit-argument)
1131 (kp-3 . hydra--digit-argument)
1132 (kp-2 . hydra--digit-argument)
1133 (kp-1 . hydra--digit-argument)
1134 (kp-0 . hydra--digit-argument)
1135 (57 . hydra--digit-argument)
1136 (56 . hydra--digit-argument)
1137 (55 . hydra--digit-argument)
1138 (54 . hydra--digit-argument)
1139 (53 . hydra--digit-argument)
1140 (52 . hydra--digit-argument)
1141 (51 . hydra--digit-argument)
1142 (50 . hydra--digit-argument)
1143 (49 . hydra-zoom/lambda-r)
1144 (48 . hydra-zoom/lambda-0-and-exit)
1145 (45 . hydra--negative-argument)
1146 (21 . hydra--universal-argument))))
1147 t (lambda nil (hydra-cleanup))))
1148 (setq prefix-arg current-prefix-arg)))))))
1149
1150 (ert-deftest hydra--pad ()
1151 (should (equal (hydra--pad '(a b c) 3)
1152 '(a b c)))
1153 (should (equal (hydra--pad '(a) 3)
1154 '(a nil nil))))
1155
1156 (ert-deftest hydra--matrix ()
1157 (should (equal (hydra--matrix '(a b c) 2 2)
1158 '((a b) (c nil))))
1159 (should (equal (hydra--matrix '(a b c d e f g h i) 4 3)
1160 '((a b c d) (e f g h) (i nil nil nil)))))
1161
1162 (ert-deftest hydra--cell ()
1163 (should (equal (hydra--cell "% -75s %%`%s" '(hydra-lv hydra-verbose))
1164 "When non-nil, `lv-message' (not `message') will be used to display hints. %`hydra-lv^^^^^
1165 When non-nil, hydra will issue some non essential style warnings. %`hydra-verbose")))
1166
1167 (ert-deftest hydra--vconcat ()
1168 (should (equal (hydra--vconcat '("abc\ndef" "012\n34" "def\nabc"))
1169 "abc012def\ndef34abc")))
1170
1171 (defhydradio hydra-tng ()
1172 (picard "_p_ Captain Jean Luc Picard:")
1173 (riker "_r_ Commander William Riker:")
1174 (data "_d_ Lieutenant Commander Data:")
1175 (worf "_w_ Worf:")
1176 (la-forge "_f_ Geordi La Forge:")
1177 (troi "_t_ Deanna Troi:")
1178 (dr-crusher "_c_ Doctor Beverly Crusher:")
1179 (phaser "_h_ Set phasers to " [stun kill]))
1180
1181 (ert-deftest hydra--table ()
1182 (let ((hydra-cell-format "% -30s %% -8`%s"))
1183 (should (equal (hydra--table hydra-tng/names 5 2)
1184 (substring "
1185 _p_ Captain Jean Luc Picard: % -8`hydra-tng/picard^^ _t_ Deanna Troi: % -8`hydra-tng/troi^^^^^^
1186 _r_ Commander William Riker: % -8`hydra-tng/riker^^^ _c_ Doctor Beverly Crusher: % -8`hydra-tng/dr-crusher
1187 _d_ Lieutenant Commander Data: % -8`hydra-tng/data^^^^ _h_ Set phasers to % -8`hydra-tng/phaser^^^^
1188 _w_ Worf: % -8`hydra-tng/worf^^^^
1189 _f_ Geordi La Forge: % -8`hydra-tng/la-forge" 1)))
1190 (should (equal (hydra--table hydra-tng/names 4 3)
1191 (substring "
1192 _p_ Captain Jean Luc Picard: % -8`hydra-tng/picard _f_ Geordi La Forge: % -8`hydra-tng/la-forge^^
1193 _r_ Commander William Riker: % -8`hydra-tng/riker^ _t_ Deanna Troi: % -8`hydra-tng/troi^^^^^^
1194 _d_ Lieutenant Commander Data: % -8`hydra-tng/data^^ _c_ Doctor Beverly Crusher: % -8`hydra-tng/dr-crusher
1195 _w_ Worf: % -8`hydra-tng/worf^^ _h_ Set phasers to % -8`hydra-tng/phaser^^^^" 1)))))
1196
1197 (ert-deftest hydra--make-funcall ()
1198 (should (equal (let ((body-pre 'foo))
1199 (hydra--make-funcall body-pre)
1200 body-pre)
1201 '(funcall (function foo)))))
1202
1203 (provide 'hydra-test)
1204
1205 ;;; hydra-test.el ends here