From 0440b83ac545f1e6206ed87a9de0d59023867506 Mon Sep 17 00:00:00 2001 From: Martyn Jago Date: Mon, 14 Nov 2011 21:14:50 +0000 Subject: [PATCH] Changes to fix sandboxed tests to suit the standard code block syntax, and some changes to reduce ID testing scope and improve result gathering. * testing/org-test.el: Add org as an executable language for sand-boxed testing to suit the standard code block syntax. Use .org-test-id-locations as ID file temporarily whilst testing. Add `org-test-update-id-locations' to do just that. Clear *Messages* buffer and temporarily set `message-log-max to t to ensure capturing entire test backtrace. * testing/.gitignore: ignore testing/.org-test-id-locations --- testing/.gitignore | 1 + testing/org-test.el | 36 ++++++++++++++++++++++++++++-------- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/testing/.gitignore b/testing/.gitignore index d4748c007..98f9c4681 100644 --- a/testing/.gitignore +++ b/testing/.gitignore @@ -1,3 +1,4 @@ # in case anyone wants to keep ert in the testing directory, e.g., for # old versions of Emacs ert +.org-test-id-locations diff --git a/testing/org-test.el b/testing/org-test.el index 0f9cf1ab6..02957b599 100644 --- a/testing/org-test.el +++ b/testing/org-test.el @@ -39,8 +39,9 @@ (unless (featurep 'org) (setq load-path (cons org-lisp-dir load-path)) (require 'org) - (org-babel-do-load-languages - 'org-babel-load-languages '((sh . t)))) + (require 'org-id) + (org-babel-do-load-languages + 'org-babel-load-languages '((sh . t) (org . t)))) (let* ((load-path (cons org-test-dir @@ -314,21 +315,40 @@ otherwise place the point at the beginning of the inserted text." "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*\\.org$")) (find-file file))) +(defun org-test-update-id-locations () + (org-id-update-id-locations + (directory-files + org-test-example-dir 'full + "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*\\.org$"))) + (defun org-test-run-batch-tests () "Run all defined tests matching \"\\(org\\|ob\\)\". Load all test files first." (interactive) - (org-test-touch-all-examples) - (org-test-load) - (ert-run-tests-batch-and-exit "\\(org\\|ob\\)")) + (let ((org-id-track-globally t) + (org-id-locations-file + (convert-standard-filename + (expand-file-name + "testing/.test-org-id-locations" + org-base-dir)))) + (org-test-touch-all-examples) + (org-test-update-id-locations) + (org-test-load) + (ert-run-tests-batch-and-exit "\\(org\\|ob\\)"))) (defun org-test-run-all-tests () "Run all defined tests matching \"\\(org\\|ob\\)\". Load all test files first." (interactive) - (org-test-touch-all-examples) - (org-test-load) - (ert "\\(org\\|ob\\)")) + (let ((org-id-track-globally t) + (message-log-max t)) + (with-current-buffer + (get-buffer-create "*Messages*") + (erase-buffer)) + (org-test-touch-all-examples) + (org-test-update-id-locations) + (org-test-load) + (ert "\\(org\\|ob\\)"))) (provide 'org-test)