From 90bbf20b41a30873966a1019af53af4d1241111e Mon Sep 17 00:00:00 2001 From: Chris Williams Date: Sun, 23 Apr 2017 10:31:52 +0100 Subject: [PATCH] Unexpected exceptions do not return as a pass --- test/simple_expectations/core_test.clj | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/test/simple_expectations/core_test.clj b/test/simple_expectations/core_test.clj index a8c01b6..6abd1d4 100644 --- a/test/simple_expectations/core_test.clj +++ b/test/simple_expectations/core_test.clj @@ -21,7 +21,7 @@ (defrecord SimpleCheck [] CustomPred - (expect-fn [e a] (:result a)) + (expect-fn [e a] (true? (:result a))) (expected-message [e a str-e str-a] (format "%s of %s failures" (:failing-size a) (:num-tests a))) @@ -30,3 +30,11 @@ (expect (->SimpleCheck) (tc/quick-check 100 prop-no-42)) + +;; Handling so unexpected exceptions do not return as passed + +(def prop-that-throws-exception + (prop/for-all [v gen/int] + (throw (ex-info "Exception" {})))) + +(expect (->SimpleCheck) (tc/quick-check 100 prop-that-throws-exception))