forked from mirrors/org-mode
Indicate tests with missing dependencies by adding a expected failing test
* testing/lisp/test-ob-R.el (featurep): Signal missing dependencies with an error rather than a throw. * testing/org-test.el (missing-test-dependency): Define the error signal for missing dependencies. (org-test-for-executable): Signal missing dependencies with an error rather than a throw. (org-test-load): Define an expected failing test for each file with missing dependencies.
This commit is contained in:
parent
49d6951caa
commit
630b9c80ca
|
@ -8,7 +8,7 @@
|
|||
|
||||
(org-test-for-executable "R")
|
||||
(unless (featurep 'ess)
|
||||
(throw 'missing-test-dependency "ESS"))
|
||||
(signal 'missing-test-dependency "ESS"))
|
||||
|
||||
(let ((load-path (cons (expand-file-name
|
||||
".." (file-name-directory
|
||||
|
|
|
@ -102,6 +102,10 @@ org-test searches this directory up the directory tree.")
|
|||
|
||||
|
||||
;;; Functions for writing tests
|
||||
(put 'missing-test-dependency
|
||||
'error-conditions
|
||||
'(error missing-test-dependency))
|
||||
|
||||
(defun org-test-for-executable (exe)
|
||||
"Throw an error if EXE is not available.
|
||||
This can be used at the top of code-block-language specific test
|
||||
|
@ -111,7 +115,7 @@ executable."
|
|||
(lambda (acc dir)
|
||||
(or acc (file-exists-p (expand-file-name exe dir))))
|
||||
exec-path :initial-value nil)
|
||||
(throw 'missing-test-dependency exe)))
|
||||
(signal 'missing-test-dependency (list exe))))
|
||||
|
||||
(defun org-test-buffer (&optional file)
|
||||
"TODO: Setup and return a buffer to work with.
|
||||
|
@ -275,10 +279,17 @@ otherwise place the point at the beginning of the inserted text."
|
|||
(lambda (path)
|
||||
(if (file-directory-p path)
|
||||
(rld path)
|
||||
(catch 'missing-test-dependency
|
||||
(when (string-match "^[A-Za-z].*\\.el$"
|
||||
(condition-case err
|
||||
(when (string-match "^[A-Za-z].*\\.el$"
|
||||
(file-name-nondirectory path))
|
||||
(load-file path)))))
|
||||
(load-file path))
|
||||
(missing-test-dependency
|
||||
(let ((name (intern
|
||||
(concat "org-missing-dependency/"
|
||||
(file-name-nondirectory
|
||||
(file-name-sans-extension path))))))
|
||||
(eval `(ert-deftest ,name ()
|
||||
:expected-result :failed (should nil))))))))
|
||||
(directory-files base 'full
|
||||
"^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*\\.el$"))))
|
||||
(rld (expand-file-name "lisp" org-test-dir))
|
||||
|
|
Loading…
Reference in a new issue