[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/typescript-mode 70acbf9c3d 078/222: Change font-lock-test
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/typescript-mode 70acbf9c3d 078/222: Change font-lock-test to also accept a list of locations |
Date: |
Sun, 6 Feb 2022 16:59:19 -0500 (EST) |
branch: elpa/typescript-mode
commit 70acbf9c3db7d8116975d836d5993b2bf746b3b6
Author: Jack Williams <jw@jackw.io>
Commit: Jostein Kjønigsen <jostein@kjonigsen.net>
Change font-lock-test to also accept a list of locations
As a result of the change, update
font-lock/function-definition-prefixes to use the new functionality
and remove copy-test n.
---
typescript-mode-tests.el | 29 ++++++++++++-----------------
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/typescript-mode-tests.el b/typescript-mode-tests.el
index 5e05b94435..6933d4fb6b 100644
--- a/typescript-mode-tests.el
+++ b/typescript-mode-tests.el
@@ -192,11 +192,16 @@ as the search pattern."
(defun font-lock-test (contents expected)
"Perform a test on our template. `CONTENTS' is the string to
put in the temporary buffer. `EXPECTED' is the expected
-results. It should be a list of (LOCATION . FACE) pairs."
+results. It should be a list of (LOCATION . FACE) pairs, where
+LOCATION can be either a single location, or list of locations,
+that are all expected to have the same face."
(test-with-temp-buffer
contents
(dolist (spec expected)
- (should (eq (get-face-at (car spec)) (cdr spec))))))
+ (if (listp (car spec))
+ (dolist (source (car spec))
+ (should (eq (get-face-at source) (cdr spec))))
+ (should (eq (get-face-at (car spec)) (cdr spec)))))))
(ert-deftest font-lock/documentation-in-documentation-comments ()
"Documentation in documentation comments should be fontified as
@@ -256,13 +261,6 @@ new line after the start of '/**'."
("@param" . typescript-jsdoc-tag)
("meow" . typescript-jsdoc-value))))
-(defun copy-test-n (n location-root expected)
- (let (tests)
- (dotimes (i n tests)
- (setq tests
- (cons (cons (concat location-root (number-to-string i)) expected)
- tests)))))
-
(ert-deftest font-lock/function-definition-prefixes ()
"Tests that function names are highlighted in definitions, even
when prefixed with module modifiers."
@@ -271,17 +269,14 @@ when prefixed with module modifiers."
export function exportedDefn(x1: xty1, y1: yty1): ret1 {}\n
export default function exportedDefaultDefn(x2: xty2, y2: yty2): ret2 {}\n
declare function declareFunctionDefn(x3: xty3, y3: yty3): ret3;"
- (append
'(("basicDefn" . font-lock-function-name-face)
("exportedDefn" . font-lock-function-name-face)
("exportedDefaultDefn" . font-lock-function-name-face)
- ("declareFunctionDefn" . font-lock-function-name-face))
- (copy-test-n 4 "x" font-lock-variable-name-face)
- (copy-test-n 4 "y" font-lock-variable-name-face)
- (copy-test-n 4 "xty" font-lock-variable-name-face)
- (copy-test-n 4 "yty" font-lock-variable-name-face)
- ;; Return types are not highlighted currently.
- (copy-test-n 4 "ret" nil))))
+ ("declareFunctionDefn" . font-lock-function-name-face)
+ (("x0" "x1" "x2" "x3") . font-lock-variable-name-face)
+ (("y0" "y1" "y2" "y3") . font-lock-variable-name-face)
+ (("ret0" "ret1" "ret2" "ret3") . nil))))
+
(defun flyspell-predicate-test (search-for)
"This function runs a test on
- [nongnu] elpa/typescript-mode c1a7d40dd8 005/222: highlight template string, (continued)
- [nongnu] elpa/typescript-mode c1a7d40dd8 005/222: highlight template string, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 8fe879a96d 028/222: Support 'of' keyword., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode ca510ab853 048/222: Merge pull request #30 from lddubeau/fix/keyword-members, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode a2c2ff03e7 024/222: Add support for compilation-mode., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 7526f138a0 032/222: Avoid capturing things we dont need for compilation-mode., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 666052f09f 033/222: Update readme., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 4235b47a38 060/222: Fix indent for lines which starts with tabs., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 52c08d0628 091/222: Add more fontification tests for regular expressions., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode e25c7ddb8a 062/222: Fix indentation of funcs with return annotations., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 536e4da380 087/222: Fix bug with hanling array shorthand in return value types., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 70acbf9c3d 078/222: Change font-lock-test to also accept a list of locations,
ELPA Syncer <=
- [nongnu] elpa/typescript-mode a2167a133d 056/222: Fix errors with indentation when line has wide unicode chars., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 09bdb97c32 065/222: Fix an indentation bug., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 8b2815514d 088/222: Simplify typescript--backward-to-parameter-list, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode f9cd0dd539 112/222: Try parse new error-format introduced in tsc 2.7+, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode a1cdb7a1ec 121/222: Remove redundant regexp groups for jsdoc tags, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode fd1c9daa4d 094/222: Add failing cases., ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode bd046e0fae 120/222: Add tags in usejsdoc.org, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 3c79132066 136/222: fix warnings from package-lint, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode 000131df29 150/222: Update CI-settings, ELPA Syncer, 2022/02/06
- [nongnu] elpa/typescript-mode b1d1948c15 123/222: Merge pull request #88 from Ptival/fix-indentation-method-calls-keywords, ELPA Syncer, 2022/02/06