branch: elpa/typescript-mode
commit ab6d1058079cc6881c9d25141d9939ba42026d94
Author: Jack Williams <[email protected]>
Commit: Jostein Kjønigsen <[email protected]>

    Add regression tests for function name highlighting.
---
 typescript-mode-tests.el | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/typescript-mode-tests.el b/typescript-mode-tests.el
index 9c57a9a098..01039e7db5 100644
--- a/typescript-mode-tests.el
+++ b/typescript-mode-tests.el
@@ -256,6 +256,19 @@ new line after the start of '/**'."
      ("@param" . typescript-jsdoc-tag)
      ("meow" . typescript-jsdoc-value))))
 
+(ert-deftest font-lock/function-definition-prefixes ()
+  "Tests that function names are highlighted in definitions, even
+when prefixed with module modifiers."
+  (font-lock-test
+   "function basicDefn(x: number, y: string): boolean {}\n
+export function exportedDefn(x: number, y: string): boolean {}\n
+export default function exportedDefaultDefn(x: number, y: string): boolean {}\n
+declare function declareFunctionDefn(x: number, y: string): boolean;"
+   '(("basicDefn" . font-lock-function-name-face)
+     ("exportedDefn" . font-lock-function-name-face)
+     ("exportedDefaultDefn" . font-lock-function-name-face)
+     ("declareFunctionDefn" . font-lock-function-name-face))))
+
 (defun flyspell-predicate-test (search-for)
   "This function runs a test on
 `typescript--flyspell-mode-predicate'.  `SEARCH-FOR' is a string

Reply via email to