summaryrefslogtreecommitdiff
path: root/test/lisp/nxml/nxml-mode-tests.el
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2019-04-21 22:44:50 -0400
committerNoam Postavsky <npostavs@gmail.com>2019-05-09 06:42:40 -0400
commit7dab3ee7ab54b3c2e7bc24170376054786c01d6f (patch)
tree73b562aa6b3588215949f1ed4773e58b21d18dfd /test/lisp/nxml/nxml-mode-tests.el
parente4cde42657f8f91f795e6b7041dc50b896dc468d (diff)
downloademacs-7dab3ee7ab54b3c2e7bc24170376054786c01d6f.tar.gz
Recognize single quote attribute values in nxml and sgml (Bug#35381)
* lisp/textmodes/sgml-mode.el (sgml-specials): Add single quote. (sgml-syntax-propertize-rules): Handle single quote. * test/lisp/nxml/nxml-mode-tests.el (nxml-mode-font-lock-quotes): New test. * test/lisp/textmodes/sgml-mode-tests.el (sgml-delete-tag-bug-8203-should-not-delete-apostrophe): Now passes.
Diffstat (limited to 'test/lisp/nxml/nxml-mode-tests.el')
-rw-r--r--test/lisp/nxml/nxml-mode-tests.el20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/lisp/nxml/nxml-mode-tests.el b/test/lisp/nxml/nxml-mode-tests.el
index 57a731ad182..92744be619d 100644
--- a/test/lisp/nxml/nxml-mode-tests.el
+++ b/test/lisp/nxml/nxml-mode-tests.el
@@ -58,5 +58,25 @@
(nxml-balanced-close-start-tag-inline)
(should (equal (buffer-string) "<a><b c=\"\"></b></a>"))))
+(ert-deftest nxml-mode-font-lock-quotes ()
+ (with-temp-buffer
+ (nxml-mode)
+ (insert "<x a=\"dquote attr\" b='squote attr'>\"dquote text\"'squote text'</x>")
+ (font-lock-ensure)
+ (let ((squote-txt-pos (search-backward "squote text"))
+ (dquote-txt-pos (search-backward "dquote text"))
+ (squote-att-pos (search-backward "squote attr"))
+ (dquote-att-pos (search-backward "dquote attr")))
+ ;; Just make sure that each quote uses the same face for quoted
+ ;; attribute values, and a different face for quoted text
+ ;; outside tags. Don't test `font-lock-string-face' vs
+ ;; `nxml-attribute-value' here.
+ (should (equal (get-text-property squote-att-pos 'face)
+ (get-text-property dquote-att-pos 'face)))
+ (should (equal (get-text-property squote-txt-pos 'face)
+ (get-text-property dquote-txt-pos 'face)))
+ (should-not (equal (get-text-property squote-txt-pos 'face)
+ (get-text-property dquote-att-pos 'face))))))
+
(provide 'nxml-mode-tests)
;;; nxml-mode-tests.el ends here