2015-12-04 13:59:52 -05:00
|
|
|
|
;;; test-org-inlinetask.el --- Tests for org-inlinetask.el
|
|
|
|
|
|
|
|
|
|
;; Copyright (c) Marco Wahl
|
|
|
|
|
;; Authors: Marco Wahl
|
|
|
|
|
|
|
|
|
|
;; This program is free software; you can redistribute it and/or modify
|
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
;; (at your option) any later version.
|
|
|
|
|
|
|
|
|
|
;; This program is distributed in the hope that it will be useful,
|
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
|
|
|
|
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
|
|
;;; Comments:
|
|
|
|
|
|
|
|
|
|
;; Tests for org-inlinetask.el.
|
|
|
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(require 'org-inlinetask)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;; Test movement
|
|
|
|
|
|
2017-12-28 11:59:52 -05:00
|
|
|
|
(ert-deftest test-org-inlinetask/org-inlinetask-goto-end ()
|
2015-12-04 13:59:52 -05:00
|
|
|
|
;; Goto end.
|
|
|
|
|
(should
|
2017-12-28 11:59:52 -05:00
|
|
|
|
(equal
|
|
|
|
|
(let ((org-inlinetask-min-level 5)
|
|
|
|
|
(org-adapt-indentation t))
|
|
|
|
|
(org-test-with-temp-text
|
|
|
|
|
"** H
|
|
|
|
|
<point>***** I
|
|
|
|
|
***** END
|
|
|
|
|
foo"
|
|
|
|
|
(org-inlinetask-goto-end)
|
|
|
|
|
(insert "<point>")
|
|
|
|
|
(buffer-string)))
|
|
|
|
|
"** H
|
|
|
|
|
***** I
|
|
|
|
|
***** END
|
|
|
|
|
<point>foo"))
|
2015-12-04 13:59:52 -05:00
|
|
|
|
|
|
|
|
|
;; Goto end. End is buffer end.
|
|
|
|
|
(should
|
2017-12-28 11:59:52 -05:00
|
|
|
|
(equal
|
|
|
|
|
(let ((org-inlinetask-min-level 5)
|
|
|
|
|
(org-adapt-indentation t))
|
|
|
|
|
(org-test-with-temp-text
|
|
|
|
|
"** H
|
|
|
|
|
<point>***** I
|
|
|
|
|
***** END"
|
|
|
|
|
(org-inlinetask-goto-end)
|
|
|
|
|
(insert "<point>")
|
|
|
|
|
(buffer-string)))
|
|
|
|
|
"** H
|
|
|
|
|
***** I
|
|
|
|
|
***** END<point>"))
|
2015-12-04 13:59:52 -05:00
|
|
|
|
|
|
|
|
|
;; Goto end. Starting somewhere.
|
|
|
|
|
(should
|
2017-12-28 11:59:52 -05:00
|
|
|
|
(equal
|
|
|
|
|
(let ((org-inlinetask-min-level 5)
|
|
|
|
|
(org-adapt-indentation t))
|
|
|
|
|
(org-test-with-temp-text
|
|
|
|
|
"** H
|
|
|
|
|
****<point>* I
|
|
|
|
|
***** END
|
|
|
|
|
***** I
|
|
|
|
|
***** END"
|
|
|
|
|
(org-inlinetask-goto-end)
|
|
|
|
|
(insert "<point>")
|
|
|
|
|
(buffer-string)))
|
|
|
|
|
"** H
|
|
|
|
|
***** I
|
|
|
|
|
***** END
|
|
|
|
|
<point>***** I
|
|
|
|
|
***** END"))
|
2015-12-04 13:59:52 -05:00
|
|
|
|
|
2017-12-28 11:59:52 -05:00
|
|
|
|
(should
|
|
|
|
|
(equal
|
|
|
|
|
(let ((org-inlinetask-min-level 5)
|
|
|
|
|
(org-adapt-indentation t))
|
|
|
|
|
(org-test-with-temp-text
|
|
|
|
|
"** H
|
|
|
|
|
***** I
|
|
|
|
|
<point> inside
|
|
|
|
|
***** END
|
|
|
|
|
***** I
|
|
|
|
|
***** END"
|
|
|
|
|
(org-inlinetask-goto-end)
|
|
|
|
|
(insert "<point>")
|
|
|
|
|
(buffer-string)))
|
|
|
|
|
"** H
|
|
|
|
|
***** I
|
|
|
|
|
inside
|
|
|
|
|
***** END
|
|
|
|
|
<point>***** I
|
|
|
|
|
***** END")))
|
|
|
|
|
|
|
|
|
|
(ert-deftest test-org-inlinetask/inlinetask-within-plain-list ()
|
|
|
|
|
"Fold inlinetasks in plain-lists.
|
|
|
|
|
Report:
|
|
|
|
|
http://lists.gnu.org/archive/html/emacs-orgmode/2017-12/msg00502.html"
|
|
|
|
|
(should
|
|
|
|
|
(org-test-with-temp-text
|
|
|
|
|
"* Test
|
|
|
|
|
<point>- x
|
|
|
|
|
- a
|
|
|
|
|
*************** List folding stopped here
|
|
|
|
|
*************** END
|
|
|
|
|
- b
|
|
|
|
|
"
|
|
|
|
|
(org-cycle-internal-local)
|
|
|
|
|
(invisible-p (1- (search-forward "- b"))))))
|
|
|
|
|
|
2017-12-28 13:12:36 -05:00
|
|
|
|
(ert-deftest test-org-inlinetask/folding-directly-consecutive-tasks/0 ()
|
2017-12-28 11:59:52 -05:00
|
|
|
|
"Fold directly consecutive inlinetasks."
|
|
|
|
|
(should
|
|
|
|
|
(org-test-with-temp-text
|
|
|
|
|
"* Test
|
|
|
|
|
<point>- x
|
|
|
|
|
- a
|
|
|
|
|
*************** List folding stopped here
|
|
|
|
|
*************** END
|
|
|
|
|
*************** List folding stopped here
|
|
|
|
|
*************** END
|
|
|
|
|
- b
|
|
|
|
|
"
|
|
|
|
|
(org-cycle-internal-local)
|
|
|
|
|
(invisible-p (1- (search-forward "- b"))))))
|
|
|
|
|
|
2017-12-28 13:12:36 -05:00
|
|
|
|
(ert-deftest test-org-inlinetask/folding-directly-consecutive-tasks/1 ()
|
|
|
|
|
"Fold directly consecutive inlinetasks."
|
|
|
|
|
(should
|
|
|
|
|
(org-test-with-temp-text
|
|
|
|
|
"<point>* Test
|
|
|
|
|
*************** p1
|
|
|
|
|
p2
|
|
|
|
|
*************** END
|
|
|
|
|
*************** p3
|
|
|
|
|
p4
|
|
|
|
|
*************** END
|
|
|
|
|
|
|
|
|
|
"
|
2019-05-11 03:48:53 -04:00
|
|
|
|
(org-flag-subtree t)
|
2017-12-28 13:12:36 -05:00
|
|
|
|
(org-cycle)
|
|
|
|
|
(and
|
|
|
|
|
(not (invisible-p (1- (search-forward "p1"))))
|
|
|
|
|
(invisible-p (1- (search-forward "p2")))
|
|
|
|
|
(not (invisible-p (1- (search-forward "p3"))))
|
|
|
|
|
(invisible-p (1- (search-forward "p4")))))))
|
|
|
|
|
|
|
|
|
|
|
2017-12-28 11:59:52 -05:00
|
|
|
|
|
2015-12-04 13:59:52 -05:00
|
|
|
|
(provide 'test-org-inlinetask)
|
|
|
|
|
|
|
|
|
|
;;; test-org-inlinetask.el ends here
|