diff options
| author | Tom Tromey | 2017-03-23 11:34:18 -0600 |
|---|---|---|
| committer | Tom Tromey | 2017-04-05 15:53:39 -0600 |
| commit | 335174ee5037a2751c31bfd9ecb87cedb4bc3cda (patch) | |
| tree | d2faaab5f48303aa08ef707d842d2e22e31650f6 /test | |
| parent | d392b6e82460d94b11627998da87e33880664060 (diff) | |
| download | emacs-335174ee5037a2751c31bfd9ecb87cedb4bc3cda.tar.gz emacs-335174ee5037a2751c31bfd9ecb87cedb4bc3cda.zip | |
add mhtml-mode.el
* etc/NEWS: Update.
* lisp/textmodes/mhtml-mode.el: New file.
* test/manual/indent/html-multi.html: New file.
* test/lisp/textmodes/mhtml-mode-tests.el: New file.
* doc/emacs/text.texi (HTML Mode): Mention mhtml-mode.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/textmodes/mhtml-mode-tests.el | 58 | ||||
| -rw-r--r-- | test/manual/indent/html-multi.html | 30 |
2 files changed, 88 insertions, 0 deletions
diff --git a/test/lisp/textmodes/mhtml-mode-tests.el b/test/lisp/textmodes/mhtml-mode-tests.el new file mode 100644 index 00000000000..d8eeb27643c --- /dev/null +++ b/test/lisp/textmodes/mhtml-mode-tests.el | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | ;;; mhtml-mode-tests.el --- Tests for mhtml-mode | ||
| 2 | |||
| 3 | ;; Copyright (C) 2017 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Keywords: tests | ||
| 6 | |||
| 7 | ;; This file is part of GNU Emacs. | ||
| 8 | |||
| 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. | ||
| 13 | |||
| 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. | ||
| 18 | |||
| 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/>. | ||
| 21 | |||
| 22 | ;;; Commentary: | ||
| 23 | |||
| 24 | ;;; Code: | ||
| 25 | |||
| 26 | (require 'mhtml-mode) | ||
| 27 | (require 'ert) | ||
| 28 | |||
| 29 | (defun mhtml-test-syntax (before after what) | ||
| 30 | (with-temp-buffer | ||
| 31 | (mhtml-mode) | ||
| 32 | (insert before) | ||
| 33 | (save-excursion | ||
| 34 | (insert after)) | ||
| 35 | (font-lock-ensure) | ||
| 36 | (should (eq (syntax-ppss-context (syntax-ppss)) what)))) | ||
| 37 | |||
| 38 | (ert-deftest mthml-comment-js () | ||
| 39 | (mhtml-test-syntax "<html><script>\n/* " | ||
| 40 | " some text */<script></html>" | ||
| 41 | 'comment)) | ||
| 42 | |||
| 43 | (ert-deftest mthml-string-js () | ||
| 44 | (mhtml-test-syntax "<html><script>\n\" " | ||
| 45 | " some text \"<script></html>" | ||
| 46 | 'string)) | ||
| 47 | |||
| 48 | (ert-deftest mthml-comment-css () | ||
| 49 | (mhtml-test-syntax "<html><style>\n/* " | ||
| 50 | " some text */<style></html>" | ||
| 51 | 'comment)) | ||
| 52 | |||
| 53 | (ert-deftest mthml-string-css () | ||
| 54 | (mhtml-test-syntax "<html><style>\n\" " | ||
| 55 | " some text \"<style></html>" | ||
| 56 | 'string)) | ||
| 57 | |||
| 58 | ;;; mhtml-mode-tests.el ends here | ||
diff --git a/test/manual/indent/html-multi.html b/test/manual/indent/html-multi.html new file mode 100644 index 00000000000..a563c5eb244 --- /dev/null +++ b/test/manual/indent/html-multi.html | |||
| @@ -0,0 +1,30 @@ | |||
| 1 | <!DOCTYPE html> | ||
| 2 | <html> | ||
| 3 | <head> | ||
| 4 | <title>test</title> | ||
| 5 | <!-- | ||
| 6 | <script> | ||
| 7 | // No indent in a comment | ||
| 8 | if (true) { | ||
| 9 | do not change; | ||
| 10 | } | ||
| 11 | </script> | ||
| 12 | --> | ||
| 13 | |||
| 14 | <style type="text/css"> | ||
| 15 | h1 { | ||
| 16 | font-family: 'Spinnaker', sans-serif; | ||
| 17 | } | ||
| 18 | </style> | ||
| 19 | <script> | ||
| 20 | var a = 4 < 5; | ||
| 21 | function() { | ||
| 22 | if (x > 75) | ||
| 23 | return 25; | ||
| 24 | return "hello"; | ||
| 25 | } | ||
| 26 | </script> | ||
| 27 | </head> | ||
| 28 | <body> | ||
| 29 | </body> | ||
| 30 | </html> | ||