org tests using throw/catch rather than errors to avoid loading unsupported tests
This commit is contained in:
parent
706de59f07
commit
4446e50e3d
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
(org-test-for-executable "R")
|
(org-test-for-executable "R")
|
||||||
(unless (featurep 'ess)
|
(unless (featurep 'ess)
|
||||||
(signal 'org-test-lib-not-found "ess"))
|
(throw 'missing-test-dependency "ESS"))
|
||||||
|
|
||||||
(let ((load-path (cons (expand-file-name
|
(let ((load-path (cons (expand-file-name
|
||||||
".." (file-name-directory
|
".." (file-name-directory
|
||||||
|
|
|
@ -100,15 +100,6 @@ org-test searches this directory up the directory tree.")
|
||||||
(defconst org-test-link-in-heading-file
|
(defconst org-test-link-in-heading-file
|
||||||
(expand-file-name "link-in-heading.org" org-test-dir))
|
(expand-file-name "link-in-heading.org" org-test-dir))
|
||||||
|
|
||||||
;; Errors used by test files that shouldn't be run because local
|
|
||||||
;; dependencies are missing.
|
|
||||||
(put 'org-exe-not-found
|
|
||||||
'error-conditions
|
|
||||||
'(error org-test-missing-dependency org-test-exe-not-found))
|
|
||||||
(put 'org-lib-not-found
|
|
||||||
'error-conditions
|
|
||||||
'(error org-test-missing-dependency org-test-lib-not-found))
|
|
||||||
|
|
||||||
|
|
||||||
;;; Functions for writing tests
|
;;; Functions for writing tests
|
||||||
(defun org-test-for-executable (exe)
|
(defun org-test-for-executable (exe)
|
||||||
|
@ -117,7 +108,7 @@ This can be used at the top of code-block-language specific test
|
||||||
files to avoid loading the file on systems without the
|
files to avoid loading the file on systems without the
|
||||||
executable."
|
executable."
|
||||||
(unless (> (length (shell-command-to-string (format "which %s" exe))) 0)
|
(unless (> (length (shell-command-to-string (format "which %s" exe))) 0)
|
||||||
(signal 'org-test-exe-not-found exe)))
|
(throw 'missing-test-dependency exe)))
|
||||||
|
|
||||||
(defun org-test-buffer (&optional file)
|
(defun org-test-buffer (&optional file)
|
||||||
"TODO: Setup and return a buffer to work with.
|
"TODO: Setup and return a buffer to work with.
|
||||||
|
@ -278,10 +269,9 @@ otherwise place the point at the beginning of the inserted text."
|
||||||
(mapc
|
(mapc
|
||||||
(lambda (path)
|
(lambda (path)
|
||||||
(if (file-directory-p path)
|
(if (file-directory-p path)
|
||||||
(rld path)
|
(rld path)
|
||||||
(condition-case nil
|
(catch 'missing-test-dependency
|
||||||
(load-file path)
|
(load-file path))))
|
||||||
(org-test-missing-dependency nil))))
|
|
||||||
(directory-files base 'full
|
(directory-files base 'full
|
||||||
"^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*\\.el$"))))
|
"^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*\\.el$"))))
|
||||||
(rld (expand-file-name "lisp" org-test-dir))
|
(rld (expand-file-name "lisp" org-test-dir))
|
||||||
|
|
Loading…
Reference in New Issue