From a84259bba32a69ae0b54dc577f1ba19b23625714 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Sun, 13 Nov 2011 12:30:25 -0700 Subject: [PATCH] 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. --- testing/lisp/test-ob-R.el | 2 +- testing/org-test.el | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/testing/lisp/test-ob-R.el b/testing/lisp/test-ob-R.el index bc637ff..bb9783f 100644 --- a/testing/lisp/test-ob-R.el +++ b/testing/lisp/test-ob-R.el @@ -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 diff --git a/testing/org-test.el b/testing/org-test.el index 7d2f7e7..0f9cf1a 100644 --- a/testing/org-test.el +++ b/testing/org-test.el @@ -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)) -- 1.7.4.1