branch: externals/csharp-mode commit f1a2e06ff25bd036859b9a1ce38849f76c75a4c6 Author: Jostein Kjønigsen <jost...@kjonigsen.net> Commit: Jostein Kjønigsen <jost...@kjonigsen.net>
Add unit-test for fontification of compiler-directives. --- csharp-mode-tests.el | 23 ++++++++++++++++++++++ .../fontification-test-compiler-directives.cs | 23 ++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/csharp-mode-tests.el b/csharp-mode-tests.el index 3db42f1..3c13be8 100644 --- a/csharp-mode-tests.el +++ b/csharp-mode-tests.el @@ -49,6 +49,29 @@ (should (equal buffer1 buffer2))))) +(ert-deftest fontification-of-compiler-directives () + (let* ((buffer (find-file-read-only "test-files/fontification-test-compiler-directives.cs"))) + ;; double-ensure mode is active + (csharp-mode) + (goto-char (point-min)) + (let* ((buffer1) + (buffer2)) + ;; get reference string + (move-to-line-after "reference") + (setq reference (get-current-line-contents)) + + ;; get verification string + (move-to-line-after "t1") + (setq t1 (get-current-line-contents)) + + ;; get verification string + (move-to-line-after "t2") + (setq t2 (get-current-line-contents)) + + ;; check equality + (should (equal reference t1)) + (should (equal reference t2))))) + (defun list-repeat-once (mylist) (append mylist mylist)) diff --git a/test-files/fontification-test-compiler-directives.cs b/test-files/fontification-test-compiler-directives.cs new file mode 100644 index 0000000..f87b45b --- /dev/null +++ b/test-files/fontification-test-compiler-directives.cs @@ -0,0 +1,23 @@ +using System; + +public class Test +{ + public void Test() + { + string x; + + // reference + x += "foo"; + #region t1 test + x += "foo"; + #endregion + + #region t2 test' + x += "foo"; + #endregion + + #region t2 - test" + x += "foo"; + #endregion + } +}