Przeglądaj źródła

Add ERTs for org-meta-return

* testing/lisp/test-org.el (test-org/meta-return): New `ert-deftest'
to test `org-meta-return'.
Michael Brand 11 lat temu
rodzic
commit
8e07014036
1 zmienionych plików z 45 dodań i 0 usunięć
  1. 45 0
      testing/lisp/test-org.el

+ 45 - 0
testing/lisp/test-org.el

@@ -364,6 +364,51 @@
 	      (buffer-string))))))
 
 
+
+;;; Editing
+
+;;;; Insert elements
+
+(ert-deftest test-org/meta-return ()
+  "Test M-RET (`org-meta-return')."
+  ;; In a table field insert a row above.
+  (should
+   (org-test-with-temp-text "| a |"
+     (forward-char)
+     (org-meta-return)
+     (forward-line -1)
+     (looking-at "|   |$")))
+  ;; In a paragraph change current line into a header.
+  (should
+   (org-test-with-temp-text "a"
+     (org-meta-return)
+     (beginning-of-line)
+     (looking-at "\* a$")))
+  ;; In an item insert an item, in this case above.
+  (should
+   (org-test-with-temp-text "- a"
+     (org-meta-return)
+     (beginning-of-line)
+     (looking-at "- $")))
+  ;; In a drawer and paragraph insert an empty line, in this case above.
+  (should
+   (let ((org-drawers '("MYDRAWER")))
+     (org-test-with-temp-text ":MYDRAWER:\na\n:END:"
+       (forward-line)
+       (org-meta-return)
+       (forward-line -1)
+       (looking-at "$"))))
+  ;; In a drawer and item insert an item, in this case above.
+  (should
+   (let ((org-drawers '("MYDRAWER")))
+     (org-test-with-temp-text ":MYDRAWER:\n- a\n:END:"
+       (forward-line)
+       (org-meta-return)
+       (beginning-of-line)
+       (looking-at "- $")))))
+
+
+
 
 ;;; Links