Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add abort-on-error option #63

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions core/assertion.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
(:import-from #:dissect
#:stack)
(:export #:*debug-on-error*
#:*quit-on-failure*
#:ok
#:ng
#:assert-ok
Expand All @@ -24,6 +25,11 @@
(and (boundp debug-on-error-symbol)
(symbol-value debug-on-error-symbol))))

(defvar *quit-on-failure*
(let ((quit-on-failure-symbol (intern (string :*rove-quit-on-failure*) :cl-user)))
(and (boundp quit-on-failure-symbol)
(symbol-value quit-on-failure-symbol))))
Comment on lines +29 to +31
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this be better done outside the rove?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a way to configure before loading Rove.
It is already done for *debug-on-error*, so I suppose @Sasanidas refers to it.

You can set (setf *rove-debug-on-error* t) in ~/.roswell/init.lisp without loading Rove whenever you run Lisp.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed.
I was thinking about the wildness of using symbols from the cl-user package.


(defun form-steps (form)
(if (consp form)
(let ((steps '()))
Expand Down
6 changes: 6 additions & 0 deletions core/test.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#:rove/core/suite/package)
(:import-from #:rove/core/assertion
#:*debug-on-error*
#:*quit-on-failure*
#:failed-assertion)
(:import-from #:dissect
#:stack)
Expand Down Expand Up @@ -37,6 +38,11 @@
:desc "Raise an error while testing."))
(return nil))))
(funcall function)))))
(when (and *quit-on-failure*
(not (passedp (stats-context *stats*))))
(format t "Failed test, with the abort option enabled. ~%")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that rove uses repoter to abstract the output.

(abort))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about sending out some kind of signal and having rove:run / rove:run-test catch it?


(test-finish *stats* desc)))

(defmacro with-testing-with-options (desc (&key name) &body body)
Expand Down