@@ -846,6 +846,31 @@ bbb: Bar,
846
846
(should (eq (get-face-at " aaa" ) 'font-lock-variable-name-face ))
847
847
(should (eq (get-face-at " bbb" ) 'font-lock-variable-name-face ))))
848
848
849
+ (ert-deftest font-lock/backticks--expr-fontification--with-variable ()
850
+ (test-with-fontified-buffer
851
+ " const x = `hello ${world}`"
852
+ (should (eq (get-face-at " ${" ) 'font-lock-keyword-face ))
853
+ (should (eq (get-face-at " world" ) 'default ))
854
+ (should (eq (get-face-at " }" ) 'font-lock-keyword-face ))))
855
+
856
+ (ert-deftest font-lock/backticks--expr-fontification--not-in-regular-string ()
857
+ (test-with-fontified-buffer
858
+ " const x = 'hello ${world}'"
859
+ (should (eq (get-face-at " ${" ) 'font-lock-string-face ))
860
+ (should (eq (get-face-at " world" ) 'font-lock-string-face ))
861
+ (should (eq (get-face-at " }" ) 'font-lock-string-face ))))
862
+
863
+ (ert-deftest font-lock/backticks--expr-fontification--with-funcall ()
864
+ " For now function calls or any other expressions are fontified as
865
+ if a simple variable token in its entirety. When/if this is
866
+ implemented better, this test should be adjusted to capture the
867
+ new functionality."
868
+ (test-with-fontified-buffer
869
+ " const x = `hello ${parseInt(foobar)}`"
870
+ (should (eq (get-face-at " ${" ) 'font-lock-keyword-face ))
871
+ (should (eq (get-face-at " parseInt(foobar)" ) 'default ))
872
+ (should (eq (get-face-at " }" ) 'font-lock-keyword-face ))))
873
+
849
874
(defun flyspell-predicate-test (search-for )
850
875
" This function runs a test on
851
876
`typescript--flyspell-mode-predicate' . `SEARCH-FOR' is a string
0 commit comments