branch: externals/csharp-mode commit 643c63ee11bf0bbaf37204251edb5f441c269d10 Author: Jostein Kjønigsen <jost...@kjonigsen.net> Commit: Jostein Kjønigsen <jost...@kjonigsen.net>
Highlight "value" as a constant. Test-cases. This closes https://github.com/josteink/csharp-mode/issues/141. --- csharp-mode-tests.el | 11 +++++++++++ csharp-mode.el | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/csharp-mode-tests.el b/csharp-mode-tests.el index d166a3f..8440ad0 100644 --- a/csharp-mode-tests.el +++ b/csharp-mode-tests.el @@ -54,6 +54,17 @@ "true" 'font-lock-constant-face )) +(ert-deftest fontification-of-constants () + (require 'assess) + (assess-face-in-text= + "testBool1 = true;\ntestBool2 = false;\ntestObj = null;\ntestProp = value;" + ;; should not be interpreted as string because of trailing \! + "false" 'font-lock-constant-face + "true" 'font-lock-constant-face + "null" 'font-lock-constant-face + "value" 'font-lock-constant-face + )) + (ert-deftest fontification-of-literals-allows-multi-line-strings () (require 'assess) (should (assess-face-at= diff --git a/csharp-mode.el b/csharp-mode.el index e6d411d..111a87f 100644 --- a/csharp-mode.el +++ b/csharp-mode.el @@ -1384,7 +1384,7 @@ This regexp is assumed to not match any non-operator identifier." ;; Constant keywords (c-lang-defconst c-constant-kwds - csharp '("true" "false" "null")) + csharp '("true" "false" "null" "value")) ;; Keywords that start "primary expressions." (c-lang-defconst c-primary-expr-kwds