[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 7473cc9 169/271: Improve documentation and error handling
From: |
Jackson Ray Hamilton |
Subject: |
[elpa] master 7473cc9 169/271: Improve documentation and error handling for async tests. |
Date: |
Thu, 05 Feb 2015 18:30:54 +0000 |
branch: master
commit 7473cc93a1a85874cf9536e50756d7be0388c73d
Author: Jackson Ray Hamilton <address@hidden>
Commit: Jackson Ray Hamilton <address@hidden>
Improve documentation and error handling for async tests.
---
test/context-coloring-test.el | 49 +++++++++++++++++++++++++----------------
1 files changed, 30 insertions(+), 19 deletions(-)
diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el
index 9a9f2db..06fb6fc 100644
--- a/test/context-coloring-test.el
+++ b/test/context-coloring-test.el
@@ -28,9 +28,10 @@ FIXTURE."
,@body)
(context-coloring-test-cleanup))))
-(defun context-coloring-test-with-temp-buffer (callback)
- "Create a temporary buffer, and evaluate BODY there like `progn'.
-See also `with-temp-file' and `with-output-to-string'."
+(defun context-coloring-test-with-temp-buffer-async (callback)
+ "Create a temporary buffer, and evaluate CALLBACK there. A
+teardown callback is passed to CALLBACK for it to invoke when it
+is done."
(let ((temp-buffer (make-symbol "temp-buffer")))
(let ((previous-buffer (current-buffer))
(temp-buffer (generate-new-buffer " *temp*")))
@@ -43,9 +44,10 @@ See also `with-temp-file' and `with-output-to-string'."
(set-buffer previous-buffer))))))
(defun context-coloring-test-with-fixture-async (fixture callback)
- "Evaluate BODY in a temporary buffer with the relative
-FIXTURE."
- (context-coloring-test-with-temp-buffer
+ "Evaluate CALLBACK in a temporary buffer with the relative
+FIXTURE. A teardown callback is passed to CALLBACK for it to
+invoke when it is done."
+ (context-coloring-test-with-temp-buffer-async
(lambda (done-with-temp-buffer)
(insert (context-coloring-test-read-file fixture))
(funcall
@@ -57,12 +59,12 @@ FIXTURE."
(defun context-coloring-test-js-mode (fixture callback)
(context-coloring-test-with-fixture-async
fixture
- (lambda (done-with-fixture)
+ (lambda (done-with-test)
(js-mode)
(context-coloring-mode)
(context-coloring-colorize
(lambda ()
- (funcall callback done-with-fixture))))))
+ (funcall callback done-with-test))))))
(defmacro context-coloring-test-js2-mode (fixture &rest body)
`(context-coloring-test-with-fixture
@@ -115,9 +117,10 @@ FIXTURE."
(ert-deftest-async context-coloring-test-js-mode-function-scopes (done)
(context-coloring-test-js-mode
"./fixtures/function-scopes.js"
- (lambda (done-with-fixture)
- (context-coloring-test-js-function-scopes)
- (funcall done-with-fixture)
+ (lambda (teardown)
+ (unwind-protect
+ (context-coloring-test-js-function-scopes)
+ (funcall teardown))
(funcall done))))
(ert-deftest context-coloring-test-js2-mode-function-scopes ()
@@ -130,10 +133,14 @@ FIXTURE."
(context-coloring-test-region-level-p 28 35 0)
(context-coloring-test-region-level-p 35 41 1))
-;; (ert-deftest context-coloring-test-js-mode-global ()
-;; (context-coloring-test-js-mode
-;; "./fixtures/global.js"
-;; (context-coloring-test-js-global)))
+(ert-deftest-async context-coloring-test-js-mode-global (done)
+ (context-coloring-test-js-mode
+ "./fixtures/global.js"
+ (lambda (teardown)
+ (unwind-protect
+ (context-coloring-test-js-global)
+ (funcall teardown))
+ (funcall done))))
(ert-deftest context-coloring-test-js2-mode-global ()
(context-coloring-test-js2-mode
@@ -164,10 +171,14 @@ FIXTURE."
(context-coloring-test-region-level-p 102 117 3)
(context-coloring-test-region-level-p 117 123 2))
-;; (ert-deftest context-coloring-test-js-mode-catch ()
-;; (context-coloring-test-js-mode
-;; "./fixtures/catch.js"
-;; (context-coloring-test-js-catch)))
+(ert-deftest-async context-coloring-test-js-mode-catch (done)
+ (context-coloring-test-js-mode
+ "./fixtures/catch.js"
+ (lambda (teardown)
+ (unwind-protect
+ (context-coloring-test-js-catch)
+ (funcall teardown))
+ (funcall done))))
(ert-deftest context-coloring-test-js2-mode-catch ()
(context-coloring-test-js2-mode
- [elpa] master e040ca0 181/271: Just use stable emacs., (continued)
- [elpa] master e040ca0 181/271: Just use stable emacs., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 9e7ee77 155/271: Add catch test. Don't uncolorize., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 665a54a 167/271: Add more js-mode tests., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 43f2e3b 168/271: Increase reliability of async tests., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 28183e4 188/271: Readme., Jackson Ray Hamilton, 2015/02/05
- [elpa] master bdfdbe4 151/271: Improve benchmarks., Jackson Ray Hamilton, 2015/02/05
- [elpa] master d27f2fe 182/271: Fix callback removal., Jackson Ray Hamilton, 2015/02/05
- [elpa] master cb0644a 136/271: Cleanup JavaScript tests., Jackson Ray Hamilton, 2015/02/05
- [elpa] master c1e9226 171/271: Reorganize lib., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 9e14226 135/271: Merge branch 'feature/language-generalization' into develop, Jackson Ray Hamilton, 2015/02/05
- [elpa] master 7473cc9 169/271: Improve documentation and error handling for async tests.,
Jackson Ray Hamilton <=
- [elpa] master b468d1c 166/271: Improve block scope test. Rename and document block scope variable., Jackson Ray Hamilton, 2015/02/05
- [elpa] master d411168 175/271: Revert to single var., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 4c5f3ab 145/271: Fix first-run bug, passing js2-mode test., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 15bfad7 165/271: Renames., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 4d73262 152/271: Speed up local name lookup., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 4fee39d 174/271: Remove .jslintrc files., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 903d938 176/271: Update readme., Jackson Ray Hamilton, 2015/02/05
- [elpa] master d48e8cc 057/271: Add benchmark., Jackson Ray Hamilton, 2015/02/05
- [elpa] master d157167 258/271: Strip headers. Use make dependencies., Jackson Ray Hamilton, 2015/02/05
- [elpa] master 63e2590 207/271: Merge branch 'develop', Jackson Ray Hamilton, 2015/02/05