aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorPhil Sainty2019-11-16 15:48:44 +1300
committerPhil Sainty2019-11-18 21:25:36 +1300
commit33676820bdb0fac8ebd43ab098ad13d8098f3586 (patch)
treea4e00fdc443747599ed042e863756a81f331bd64 /test
parent83c50cc6efacf701ba64c2f4175ece7ebff9b338 (diff)
downloademacs-33676820bdb0fac8ebd43ab098ad13d8098f3586.tar.gz
emacs-33676820bdb0fac8ebd43ab098ad13d8098f3586.zip
lisp/so-long.el: Refactor menu action commands
* lisp/so-long.el (so-long-menu): Call `so-long' with an ACTION argument instead of using `so-long-menu-item-replace-action'. (so-long-menu-item-replace-action): Remove the deprecated function. * test/lisp/so-long-tests/so-long-tests.el (so-long-tests-so-long-menu-item-replace-action): Update the test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/so-long-tests/so-long-tests.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/lisp/so-long-tests/so-long-tests.el b/test/lisp/so-long-tests/so-long-tests.el
index 5c885c4fd09..ae834421667 100644
--- a/test/lisp/so-long-tests/so-long-tests.el
+++ b/test/lisp/so-long-tests/so-long-tests.el
@@ -259,22 +259,24 @@
259 (so-long-tests-assert-and-revert (or action 'so-long-mode))))) 259 (so-long-tests-assert-and-revert (or action 'so-long-mode)))))
260 260
261(ert-deftest so-long-tests-so-long-menu-item-replace-action () 261(ert-deftest so-long-tests-so-long-menu-item-replace-action ()
262 "Test using the `so-long-menu-item-replace-action' menu item." 262 "Test using the `so-long-menu' action commands."
263 (with-temp-buffer 263 (with-temp-buffer
264 (insert "#!emacs\n") 264 (insert "#!emacs\n")
265 (normal-mode) 265 (normal-mode)
266 (so-long-tests-remember) 266 (so-long-tests-remember)
267 (insert (make-string (1+ so-long-threshold) ?x)) 267 (insert (make-string (1+ so-long-threshold) ?x))
268 (let (action) 268 (let ((menu (so-long-menu))
269 action
270 command)
269 (dolist (item so-long-action-alist) 271 (dolist (item so-long-action-alist)
270 ;; n.b. Any existing action is first reverted. 272 (setq action (car item)
271 (so-long-menu-item-replace-action item) 273 command (lookup-key menu (vector action)))
272 (setq action (car item)) 274 (funcall command)
273 (so-long-tests-assert-active action)) 275 (so-long-tests-assert-active action))
274 ;; After all actions have been used, revert to normal and assert 276 ;; After all actions have been used, revert to normal and assert
275 ;; that the most recent action to have been applied is the one 277 ;; that the most recent action to have been applied is the one
276 ;; we have just reverted. 278 ;; we have just reverted.
277 (so-long-revert) 279 (funcall (lookup-key menu [so-long-revert]))
278 (so-long-tests-assert-reverted action)))) 280 (so-long-tests-assert-reverted action))))
279 281
280(ert-deftest so-long-tests-major-mode () 282(ert-deftest so-long-tests-major-mode ()