@@ -593,6 +593,70 @@ should be fontified as variable, keyword and type."
593
593
(should (eq (get-face-at " Namespaced" ) 'font-lock-type-face ))
594
594
(should (eq (get-face-at " ClassName" ) 'font-lock-type-face ))))
595
595
596
+ (ert-deftest font-lock/variables-in-declaration-multiline-with-types ()
597
+ " Variables should be highlighted in multiline declarations with types."
598
+ (test-with-fontified-buffer
599
+ " function test(
600
+ var1: Type1,
601
+ var2: Type2,
602
+ ): RetType {\n }"
603
+ (should (eq (get-face-at " var1" ) 'font-lock-variable-name-face ))
604
+ (should (eq (get-face-at " var2" ) 'font-lock-variable-name-face ))
605
+ (should (eq (get-face-at " Type1" ) 'font-lock-type-face ))
606
+ (should (eq (get-face-at " Type2" ) 'font-lock-type-face ))))
607
+
608
+ (ert-deftest font-lock/variables-in-declaration-multiline-without-types ()
609
+ " Variables should be highlighted in multiline declarations without types."
610
+ (test-with-fontified-buffer
611
+ " function test(
612
+ var1,
613
+ var2,
614
+ ): RetType {\n }"
615
+ (should (eq (get-face-at " var1" ) 'font-lock-variable-name-face ))
616
+ (should (eq (get-face-at " var2" ) 'font-lock-variable-name-face ))))
617
+
618
+ (ert-deftest font-lock/variables-in-declaration-multiline-no-hanging-paren ()
619
+ " Variables should be highlighted in multiline declarations with no hanging paren."
620
+ (test-with-fontified-buffer
621
+ " function test(
622
+ var1,
623
+ var2): RetType {\n }"
624
+ (should (eq (get-face-at " var1" ) 'font-lock-variable-name-face ))
625
+ (should (eq (get-face-at " var2" ) 'font-lock-variable-name-face ))))
626
+
627
+ (ert-deftest font-lock/variables-in-declaration-multiline-ending-comma-no-hanging-paren ()
628
+ " Variables should be highlighted in multiline declarations with no hanging paren and trailing comma."
629
+ (test-with-fontified-buffer
630
+ " function test(
631
+ var1,
632
+ var2,): RetType {\n }"
633
+ (should (eq (get-face-at " var1" ) 'font-lock-variable-name-face ))
634
+ (should (eq (get-face-at " var2" ) 'font-lock-variable-name-face ))))
635
+
636
+ (ert-deftest font-lock/variables-in-declaration-singleline-ending-comma-hanging-paren ()
637
+ " Variables should be highlighted in singleline declarations with hanging paren and trailing comma."
638
+ (test-with-fontified-buffer
639
+ " function test(var1,var2,
640
+ ): RetType {\n }"
641
+ (should (eq (get-face-at " var1" ) 'font-lock-variable-name-face ))
642
+ (should (eq (get-face-at " var2" ) 'font-lock-variable-name-face ))))
643
+
644
+ (ert-deftest font-lock/variables-in-declaration-singleline-with-types ()
645
+ " Variables should be highlighted in singleline declarations with types."
646
+ (test-with-fontified-buffer
647
+ " function test(var1: Foo, var2: Bar,): RetType {\n }"
648
+ (should (eq (get-face-at " var1" ) 'font-lock-variable-name-face ))
649
+ (should (eq (get-face-at " var2" ) 'font-lock-variable-name-face ))
650
+ (should (eq (get-face-at " Foo" ) 'font-lock-type-face ))
651
+ (should (eq (get-face-at " Bar" ) 'font-lock-type-face ))))
652
+
653
+ (ert-deftest font-lock/variables-in-declaration-singleline-ending-comma-no-hanging-paren ()
654
+ " Variables should be highlighted in singleline declarations with no hanging paren and trailing comma."
655
+ (test-with-fontified-buffer
656
+ " function test(var1,var2,): RetType {\n }"
657
+ (should (eq (get-face-at " var1" ) 'font-lock-variable-name-face ))
658
+ (should (eq (get-face-at " var2" ) 'font-lock-variable-name-face ))))
659
+
596
660
(defun flyspell-predicate-test (search-for )
597
661
" This function runs a test on
598
662
`typescript--flyspell-mode-predicate' . `SEARCH-FOR' is a string
0 commit comments