* configure.ac (USE_CAIRO): Rename to more standard HAVE_CAIRO.
[emacs.git] / test / automated / message-mode-tests.el
blob3afa1569f64cdaaba73ee0d88d4428cce012e3cd
1 ;;; message-mode-tests.el --- Tests for message-mode -*- lexical-binding: t; -*-
3 ;; Copyright (C) 2015-2016 Free Software Foundation, Inc.
5 ;; Author: João Távora <joaotavora@gmail.com>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22 ;;; Commentary:
24 ;; This file contains tests for message-mode.
26 ;;; Code:
28 (require 'message)
29 (require 'ert)
30 (require 'ert-x)
32 (ert-deftest message-mode-propertize ()
33 (with-temp-buffer
34 (unwind-protect
35 (let (message-auto-save-directory)
36 (message-mode)
37 (insert "here's an opener (\n"
38 "here's a sad face :-(\n"
39 "> here's citing someone with an opener (\n"
40 "and here's a closer ")
41 (let ((last-command-event ?\)))
42 (ert-simulate-command '(self-insert-command 1)))
43 ;; Auto syntax propertization doesn't kick in until
44 ;; parse-sexp-lookup-properties is set.
45 (setq-local parse-sexp-lookup-properties t)
46 (backward-sexp)
47 (should (string= "here's an opener "
48 (buffer-substring-no-properties
49 (line-beginning-position)
50 (point))))
51 (forward-sexp)
52 (should (string= "and here's a closer )"
53 (buffer-substring-no-properties
54 (line-beginning-position)
55 (point)))))
56 (set-buffer-modified-p nil))))
58 (provide 'message-mode-tests)
60 ;;; message-mode-tests.el ends here