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

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

[elpa] externals/objed 1c7d142 086/216: Add more tests


From: Stefan Monnier
Subject: [elpa] externals/objed 1c7d142 086/216: Add more tests
Date: Tue, 8 Jan 2019 12:29:17 -0500 (EST)

branch: externals/objed
commit 1c7d142f53dee1534e9f01980802a6536be9c78f
Author: Clemera <address@hidden>
Commit: Clemera <address@hidden>

    Add more tests
---
 test/tests.el | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 51 insertions(+), 2 deletions(-)

diff --git a/test/tests.el b/test/tests.el
index 9be103a..eb3d088 100644
--- a/test/tests.el
+++ b/test/tests.el
@@ -9,6 +9,8 @@
          (real-this-command cmd)
          (inhibit-message t))
     (setq this-command cmd)
+    ;; pre command hook...
+    (funcall #'objed--push-state)
     (call-interactively cmd)
     (setq last-command cmd)))
 
@@ -115,8 +117,9 @@ Insert KEY if there's no command."
               (point-min)
               (point-max)))
          (objed--exit-objed)
-         ;; reset for next round
+         ;; reset for next test
          (setq last-command nil)
+         (setq objed--last-states nil)
          (and (buffer-name temp-buffer)
               (kill-buffer temp-buffer)))))))
 
@@ -174,6 +177,13 @@ Insert KEY if there's no command."
   (should (string= (objed-with "Testing |line here\nFollowing line here" "ae")
                    "<Testing line here>|\nFollowing line here")))
 
+(ert-deftest objed-pop-state ()
+  (should (string= (objed-with "Testing line he|re" "rr")
+                   (objed-with "Testing line he|re" "rrr,")))
+  (should (string= (objed-with "Testing |line here\nFollowing line here" "n")
+                   (objed-with "Testing |line here\nFollowing line here" 
"npsfsb,,,,,"))))
+
+
 
 (ert-deftest objed-choose-and-navigate-defun ()
   (should (string= (objed-with "
@@ -413,6 +423,45 @@ Insert KEY if there's no command."
 ;; and more text>"))
 
 ))
-;; TODO: context expansion
+
+(ert-deftest objed-context-expansion ()
+  (let ((str "
+\(defun testing ()
+  (let ((a nil))
+    (message \"this is| a test\")))
+"))
+    (should (string= (objed-with str "o")
+                     "
+\(defun testing ()
+  (let ((a nil))
+    (message \"|<this is a test>\")))
+"))
+    (should (string= (objed-with str "oo")
+                     "
+\(defun testing ()
+  (let ((a nil))
+    (message |<\"this is a test\">)))
+"))
+    (should (string= (objed-with str "ooo")
+                     "
+\(defun testing ()
+  (let ((a nil))
+    |<(message \"this is a test\")>))
+"))
+    (should (string= (objed-with str "oooo")
+                     "
+\(defun testing ()
+  |<(let ((a nil))
+    (message \"this is a test\"))>)
+"))
+    (should (string= (objed-with str "ooooo")
+                     "
+|<\(defun testing ()
+  (let ((a nil))
+    (message \"this is a test\")))>
+"))))
+
+;; TODO: op tests, marking, remaining commands
+
 
 (provide 'tests)



reply via email to

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