|
@@ -79,6 +79,26 @@ If file is non-nil insert it's contents in there.")
|
|
|
If file is not given, search for a file named after the test
|
|
|
currently executed.")
|
|
|
|
|
|
+(defmacro org-test-at-id (id &rest body)
|
|
|
+ "Run body after placing the point in the headline identified by ID."
|
|
|
+ (declare (indent 1))
|
|
|
+ `(let* ((id-location (org-id-find ,id))
|
|
|
+ (id-file (car id-location))
|
|
|
+ (visited-p (get-file-buffer id-file))
|
|
|
+ to-be-removed)
|
|
|
+ (save-window-excursion
|
|
|
+ (save-match-data
|
|
|
+ (org-id-goto ,id)
|
|
|
+ (setq to-be-removed (current-buffer))
|
|
|
+ (condition-case nil
|
|
|
+ (progn
|
|
|
+ (org-show-subtree)
|
|
|
+ (org-show-block-all))
|
|
|
+ (error nil))
|
|
|
+ (save-restriction ,@body)))
|
|
|
+ (unless visited-p
|
|
|
+ (kill-buffer to-be-removed))))
|
|
|
+
|
|
|
(defmacro org-test-in-example-file (file &rest body)
|
|
|
"Execute body in the Org-mode example file."
|
|
|
(declare (indent 1))
|
|
@@ -96,7 +116,7 @@ currently executed.")
|
|
|
(org-show-subtree)
|
|
|
(org-show-block-all))
|
|
|
(error nil))
|
|
|
- ,@body))
|
|
|
+ (save-restriction ,@body)))
|
|
|
(unless visited-p
|
|
|
(kill-buffer to-be-removed))))
|
|
|
|
|
@@ -179,11 +199,11 @@ files."
|
|
|
(ert (car (which-function))))
|
|
|
|
|
|
(defun org-test-run-all-tests ()
|
|
|
- "Run all defined tests matching \"^org\".
|
|
|
+ "Run all defined tests matching \"\\(org\\|ob\\)\".
|
|
|
Load all test files first."
|
|
|
(interactive)
|
|
|
(org-test-load)
|
|
|
- (ert "org"))
|
|
|
+ (ert "\\(org\\|ob\\)"))
|
|
|
|
|
|
(provide 'org-test)
|
|
|
|