summaryrefslogtreecommitdiff
path: root/test/lisp
diff options
context:
space:
mode:
authorNoam Postavsky <npostavs@gmail.com>2019-06-23 21:27:43 -0400
committerNoam Postavsky <npostavs@gmail.com>2019-06-25 18:58:23 -0400
commite62ad04963982ea9cc7622b32484778845bc2ec1 (patch)
tree70e80f572dce3f269acdf6136278fb29e049cdd9 /test/lisp
parent06b35b2f922150a11d6b4b5c68a40e9957a69e52 (diff)
downloademacs-e62ad04963982ea9cc7622b32484778845bc2ec1.tar.gz
emacs-e62ad04963982ea9cc7622b32484778845bc2ec1.tar.bz2
emacs-e62ad04963982ea9cc7622b32484778845bc2ec1.zip
Fix sgml-mode handling of quotes within parens (Bug#36347)
* lisp/textmodes/sgml-mode.el (sgml-syntax-propertize): Use syntax-ppss-table if set. This is only needed on the release branch, on master the caller (syntax-propertize) already does this. (sgml-mode): Set syntax-ppss-table to sgml-tag-syntax-table. This correctly classifies parens as punctuation, so they won't confuse the parser. * test/lisp/textmodes/sgml-mode-tests.el (sgml-tests--quotes-syntax): New test copied from master, with two cases added for this bug.
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/textmodes/sgml-mode-tests.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/lisp/textmodes/sgml-mode-tests.el b/test/lisp/textmodes/sgml-mode-tests.el
index 7318a667b36..0000b352ff0 100644
--- a/test/lisp/textmodes/sgml-mode-tests.el
+++ b/test/lisp/textmodes/sgml-mode-tests.el
@@ -130,5 +130,27 @@ The point is set to the beginning of the buffer."
(sgml-delete-tag 1)
(should (string= "Winter is comin'" (buffer-string)))))
+(ert-deftest sgml-tests--quotes-syntax ()
+ (dolist (str '("a\"b <t>c'd</t>"
+ "a'b <t>c\"d</t>"
+ "<t>\"a'</t>"
+ "<t>'a\"</t>"
+ "<t>\"a'\"</t>"
+ "<t>'a\"'</t>"
+ "a\"b <tag>c'd</tag>"
+ ;;"<tag>c>'d</tag>" Fixed in master.
+ "<t><!-- \" --></t>"
+ "<t><!-- ' --></t>"
+ "<t>(')</t>"
+ "<t>(\")</t>"
+ ))
+ (with-temp-buffer
+ (sgml-mode)
+ (insert str)
+ (ert-info ((format "%S" str) :prefix "Test case: ")
+ ;; Check that last tag is parsed as a tag.
+ (should (= 1 (car (syntax-ppss (1- (point-max))))))
+ (should (= 0 (car (syntax-ppss (point-max)))))))))
+
(provide 'sgml-mode-tests)
;;; sgml-mode-tests.el ends here