emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/jade-mode 932a2fef33 095/128: [#46] start unit test file f


From: ELPA Syncer
Subject: [nongnu] elpa/jade-mode 932a2fef33 095/128: [#46] start unit test file for highlighting
Date: Sat, 29 Jan 2022 08:24:50 -0500 (EST)

branch: elpa/jade-mode
commit 932a2fef33db14cf3ecaf7c5c56f26fb5e403378
Author: Travis Jefferson <tjefferson@signpost.com>
Commit: Travis Jefferson <tjefferson@signpost.com>

    [#46] start unit test file for highlighting
---
 jade-mode.el       |  2 +-
 tests/highlight.el | 33 +++++++++++++++++++++++++++++++++
 2 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/jade-mode.el b/jade-mode.el
index d9d78b8d82..c288ffe0c6 100644
--- a/jade-mode.el
+++ b/jade-mode.el
@@ -119,7 +119,7 @@
     (jade-highlight-js-after-tag 1 font-lock-preprocessor-face)
 
     ;; doctype re-overrides some of the fontification rules
-    ("!!!\\|doctype[ ]?.*" 0 font-lock-comment-face t)))
+    ("^!!!\\|doctype[ ]?.*" 0 font-lock-comment-face t)))
 
 (defun jade-highlight-js-in-parens (limit)
   "Search for a tag declaration (up to LIMIT) which contains a paren
diff --git a/tests/highlight.el b/tests/highlight.el
new file mode 100644
index 0000000000..868d24d953
--- /dev/null
+++ b/tests/highlight.el
@@ -0,0 +1,33 @@
+(require 'ert)
+(require 'jade-mode)
+
+(ert-deftest jade-mode-command-should-be-bound ()
+  (with-temp-buffer
+    (should (fboundp 'jade-mode))
+    (should (null (jade-mode)))))
+
+(ert-deftest jade-mode-highlight-doctype ()
+  (with-temp-buffer
+
+    ;; interesting - if you omit the trailing newline in the string,
+    ;; `font-lock-fontify-buffer' will freak out and fail with
+    ;; end-of-buffer
+    (insert "doctype html\nhtml content\n\n")
+    (jade-mode)
+
+    ;; temp buffers require explict fontification
+    (font-lock-fontify-buffer)
+
+    ;; face at char 1 should be `font-lock-comment-face'
+    (should (eq
+             (get-text-property 1  'face)
+             'font-lock-comment-face))
+    (goto-char 1)
+
+    ;; face shouldn't change (from `font-lock-comment-face') b/t char
+    ;; 1 and eol
+    (should (=
+             (next-single-property-change (point) 'face)
+             (point-at-eol)))))
+
+



reply via email to

[Prev in Thread] Current Thread [Next in Thread]