Skip to content

Commit

Permalink
Ensure that an instrumented assertion returns its value
Browse files Browse the repository at this point in the history
  • Loading branch information
foretspaisibles committed Jul 1, 2024
1 parent 3fb8c99 commit ed88d03
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/testcase.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -387,10 +387,13 @@ instead of returning normally."))
(return-from evaluate-assertion-lambda)))
(cond
((not success-p)
(signal-failure description))
(signal-failure description)
(return-from instrument-assertion-1
(values nil description)))
(t
(signal-success)))
(values nil))))
(signal-success)
(return-from instrument-assertion-1
t))))))
(evaluate-argument-lambda (argument-lambda)
(handler-case (values nil (funcall argument-lambda))
(t (unexpected-condition)
Expand Down
1 change: 1 addition & 0 deletions testsuite/package.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#:a-simple-failure
#:a-successful-testsuite
#:a-successful-testsuite-with-function-calls
#:ensure-that-an-instrumented-assertion-returns-its-value
#:ensure-that-define-testcase-recognises-sharpsign-single-quote-in-function-names
#:ensure-that-testcase-is-reported-when-wrapped-in-flet
#:interactive-assertion-count
Expand Down
15 changes: 15 additions & 0 deletions testsuite/testcase.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
(define-testcase a-successful-testsuite ()
(assert-t t))

(define-testcase a-testsuite-conditioned-by-assertions ()
(when (assert-t t)
(assert-t t))
(when (assert-t nil)
(assert-t t)))

(define-testcase a-failing-argument-testsuite ()
(assert-t t)
(assert-eq 0 0)
Expand Down Expand Up @@ -109,11 +115,20 @@
(assert-eq 10 (confidence:testcase-failure testcase-outcome))
(assert-eq 1 (confidence:testcase-condition testcase-outcome))))

(define-testcase ensure-that-an-instrumented-assertion-returns-its-value ()
(with-testcase-outcome testcase-outcome
(a-testsuite-conditioned-by-assertions)
(assert-type testcase-outcome 'confidence:testcase-outcome)
(assert-eq 3 (confidence:testcase-total testcase-outcome))
(assert-eq 2 (confidence:testcase-success testcase-outcome))
(assert-eq 1 (confidence:testcase-failure testcase-outcome))))

(define-testcase testsuite-testcase ()
(validate-define-testcase)
(ensure-that-define-testcase-recognises-sharpsign-single-quote-in-function-names)
(ensure-that-testcase-is-reported-when-wrapped-in-flet)
(ensure-that-define-testcase-handles-dotted-lists)
(ensure-that-an-instrumented-assertion-returns-its-value)
(validate-supervise-assertion))

;;;; End of file `testcase.lisp'

0 comments on commit ed88d03

Please sign in to comment.