emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/csharp-mode 6af6f88 111/459: Fix fontification tests.


From: ELPA Syncer
Subject: [elpa] externals/csharp-mode 6af6f88 111/459: Fix fontification tests.
Date: Sun, 22 Aug 2021 13:59:07 -0400 (EDT)

branch: externals/csharp-mode
commit 6af6f8893a25dd8187461eb0dff5fe9537028cfe
Author: Jostein Kjønigsen <jostein@kjonigsen.net>
Commit: Jostein Kjønigsen <jostein@kjonigsen.net>

    Fix fontification tests.
    
    Previously they only checked string-values and not properties, which
    meant they actually never verified the fontification they were created
    to verify.
---
 csharp-mode-tests.el                               | 26 ++++++++++++++--------
 .../fontification-test-compiler-directives.cs      |  4 ++--
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/csharp-mode-tests.el b/csharp-mode-tests.el
index 3c13be8..38f0ab3 100644
--- a/csharp-mode-tests.el
+++ b/csharp-mode-tests.el
@@ -45,32 +45,40 @@
       (setq buffer2 (get-current-line-contents))
 
       ;; check equality
-      (setq debug-res (list buffer1 buffer2))
       (should
-       (equal buffer1 buffer2)))))
+       (equal-including-properties 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))
+    (let* ((reference)
+           (v1)
+           (t1)
+           (t2))
       ;; get reference string
       (move-to-line-after "reference")
       (setq reference (get-current-line-contents))
 
       ;; get verification string
+      (move-to-line-after "v1")
+      (setq v1 (get-current-line-contents))
+
+      ;; get test-case1
       (move-to-line-after "t1")
       (setq t1 (get-current-line-contents))
 
-      ;; get verification string
+      ;; get test-case2
       (move-to-line-after "t2")
       (setq t2 (get-current-line-contents))
 
       ;; check equality
-      (should (equal reference t1))
-      (should (equal reference t2)))))
+      (setq debug-res (list reference v1 t1 t2))
+      (should (and
+               (equal-including-properties reference v1)
+               (equal-including-properties reference t1)
+               (equal-including-properties reference t2))))))
 
 (defun list-repeat-once (mylist)
   (append mylist mylist))
@@ -156,7 +164,7 @@
 (ert-deftest activating-mode-triggers-all-hooks ()
   (add-hook 'csharp-mode-hook (lambda () (setq csharp-hook1 t)))
   (add-hook 'prog-mode-hook   (lambda () (setq csharp-hook2 t)))
-  
+
   (with-temp-buffer
     (csharp-mode)
     (should (equal t (and csharp-hook1
@@ -173,4 +181,4 @@
 
     (should (equal orig-content indented-content))))
 
-;;(ert-run-tests-interactively t)
+;;(ert-run-tests-interactively t)q
diff --git a/test-files/fontification-test-compiler-directives.cs 
b/test-files/fontification-test-compiler-directives.cs
index f87b45b..ffbaba8 100644
--- a/test-files/fontification-test-compiler-directives.cs
+++ b/test-files/fontification-test-compiler-directives.cs
@@ -8,11 +8,11 @@ public class Test
 
         // reference
         x += "foo";
-        #region t1 test
+        #region v1 verification
         x += "foo";
         #endregion
 
-        #region t2 test'
+        #region t1 test'
         x += "foo";
         #endregion
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]