dabbrev-tests.el 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. ;;; dabbrev-tests.el --- Test suite for dabbrev.
  2. ;; Copyright (C) 2016 Free Software Foundation, Inc.
  3. ;; Author: Alan Third <alan@idiocy.org>
  4. ;; Keywords: dabbrev
  5. ;; This file is part of GNU Emacs.
  6. ;; GNU Emacs is free software: you can redistribute it and/or modify
  7. ;; it under the terms of the GNU General Public License as published by
  8. ;; the Free Software Foundation, either version 3 of the License, or
  9. ;; (at your option) any later version.
  10. ;; GNU Emacs is distributed in the hope that it will be useful,
  11. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ;; GNU General Public License for more details.
  14. ;; You should have received a copy of the GNU General Public License
  15. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  16. ;;; Commentary:
  17. ;;; Code:
  18. (require 'ert)
  19. (require 'dabbrev)
  20. (ert-deftest dabbrev-expand-test ()
  21. "Test for bug#1948.
  22. When DABBREV-ELIMINATE-NEWLINES is non-nil (the default),
  23. repeated calls to DABBREV-EXPAND can result in the source of
  24. first expansion being replaced rather than the destination."
  25. (with-temp-buffer
  26. (insert "ab x\na\nab y")
  27. (goto-char 8)
  28. (save-window-excursion
  29. (set-window-buffer nil (current-buffer))
  30. ;; M-/ SPC M-/ M-/
  31. (execute-kbd-macro "\257 \257\257"))
  32. (should (string= (buffer-string) "ab x\nab y\nab y"))))