branch: externals/futur
commit 14de978bdac9cf1ab16dfc79fc9ff9b7e7aa2157
Author: Stefan Monnier <[email protected]>
Commit: Stefan Monnier <[email protected]>
futur-tests.el (futur-simple): Test the new error-fun semantics
---
futur-tests.el | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/futur-tests.el b/futur-tests.el
index 392c1a153f..047af6ef9a 100644
--- a/futur-tests.el
+++ b/futur-tests.el
@@ -50,7 +50,24 @@
(let ((p (futur-let* ((x1 5)
(x2 <- (futur-failed '(scan-error "Oops"))))
(list (+ x1 x2) (error "Wow!")))))
- (should-error (futur-blocking-wait-to-get-result p) :type 'scan-error)))
+ (should-error (futur-blocking-wait-to-get-result p) :type 'scan-error))
+
+ (let ((handlers `((wrong-type-argument . ,(lambda (_) :wta))
+ (scan-error . ,(lambda (_) :scan-error))
+ (error . ,(lambda (_) :error)))))
+ (should (equal
+ (condition-case nil
+ (progn (futur-blocking-wait-to-get-result
+ (futur-failed '(quit)) handlers)
+ :not-quit)
+ (quit :quit))
+ :quit))
+ (should (equal (futur-blocking-wait-to-get-result
+ (futur-failed '(wrong-number-of-arguments)) handlers)
+ :error))
+ (should (equal (futur-blocking-wait-to-get-result
+ (futur-failed '(scan-error)) handlers)
+ :scan-error))))
(ert-deftest futur-ordering ()
"Test order of execution of callbacks."