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

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

[nongnu] elpa/typescript-mode 393ac6db0f 081/222: add tests for regexp f


From: ELPA Syncer
Subject: [nongnu] elpa/typescript-mode 393ac6db0f 081/222: add tests for regexp font locking
Date: Sun, 6 Feb 2022 16:59:19 -0500 (EST)

branch: elpa/typescript-mode
commit 393ac6db0fdd399bb12beb9e66ee0e3823d50675
Author: Bartłomiej Kruczyk <bartlomiej.kruczyk@gmail.com>
Commit: Bartłomiej Kruczyk <bartlomiej.kruczyk@gmail.com>

    add tests for regexp font locking
---
 typescript-mode-tests.el | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/typescript-mode-tests.el b/typescript-mode-tests.el
index 6933d4fb6b..4a9e4f0f4c 100644
--- a/typescript-mode-tests.el
+++ b/typescript-mode-tests.el
@@ -277,6 +277,29 @@ declare function declareFunctionDefn(x3: xty3, y3: yty3): 
ret3;"
       (("y0" "y1" "y2" "y3") . font-lock-variable-name-face)
       (("ret0" "ret1" "ret2" "ret3") . nil))))
 
+(ert-deftest font-lock/regexp ()
+  "Regular expresssions should be fontified as string constant."
+  (let ((content "=/foo/ (/bar/ ,/baz/ :/buzz/"))
+    (font-lock-test content
+                    '(("=" . nil) ("/foo/" . font-lock-string-face)
+                      ("(" . nil) ("/bar/" . font-lock-string-face)
+                      ("," . nil) ("/baz/" . font-lock-string-face)
+                      (":" . nil) ("/buzz/" . font-lock-string-face)))))
+
+(ert-deftest 
font-lock/text-after-trailing-regexp-delim-should-not-be-fontified ()
+  "Text after trailing regular expression delimiter should not be fontified."
+  (test-with-temp-buffer
+      "=/foo/g something // comment"
+    (should (eq (get-face-at "g something") nil)))
+  (test-with-temp-buffer
+      "=/foo\\bar/g something // comment"
+    (should (eq (get-face-at "g something") nil)))
+  (test-with-temp-buffer
+      "=/foo\\\\bar/g something // comment"
+    (should (eq (get-face-at "g something") nil)))
+  (test-with-temp-buffer
+      "=/foo\\\\/g something // comment"
+    (should (eq (get-face-at "g something") nil))))
 
 (defun flyspell-predicate-test (search-for)
   "This function runs a test on



reply via email to

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