aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGlenn Morris2019-05-14 17:18:18 -0700
committerGlenn Morris2019-05-14 17:18:18 -0700
commit5fe9375a5164960c3ecb65a7ef6d742069b8a7d7 (patch)
tree315715009d9fe5af40be38cb0dfccecfaf4c5528 /test
parent0f63e17663f99742425c9ec4f282f5e7e3194b1b (diff)
parent02bee7860f7e650ef13e00fe1a7f9a362e3eb001 (diff)
downloademacs-5fe9375a5164960c3ecb65a7ef6d742069b8a7d7.tar.gz
emacs-5fe9375a5164960c3ecb65a7ef6d742069b8a7d7.zip
Merge from origin/emacs-26
02bee78 Let dir locals for more specific modes override those from less b1235f9 Improve documentation of Hexl mode 32d1813 Fix description of (move-to-column <n> t) when column <n> is ... 0397b7c ; Fix smtpmail-stream-type docstring 7dab3ee Recognize single quote attribute values in nxml and sgml (Bug... e4cde42 Disable extra display of &#10; in nxml-mode (Bug#32897) ca14dd1 Fix nxml-get-inside (Bug#32003) e7ab351 Fix positioning client buffer as instructed by emacsclient # Conflicts: # lisp/files.el # lisp/textmodes/sgml-mode.el
Diffstat (limited to 'test')
-rw-r--r--test/lisp/nxml/nxml-mode-tests.el82
-rw-r--r--test/lisp/textmodes/sgml-mode-tests.el1
2 files changed, 82 insertions, 1 deletions
diff --git a/test/lisp/nxml/nxml-mode-tests.el b/test/lisp/nxml/nxml-mode-tests.el
new file mode 100644
index 00000000000..92744be619d
--- /dev/null
+++ b/test/lisp/nxml/nxml-mode-tests.el
@@ -0,0 +1,82 @@
1;;; nxml-mode-tests.el --- Test NXML Mode -*- lexical-binding: t; -*-
2
3;; Copyright (C) 2019 Free Software Foundation, Inc.
4
5;; GNU Emacs is free software: you can redistribute it and/or modify
6;; it under the terms of the GNU General Public License as published by
7;; the Free Software Foundation, either version 3 of the License, or
8;; (at your option) any later version.
9
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
15;; You should have received a copy of the GNU General Public License
16;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
17
18;;; Code:
19
20(require 'ert)
21(require 'nxml-mode)
22
23(defun nxml-mode-tests-correctly-indented-string (str)
24 (with-temp-buffer
25 (nxml-mode)
26 (insert str)
27 (indent-region (point-min) (point-max))
28 (equal (buffer-string) str)))
29
30(ert-deftest nxml-indent-line-after-attribute ()
31 (should (nxml-mode-tests-correctly-indented-string "
32<settings
33 xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\"
34 xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
35 xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0
36 https://maven.apache.org/xsd/settings-1.0.0.xsd\">
37 <mirrors>
38 ...
39 </mirrors>
40</settings>
41"))
42 (should (nxml-mode-tests-correctly-indented-string "\
43<x>
44 <abc xx=\"x/x/x/x/x/x/x/
45 y/y/y/y/y/y/
46 \">
47 <zzz/>
48 </abc>
49 <nl>&#10;</nl>
50</x>
51")))
52
53(ert-deftest nxml-balanced-close-start-tag-inline ()
54 (with-temp-buffer
55 (nxml-mode)
56 (insert "<a><b c=\"\"</a>")
57 (search-backward "</a>")
58 (nxml-balanced-close-start-tag-inline)
59 (should (equal (buffer-string) "<a><b c=\"\"></b></a>"))))
60
61(ert-deftest nxml-mode-font-lock-quotes ()
62 (with-temp-buffer
63 (nxml-mode)
64 (insert "<x a=\"dquote attr\" b='squote attr'>\"dquote text\"'squote text'</x>")
65 (font-lock-ensure)
66 (let ((squote-txt-pos (search-backward "squote text"))
67 (dquote-txt-pos (search-backward "dquote text"))
68 (squote-att-pos (search-backward "squote attr"))
69 (dquote-att-pos (search-backward "dquote attr")))
70 ;; Just make sure that each quote uses the same face for quoted
71 ;; attribute values, and a different face for quoted text
72 ;; outside tags. Don't test `font-lock-string-face' vs
73 ;; `nxml-attribute-value' here.
74 (should (equal (get-text-property squote-att-pos 'face)
75 (get-text-property dquote-att-pos 'face)))
76 (should (equal (get-text-property squote-txt-pos 'face)
77 (get-text-property dquote-txt-pos 'face)))
78 (should-not (equal (get-text-property squote-txt-pos 'face)
79 (get-text-property dquote-att-pos 'face))))))
80
81(provide 'nxml-mode-tests)
82;;; nxml-mode-tests.el ends here
diff --git a/test/lisp/textmodes/sgml-mode-tests.el b/test/lisp/textmodes/sgml-mode-tests.el
index 61ae87e36db..4355e1c8658 100644
--- a/test/lisp/textmodes/sgml-mode-tests.el
+++ b/test/lisp/textmodes/sgml-mode-tests.el
@@ -125,7 +125,6 @@ The point is set to the beginning of the buffer."
125 (should (string= content (buffer-string)))))) 125 (should (string= content (buffer-string))))))
126 126
127(ert-deftest sgml-delete-tag-bug-8203-should-not-delete-apostrophe () 127(ert-deftest sgml-delete-tag-bug-8203-should-not-delete-apostrophe ()
128 :expected-result :failed
129 (sgml-with-content 128 (sgml-with-content
130 "<title>Winter is comin'</title>" 129 "<title>Winter is comin'</title>"
131 (sgml-delete-tag 1) 130 (sgml-delete-tag 1)