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

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

[nongnu] elpa/tuareg 5eab0de 1/3: Tests: add commenting then uncommentin


From: ELPA Syncer
Subject: [nongnu] elpa/tuareg 5eab0de 1/3: Tests: add commenting then uncommenting tests
Date: Fri, 27 Aug 2021 13:57:35 -0400 (EDT)

branch: elpa/tuareg
commit 5eab0de3417585b304478b2d798d527c71278c01
Author: Christophe Troestler <Christophe.Troestler@umons.ac.be>
Commit: Christophe Troestler <Christophe.Troestler@umons.ac.be>

    Tests: add commenting then uncommenting tests
---
 tuareg-tests.el | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/tuareg-tests.el b/tuareg-tests.el
index b24f495..f248320 100644
--- a/tuareg-tests.el
+++ b/tuareg-tests.el
@@ -625,4 +625,32 @@ Return (FILE TYPE START-LINE END-LINE START-COL END-COL)."
                     "  epsilon\n    tau\n")
                    "  (* epsilon\n       tau *)\n"))))
 
+(defun tuareg-test--comment-uncomment-region (text)
+  (equal text
+         (with-temp-buffer
+           (tuareg-mode)
+           (insert text)
+           (comment-region (point-min) (point-max))
+           (uncomment-region (point-min) (point-max))
+           (buffer-string))))
+
+(ert-deftest tuareg-comment-uncomment-region ()
+  "Check that commenting out code then uncommenting it leads to
+the original code."
+  (should (let ((comment-style 'indent))
+            (tuareg-test--comment-uncomment-region
+             "let f x =\n  g x\n    y\n")))
+  (should (let ((comment-style 'multi-line)
+                (comment-continue " * "))
+            (tuareg-test--comment-uncomment-region
+             "let f x =\n  g x\n    y\n")))
+  (should (let ((comment-style 'multi-line))
+            (tuareg-test--comment-uncomment-region
+             "let f x =\n  g x\n    y\n")))
+  (should (let ((comment-style 'multi-line)
+                (comment-continue "   "))
+            (tuareg-test--comment-uncomment-region
+             "let f x =\n  g x\n    y\n"))))
+
+
 (provide 'tuareg-tests)



reply via email to

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