Browse Source

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
Martyn Jago 13 years ago
parent
commit
0440b83ac5
2 changed files with 29 additions and 8 deletions
  1. 1 0
      testing/.gitignore
  2. 28 8
      testing/org-test.el

+ 1 - 0
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

+ 28 - 8
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)