summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-11-29 14:37:12 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-11-29 14:37:12 +0100
commit12ea0f08f4acbdb534ae6928ab7a323b752d1f72 (patch)
tree76aafca0264728644dfb6e92d622c71104fd9c6c
parentb4b2809eb17f301ae59d0865840d45b3f3ff9f3e (diff)
downloadorg-mode-12ea0f08f4acbdb534ae6928ab7a323b752d1f72.tar.gz
Fix some tests
* testing/lisp/test-org.el (test-org/comment-dwim): Fix tests
-rw-r--r--testing/lisp/test-org.el77
1 files changed, 36 insertions, 41 deletions
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index d067c04..9c06612 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -90,86 +90,81 @@
(should
(equal "# \nComment"
(org-test-with-temp-text "Comment"
- (progn (call-interactively 'comment-dwim)
- (buffer-string)))))
+ (call-interactively #'org-comment-dwim)
+ (buffer-string))))
;; No region selected, no comment on current line and line empty:
;; insert comment on this line.
(should
(equal "# \nParagraph"
(org-test-with-temp-text "\nParagraph"
- (progn (call-interactively 'comment-dwim)
- (buffer-string)))))
+ (call-interactively #'org-comment-dwim)
+ (buffer-string))))
;; No region selected, and a comment on this line: indent it.
(should
(equal "* Headline\n # Comment"
- (org-test-with-temp-text "* Headline\n# Comment"
- (progn (forward-line)
- (let ((org-adapt-indentation t))
- (call-interactively 'comment-dwim))
- (buffer-string)))))
+ (org-test-with-temp-text "* Headline\n# <point>Comment"
+ (let ((org-adapt-indentation t))
+ (call-interactively #'org-comment-dwim))
+ (buffer-string))))
;; Also recognize single # at column 0 as comments.
(should
(equal "# Comment"
(org-test-with-temp-text "# Comment"
- (progn (forward-line)
- (call-interactively 'comment-dwim)
- (buffer-string)))))
+ (call-interactively #'org-comment-dwim)
+ (buffer-string))))
;; Region selected and only comments and blank lines within it:
;; un-comment all commented lines.
(should
(equal "Comment 1\n\nComment 2"
(org-test-with-temp-text "# Comment 1\n\n# Comment 2"
- (progn
- (transient-mark-mode 1)
- (push-mark (point) t t)
- (goto-char (point-max))
- (call-interactively 'comment-dwim)
- (buffer-string)))))
+ (transient-mark-mode 1)
+ (push-mark (point) t t)
+ (goto-char (point-max))
+ (call-interactively #'org-comment-dwim)
+ (buffer-string))))
;; Region selected without comments: comment all lines if
;; `comment-empty-lines' is non-nil, only non-blank lines otherwise.
(should
(equal "# Comment 1\n\n# Comment 2"
(org-test-with-temp-text "Comment 1\n\nComment 2"
- (progn
- (transient-mark-mode 1)
- (push-mark (point) t t)
- (goto-char (point-max))
- (let ((comment-empty-lines nil))
- (call-interactively 'comment-dwim))
- (buffer-string)))))
+ (transient-mark-mode 1)
+ (push-mark (point) t t)
+ (goto-char (point-max))
+ (let ((comment-empty-lines nil))
+ (call-interactively #'org-comment-dwim))
+ (buffer-string))))
(should
(equal "# Comment 1\n# \n# Comment 2"
(org-test-with-temp-text "Comment 1\n\nComment 2"
- (progn
- (transient-mark-mode 1)
- (push-mark (point) t t)
- (goto-char (point-max))
- (let ((comment-empty-lines t))
- (call-interactively 'comment-dwim))
- (buffer-string)))))
+ (transient-mark-mode 1)
+ (push-mark (point) t t)
+ (goto-char (point-max))
+ (let ((comment-empty-lines t))
+ (call-interactively #'org-comment-dwim))
+ (buffer-string))))
;; In front of a keyword without region, insert a new comment.
(should
(equal "# \n#+KEYWORD: value"
(org-test-with-temp-text "#+KEYWORD: value"
- (progn (call-interactively 'comment-dwim)
- (buffer-string)))))
+ (call-interactively #'org-comment-dwim)
+ (buffer-string))))
;; In a source block, use appropriate syntax.
(should
(equal " ;; "
- (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n\n#+END_SRC"
- (forward-line)
+ (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\n<point>\n#+END_SRC"
(let ((org-edit-src-content-indentation 2))
- (call-interactively 'comment-dwim))
- (buffer-substring-no-properties (line-beginning-position) (point)))))
+ (call-interactively #'org-comment-dwim))
+ (buffer-substring-no-properties (line-beginning-position)
+ (point)))))
(should
(equal "#+BEGIN_SRC emacs-lisp\n ;; a\n ;; b\n#+END_SRC"
- (org-test-with-temp-text "#+BEGIN_SRC emacs-lisp\na\nb\n#+END_SRC"
- (forward-line)
+ (org-test-with-temp-text
+ "#+BEGIN_SRC emacs-lisp\n<point>a\nb\n#+END_SRC"
(transient-mark-mode 1)
(push-mark (point) t t)
(forward-line 2)
(let ((org-edit-src-content-indentation 2))
- (call-interactively 'comment-dwim))
+ (call-interactively #'org-comment-dwim))
(buffer-string)))))