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

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

[nongnu] elpa/evil-nerd-commenter 72d4aacd28 187/235: more unit test


From: ELPA Syncer
Subject: [nongnu] elpa/evil-nerd-commenter 72d4aacd28 187/235: more unit test
Date: Thu, 6 Jan 2022 02:59:46 -0500 (EST)

branch: elpa/evil-nerd-commenter
commit 72d4aacd2852df5c1e27280426b9bbff24e7a370
Author: Chen Bin <chenbin.sh@gmail.com>
Commit: Chen Bin <chenbin.sh@gmail.com>

    more unit test
---
 evil-nerd-commenter-tests.el | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/evil-nerd-commenter-tests.el b/evil-nerd-commenter-tests.el
index d83b64f6a6..c6f301c7c8 100644
--- a/evil-nerd-commenter-tests.el
+++ b/evil-nerd-commenter-tests.el
@@ -72,10 +72,33 @@
       (js-mode)
       (goto-char (point-min))
       (evilnc-copy-and-comment-lines 2)
+      (should (not (evilnc-is-pure-comment (point))))
       (setq lines (evilnc-get-lines (point-min) (point-max)))
       (should (string= (nth 0 lines) "// hello"))
       (should (string= (nth 1 lines) "// world"))
       (should (string= (nth 2 lines) "hello"))
       (should (string= (nth 3 lines) "world")))))
 
+(ert-deftest evilnc-test-comment-html-tag ()
+  (let* (lines)
+    (with-temp-buffer
+      (insert "<div class=\"box\">\nhello world\n</div>")
+      (html-mode)
+      ;; comment tag
+      (goto-char (point-min))
+      (evilnc-comment-or-uncomment-html-tag)
+      (setq lines (evilnc-get-lines (point-min) (point-max)))
+      (should (string= (nth 0 lines) "{/* <div class=\"box\">"))
+      (should (string= (nth 1 lines) "hello world"))
+      (should (string= (nth 2 lines) "</div> */}"))
+      ;; move the cursor to the middle of html tag
+      (goto-line 2)
+      ;; uncomment whole tag
+      (evilnc-comment-or-uncomment-html-tag)
+      (setq lines (evilnc-get-lines (point-min) (point-max)))
+      (should (string= (nth 0 lines) "<div class=\"box\">"))
+      (should (string= (nth 1 lines) "hello world"))
+      (should (string= (nth 2 lines) "</div>"))
+      )))
+
 (ert-run-tests-batch-and-exit)



reply via email to

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