test files: use cl- prefixed functions, and require cl-lib
This commit is contained in:
parent
7fb3328db8
commit
d94d52489d
|
@ -18,6 +18,8 @@
|
|||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
(eval-and-compile (require 'cl-lib))
|
||||
|
||||
|
||||
;;; Tests
|
||||
(org-babel-lob-ingest
|
||||
|
@ -39,7 +41,7 @@
|
|||
|
||||
(ert-deftest test-ob-lob/call-with-header-arguments ()
|
||||
"Test the evaluation of a library of babel #+call: line."
|
||||
(letf (((symbol-function 'org-babel-insert-result)
|
||||
(cl-letf (((symbol-function 'org-babel-insert-result)
|
||||
(symbol-function 'ignore)))
|
||||
(let ((org-babel-library-of-babel
|
||||
(org-test-with-temp-text-in-file
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(eval-and-compile (require 'cl-lib))
|
||||
|
||||
(ert-deftest test-ob/indented-cached-org-bracket-link ()
|
||||
"When the result of a source block is a cached indented link it
|
||||
should still return the link."
|
||||
|
@ -553,7 +555,7 @@ on two lines
|
|||
|
||||
#+NAME: read-literal-example
|
||||
#+BEGIN_SRC emacs-lisp :var x=literal-example
|
||||
(concatenate 'string x \" for me.\")
|
||||
(cl-concatenate 'string x \" for me.\")
|
||||
#+END_SRC"
|
||||
(org-babel-next-src-block 1)
|
||||
(should (string= (org-babel-execute-src-block)
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
(require 'org-test)
|
||||
(require 'org-agenda)
|
||||
(eval-and-compile (require 'cl-lib))
|
||||
|
||||
|
||||
;; General auxilliaries
|
||||
|
@ -112,7 +113,7 @@
|
|||
(org-agenda-list)
|
||||
(let* ((agenda-buffer-name
|
||||
(progn
|
||||
(assert (= 1 (length (org-test-agenda--agenda-buffers))))
|
||||
(cl-assert (= 1 (length (org-test-agenda--agenda-buffers))))
|
||||
(buffer-name (car (org-test-agenda--agenda-buffers))))))
|
||||
(set-buffer agenda-buffer-name)
|
||||
(org-agenda-redo)
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
(require 'org-test)
|
||||
(require 'org-attach)
|
||||
(eval-and-compile (require 'cl-lib))
|
||||
|
||||
(ert-deftest test-org-attach/dired-attach-to-next-best-subtree/1 ()
|
||||
"Attach file at point in dired to subtree."
|
||||
|
@ -36,22 +37,22 @@
|
|||
"* foo :foo:"
|
||||
(split-window)
|
||||
(dired temporary-file-directory)
|
||||
(assert (eq 'dired-mode major-mode))
|
||||
(cl-assert (eq 'dired-mode major-mode))
|
||||
(revert-buffer)
|
||||
(dired-goto-file a-filename)
|
||||
; action
|
||||
(call-interactively #'org-attach-dired-to-subtree)
|
||||
; check
|
||||
(delete-window)
|
||||
(assert (eq 'org-mode major-mode))
|
||||
(cl-assert (eq 'org-mode major-mode))
|
||||
(beginning-of-buffer)
|
||||
(search-forward "* foo")
|
||||
; expectation. tag ATTACH has been appended.
|
||||
(reduce (lambda (x y) (or x y))
|
||||
(mapcar (lambda (x) (string-equal "ATTACH" x))
|
||||
(plist-get
|
||||
(plist-get
|
||||
(org-element-at-point) 'headline) :tags))))
|
||||
(cl-reduce (lambda (x y) (or x y))
|
||||
(mapcar (lambda (x) (string-equal "ATTACH" x))
|
||||
(plist-get
|
||||
(plist-get
|
||||
(org-element-at-point) 'headline) :tags))))
|
||||
(delete-file a-filename)))))
|
||||
|
||||
(ert-deftest test-org-attach/dired-attach-to-next-best-subtree/2 ()
|
||||
|
@ -64,7 +65,7 @@
|
|||
"* foo"
|
||||
(split-window)
|
||||
(dired temporary-file-directory)
|
||||
(assert (eq 'dired-mode major-mode))
|
||||
(cl-assert (eq 'dired-mode major-mode))
|
||||
(revert-buffer)
|
||||
(dired-goto-file a-filename)
|
||||
(dired-mark 1)
|
||||
|
@ -74,7 +75,7 @@
|
|||
(call-interactively #'org-attach-dired-to-subtree)
|
||||
; check
|
||||
(delete-window)
|
||||
(assert (eq 'org-mode major-mode))
|
||||
(cl-assert (eq 'org-mode major-mode))
|
||||
(beginning-of-buffer)
|
||||
(search-forward "* foo")
|
||||
(and (file-exists-p (concat (org-attach-dir) "/"
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(eval-and-compile (require 'cl-lib))
|
||||
|
||||
(unless (featurep 'org-element)
|
||||
(signal 'missing-test-dependency "org-element"))
|
||||
|
||||
|
@ -46,7 +48,7 @@ Some other text
|
|||
(let ((count 0))
|
||||
(org-element-map
|
||||
(org-element-parse-buffer) 'plain-text
|
||||
(lambda (s) (when (string-match "text" s) (incf count))))
|
||||
(lambda (s) (when (string-match "text" s) (cl-incf count))))
|
||||
count))))
|
||||
;; Applies to secondary strings
|
||||
(should
|
||||
|
|
|
@ -21,11 +21,13 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(eval-and-compile (require 'cl-lib))
|
||||
|
||||
(defmacro test-org-timer/with-temp-text (text &rest body)
|
||||
"Like `org-test-with-temp-text', but set timer-specific variables.
|
||||
Also, mute output from `message'."
|
||||
(declare (indent 1))
|
||||
`(letf (((symbol-function 'message) (lambda (&rest args) nil)))
|
||||
`(cl-letf (((symbol-function 'message) (lambda (&rest args) nil)))
|
||||
(org-test-with-temp-text ,text
|
||||
(let (org-timer-start-time
|
||||
org-timer-pause-time
|
||||
|
@ -38,7 +40,7 @@ Also, mute output from `message'."
|
|||
(defmacro test-org-timer/with-current-time (time &rest body)
|
||||
"Run BODY, setting `current-time' output to TIME."
|
||||
(declare (indent 1))
|
||||
`(letf (((symbol-function 'current-time) (lambda () ,time)))
|
||||
`(cl-letf (((symbol-function 'current-time) (lambda () ,time)))
|
||||
,@body))
|
||||
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(eval-and-compile (require 'cl-lib))
|
||||
|
||||
|
||||
;;; Comments
|
||||
|
||||
|
@ -7117,7 +7119,7 @@ CLOCK: [2012-03-29 Thu 10:00]--[2012-03-29 Thu 16:40] => 6:40"
|
|||
(let (result (line 0))
|
||||
(while (not (eobp))
|
||||
(unless (org-invisible-p2) (push line result))
|
||||
(incf line)
|
||||
(cl-incf line)
|
||||
(forward-line))
|
||||
(nreverse result))))))
|
||||
(should (equal '(0 7) (funcall list-visible-lines 'minimal t)))
|
||||
|
|
Loading…
Reference in New Issue