]> git.eshelyaron.com Git - dict.git/commitdiff
TEST: add test for updating syntax error faces
authorEshel Yaron <me@eshelyaron.com>
Wed, 9 Nov 2022 20:55:50 +0000 (22:55 +0200)
committerEshel Yaron <me@eshelyaron.com>
Wed, 9 Nov 2022 21:17:06 +0000 (23:17 +0200)
sweeprolog-tests.el

index 78924f2eabff3567a7140fc97bf2cdefdce23c79..8dbe50000af0887de684f5f64222b4a232746032 100644 (file)
@@ -209,6 +209,46 @@ foo(Bar) :- bar(Bar).
     (should (equal (sweeprolog-definition-at-point)
                    '(1 "foo" 1 21)))))
 
+(ert-deftest syntax-errors ()
+  "Test clearing syntax error face after errors are fixed."
+  (let ((temp (make-temp-file "sweeprolog-test"
+                              nil
+                              "pl"
+                              "
+:- module(baz, []).
+
+
+%!  baz(-Baz) is semidet.
+%
+%   Foobar.
+
+baz(Baz) :- bar(Baz).
+baz(Baz) :- Bar, Baz.
+
+%!  bar(-Bar) is semidet.
+%
+%   Spam.
+
+bar(Bar) :- baz(Bar).
+
+% comment before eob...
+")))
+    (find-file-literally temp)
+    (sweeprolog-mode)
+    (goto-char (point-min))
+    (search-forward ".\n" nil t)
+    (replace-match ",,\n" nil t)
+    (delete-char -3)
+    (redisplay)
+    (insert ".")
+    (redisplay)
+    (should (= (point-max)
+               (prop-match-end
+                (text-property-search-forward
+                 'font-lock-face
+                 '(sweeprolog-syntax-error-default-face
+                   sweeprolog-around-syntax-error-default-face)))))))
+
 (ert-deftest file-at-point ()
   "Test recognizing file specifications."
   (let ((temp (make-temp-file "sweeprolog-test"