@@ -823,6 +823,31 @@ bbb: Bar,
823
823
(should (eq (get-face-at " Foo" ) 'font-lock-type-face ))
824
824
(should (eq (get-face-at " Bar" ) 'font-lock-type-face ))))
825
825
826
+ (ert-deftest font-lock/backticks--expr-fontification--with-variable ()
827
+ (test-with-fontified-buffer
828
+ " const x = `hello ${world}`"
829
+ (should (eq (get-face-at " ${" ) 'font-lock-keyword-face ))
830
+ (should (eq (get-face-at " world" ) 'default ))
831
+ (should (eq (get-face-at " }" ) 'font-lock-keyword-face ))))
832
+
833
+ (ert-deftest font-lock/backticks--expr-fontification--not-in-regular-string ()
834
+ (test-with-fontified-buffer
835
+ " const x = 'hello ${world}'"
836
+ (should (eq (get-face-at " ${" ) 'font-lock-string-face ))
837
+ (should (eq (get-face-at " world" ) 'font-lock-string-face ))
838
+ (should (eq (get-face-at " }" ) 'font-lock-string-face ))))
839
+
840
+ (ert-deftest font-lock/backticks--expr-fontification--with-funcall ()
841
+ " For now function calls or any other expressions are fontified as
842
+ if a simple variable token in its entirety. When/if this is
843
+ implemented better, this test should be adjusted to capture the
844
+ new functionality."
845
+ (test-with-fontified-buffer
846
+ " const x = `hello ${parseInt(foobar)}`"
847
+ (should (eq (get-face-at " ${" ) 'font-lock-keyword-face ))
848
+ (should (eq (get-face-at " parseInt(foobar)" ) 'default ))
849
+ (should (eq (get-face-at " }" ) 'font-lock-keyword-face ))))
850
+
826
851
(ert-deftest font-lock/funargs--method--multiline--with-type ()
827
852
(test-with-fontified-buffer
828
853
" class Foo { foo(
0 commit comments