diff options
| author | Martin Rudalics | 2016-09-08 08:28:59 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2016-09-08 08:28:59 +0200 |
| commit | ba5d32398ba42fcf14ad5242d95c68133981744f (patch) | |
| tree | c40b762a52537cacc7a45198d7907b5ce4ea6851 /test/src | |
| parent | d2f1971dd570439da4198fa76603b53b072060f8 (diff) | |
| download | emacs-ba5d32398ba42fcf14ad5242d95c68133981744f.tar.gz emacs-ba5d32398ba42fcf14ad5242d95c68133981744f.zip | |
New file test/src/marker-tests.el
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/marker-tests.el | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/test/src/marker-tests.el b/test/src/marker-tests.el new file mode 100644 index 00000000000..18d49addb2f --- /dev/null +++ b/test/src/marker-tests.el | |||
| @@ -0,0 +1,60 @@ | |||
| 1 | ;;; marker-tests.el --- tests for marker.c functions -*- lexical-binding: t -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2016 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; This file is part of GNU Emacs. | ||
| 6 | |||
| 7 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 8 | ;; it under the terms of the GNU General Public License as published by | ||
| 9 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 10 | ;; (at your option) any later version. | ||
| 11 | |||
| 12 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | ;; GNU General Public License for more details. | ||
| 16 | |||
| 17 | ;; You should have received a copy of the GNU General Public License | ||
| 18 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 19 | |||
| 20 | ;;; Code: | ||
| 21 | |||
| 22 | (require 'ert) | ||
| 23 | |||
| 24 | ;; The following three tests assert that Emacs survives operations | ||
| 25 | ;; copying a marker whose character position differs from its byte | ||
| 26 | ;; position into a buffer whose character size equals its byte size | ||
| 27 | ;; (Bug#24368). | ||
| 28 | |||
| 29 | (ert-deftest marker-set-window-start-from-other-buffer () | ||
| 30 | "`set-window-start' from other buffer's marker." | ||
| 31 | (let ((text-quoting-style 'curve)) | ||
| 32 | (describe-function 'describe-function)) | ||
| 33 | (let* ((help (get-buffer "*Help*")) | ||
| 34 | (marker (with-current-buffer help | ||
| 35 | (copy-marker (point-max))))) | ||
| 36 | (should (set-window-start (selected-window) marker)))) | ||
| 37 | |||
| 38 | (ert-deftest marker-set-window-point-from-other-buffer () | ||
| 39 | "`set-window-point' from another buffer's marker." | ||
| 40 | (let ((text-quoting-style 'curve)) | ||
| 41 | (describe-function 'describe-function)) | ||
| 42 | (let* ((help (get-buffer "*Help*")) | ||
| 43 | (marker (with-current-buffer help | ||
| 44 | (copy-marker (point-max))))) | ||
| 45 | (with-selected-window (get-buffer-window help) | ||
| 46 | (should (set-window-point (get-buffer-window "*scratch*") marker))))) | ||
| 47 | |||
| 48 | (ert-deftest marker-goto-char-from-other-buffer () | ||
| 49 | "`goto-char' from another buffer's marker." | ||
| 50 | (let ((text-quoting-style 'curve)) | ||
| 51 | (describe-function 'describe-function)) | ||
| 52 | (let ((marker-1 (make-marker)) | ||
| 53 | (marker-2 (make-marker))) | ||
| 54 | (describe-function 'describe-function) | ||
| 55 | (with-current-buffer "*Help*" | ||
| 56 | (set-marker marker-1 (point-max))) | ||
| 57 | (set-marker marker-2 marker-1) | ||
| 58 | (should (goto-char marker-2)))) | ||
| 59 | |||
| 60 | ;;; marker-tests.el ends here. | ||