[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 60483cb 09/45: Add integration testing
From: |
Oleh Krehel |
Subject: |
[elpa] master 60483cb 09/45: Add integration testing |
Date: |
Thu, 16 Apr 2015 12:45:42 +0000 |
branch: master
commit 60483cb282b2b6eb40585decb781f2ae2bed44a0
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Add integration testing
* hydra-test.el (hydra-simple): Add example hydra that will be run.
(hydra-with): New defmacro.
(hydra-integration-1): Add test.
Re #101
---
hydra-test.el | 42 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 42 insertions(+), 0 deletions(-)
diff --git a/hydra-test.el b/hydra-test.el
index bea27407..c101e2b 100644
--- a/hydra-test.el
+++ b/hydra-test.el
@@ -968,6 +968,48 @@ _w_ Worf: % -8`hydra-tng/worf^^
_h_ Set phasers to
body-pre)
'(funcall (function foo)))))
+(defhydra hydra-simple (global-map "C-c")
+ ("a" (insert "j"))
+ ("b" (insert "k"))
+ ("q" nil))
+
+(defmacro hydra-with (in &rest body)
+ `(let ((temp-buffer (generate-new-buffer " *temp*")))
+ (save-window-excursion
+ (unwind-protect
+ (progn
+ (switch-to-buffer temp-buffer)
+ (transient-mark-mode 1)
+ (insert ,in)
+ (goto-char (point-min))
+ (when (search-forward "~" nil t)
+ (backward-delete-char 1)
+ (set-mark (point)))
+ (goto-char (point-max))
+ (search-backward "|")
+ (delete-char 1)
+ (setq current-prefix-arg)
+ ,@body
+ (insert "|")
+ (when (region-active-p)
+ (exchange-point-and-mark)
+ (insert "~"))
+ (buffer-substring-no-properties
+ (point-min)
+ (point-max)))
+ (and (buffer-name temp-buffer)
+ (kill-buffer temp-buffer))))))
+
+(ert-deftest hydra-integration-1 ()
+ (should (string= (hydra-with "|"
+ (execute-kbd-macro
+ (kbd "C-c aabbaaqaabbaa")))
+ "jjkkjjaabbaa|"))
+ (should (string= (hydra-with "|"
+ (execute-kbd-macro
+ (kbd "C-c aabb C-g aaqaabbaa")))
+ "jjkkaaqaabbaa|")))
+
(provide 'hydra-test)
;;; hydra-test.el ends here
- [elpa] master updated (22139ae -> f972634), Oleh Krehel, 2015/04/16
- [elpa] master cc6accd 04/45: hydra.el (hydra--digit-argument): Fix for Emacs 24.3, Oleh Krehel, 2015/04/16
- [elpa] master e4cae0a 03/45: hydra.el (defhydra): Simplify :cmd-name part, Oleh Krehel, 2015/04/16
- [elpa] master c06c006 02/45: Use set/defvar for keymap, Oleh Krehel, 2015/04/16
- [elpa] master e7aaafb 07/45: hydra.el (hydra-pink-fallback): Allow prefix arguments, Oleh Krehel, 2015/04/16
- [elpa] master d0cc1c5 01/45: Define a keymap var for each hydra and re-use it, Oleh Krehel, 2015/04/16
- [elpa] master 666048c 10/45: Update testing setup, Oleh Krehel, 2015/04/16
- [elpa] master f9bf8fe 08/45: hydra.el (hydra-set-transient-map): Update, Oleh Krehel, 2015/04/16
- [elpa] master 60483cb 09/45: Add integration testing,
Oleh Krehel <=
- [elpa] master 4dde4f7 11/45: hydra.el (hydra--format): Add some more symbols, Oleh Krehel, 2015/04/16
- [elpa] master 3fce2bd 12/45: Try to re-encode the input in the terminal, Oleh Krehel, 2015/04/16
- [elpa] master fa5643f 15/45: Quit Hydra for `handle-switch-frame', Oleh Krehel, 2015/04/16
- [elpa] master af39a98 14/45: Adapt to the new `hydra-set-transient-map', Oleh Krehel, 2015/04/16
- [elpa] master acdec5b 27/45: Add an integration test for digit args in amaranth, Oleh Krehel, 2015/04/16
- [elpa] master 1a54e09 05/45: hydra.el (hydra--make-funcall): Update location, Oleh Krehel, 2015/04/16
- [elpa] master b351b7c 24/45: hydra.el (hydra--body-color): Remove, Oleh Krehel, 2015/04/16
- [elpa] master 5787a4d 13/45: Move away from setting "t" in keymaps, Oleh Krehel, 2015/04/16
- [elpa] master 5379642 06/45: Use `hydra-keyboard-quit' instead of `hydra-cleanup', Oleh Krehel, 2015/04/16
- [elpa] master e88839c 17/45: Don't double-call :post, Oleh Krehel, 2015/04/16