aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/dabbrev-tests.el34
1 files changed, 33 insertions, 1 deletions
diff --git a/test/lisp/dabbrev-tests.el b/test/lisp/dabbrev-tests.el
index 987106aa5af..b5737373875 100644
--- a/test/lisp/dabbrev-tests.el
+++ b/test/lisp/dabbrev-tests.el
@@ -238,7 +238,7 @@ entered."
238;; FIXME: Why is dabbrev--reset-global-variables needed here? 238;; FIXME: Why is dabbrev--reset-global-variables needed here?
239(ert-deftest dabbrev-expand-test-minibuffer-3 () 239(ert-deftest dabbrev-expand-test-minibuffer-3 ()
240 "Test replacing an expansion in the minibuffer using two buffers. 240 "Test replacing an expansion in the minibuffer using two buffers.
241The first expansion should befound in the buffer from which the 241The first expansion should be found in the buffer from which the
242minibuffer was entered, the replacement should found in another buffer." 242minibuffer was entered, the replacement should found in another buffer."
243 (with-dabbrev-test 243 (with-dabbrev-test
244 (find-file (ert-resource-file "INSTALL_BEGIN")) 244 (find-file (ert-resource-file "INSTALL_BEGIN"))
@@ -275,4 +275,36 @@ minibuffer was entered, the replacement should found in another buffer."
275 (should (string= (minibuffer-contents) "Indic and")) 275 (should (string= (minibuffer-contents) "Indic and"))
276 (delete-minibuffer-contents)))) 276 (delete-minibuffer-contents))))
277 277
278(ert-deftest dabbrev-expand-after-killing-buffer ()
279 "Test expansion after killing buffer containing first expansion.
280Finding successive expansions in another live buffer should succeed, but
281after killing the buffer, expansion should fail with a user-error."
282 ;; FIXME? The message shown by the user-error is in *Messages* but
283 ;; since the test finishes on hitting the user-error, we cannot test
284 ;; further, either for the content of the message or the content of
285 ;; the current buffer, so apparently cannot reproduce what a user
286 ;; entering these commands manually sees.
287 (with-dabbrev-test
288 (with-current-buffer (get-buffer-create "foo")
289 (insert "abc abd"))
290 (switch-to-buffer "*scratch*")
291 (erase-buffer)
292 (execute-kbd-macro (kbd "ab M-/"))
293 (should (string= (buffer-string) "abc"))
294 (execute-kbd-macro (kbd "SPC ab M-/"))
295 (should (string= (buffer-string) "abc abc"))
296 (erase-buffer)
297 (execute-kbd-macro (kbd "abc SPC ab M-/ M-/"))
298 (should (string= (buffer-string) "abc abd"))
299 (kill-buffer "foo")
300 (erase-buffer)
301 (should-error (execute-kbd-macro (kbd "abc SPC ab M-/ M-/"))
302 :type 'user-error)
303 ;; (should (string= (buffer-string) "abc abc"))
304 ;; (with-current-buffer "*Messages*"
305 ;; (goto-char (point-max))
306 ;; (should (string= (buffer-substring (pos-bol) (pos-eol))
307 ;; "No further dynamic expansion for ‘ab’ found")))
308 ))
309
278;;; dabbrev-tests.el ends here 310;;; dabbrev-tests.el ends here