Fix typo in lisp.h reordering patch
[emacs.git] / test / src / marker-tests.el
blob18d49addb2fe2a993d46b5ea17e5bd843a51a957
1 ;;; marker-tests.el --- tests for marker.c functions -*- lexical-binding: t -*-
3 ;; Copyright (C) 2016 Free Software Foundation, Inc.
5 ;; This file is part of GNU Emacs.
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.
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.
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/>.
20 ;;; Code:
22 (require 'ert)
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).
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))))
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)))))
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))))
60 ;;; marker-tests.el ends here.