From 2b7ad83409684e7a478133ddd4f27a283d9520c8 Mon Sep 17 00:00:00 2001 From: Fermin MF Date: Fri, 1 Sep 2023 12:39:15 +0200 Subject: [PATCH 1/3] Add abort-on-error option --- core/assertion.lisp | 6 ++++++ core/test.lisp | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/core/assertion.lisp b/core/assertion.lisp index dd35f63..18aba4f 100644 --- a/core/assertion.lisp +++ b/core/assertion.lisp @@ -7,6 +7,7 @@ (:import-from #:dissect #:stack) (:export #:*debug-on-error* + #:*abort-on-error* #:ok #:ng #:assert-ok @@ -24,6 +25,11 @@ (and (boundp debug-on-error-symbol) (symbol-value debug-on-error-symbol)))) +(defvar *abort-on-error* + (let ((abort-on-error-symbol (intern (string :*rove-abort-on-error*) :cl-user))) + (and (boundp abort-on-error-symbol) + (symbol-value abort-on-error-symbol)))) + (defun form-steps (form) (if (consp form) (let ((steps '())) diff --git a/core/test.lisp b/core/test.lisp index e6b6e5f..a1789d5 100644 --- a/core/test.lisp +++ b/core/test.lisp @@ -5,6 +5,7 @@ #:rove/core/suite/package) (:import-from #:rove/core/assertion #:*debug-on-error* + #:*abort-on-error* #:failed-assertion) (:import-from #:dissect #:stack) @@ -37,7 +38,11 @@ :desc "Raise an error while testing.")) (return nil)))) (funcall function))))) - (test-finish *stats* desc))) + (when (and *abort-on-error* (not (passedp (stats-context *stats*)))) + (format t "Failed test, with the abort option enabled. ~%") + (abort)) + + (test-finish *stats* desc)))) (defmacro with-testing-with-options (desc (&key name) &body body) `(call-with-testing-with-options ,desc ,name (lambda () ,@body))) From e048b8c0455d7593a5c2e7b84436414f612b74bc Mon Sep 17 00:00:00 2001 From: Fermin MF Date: Mon, 4 Sep 2023 06:18:27 +0200 Subject: [PATCH 2/3] Fix parenthesis mismatch --- core/test.lisp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/test.lisp b/core/test.lisp index a1789d5..6db4eec 100644 --- a/core/test.lisp +++ b/core/test.lisp @@ -38,11 +38,12 @@ :desc "Raise an error while testing.")) (return nil)))) (funcall function))))) - (when (and *abort-on-error* (not (passedp (stats-context *stats*)))) + (when (and *abort-on-error* + (not (passedp (stats-context *stats*)))) (format t "Failed test, with the abort option enabled. ~%") (abort)) - (test-finish *stats* desc)))) + (test-finish *stats* desc))) (defmacro with-testing-with-options (desc (&key name) &body body) `(call-with-testing-with-options ,desc ,name (lambda () ,@body))) From 378ed301856e7e5321d8bbecc7a33c9e4ca5e327 Mon Sep 17 00:00:00 2001 From: Fermin MF Date: Mon, 4 Sep 2023 06:37:02 +0200 Subject: [PATCH 3/3] Change abort-on-errors to quit on failure --- core/assertion.lisp | 10 +++++----- core/test.lisp | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/core/assertion.lisp b/core/assertion.lisp index 18aba4f..92d8ffc 100644 --- a/core/assertion.lisp +++ b/core/assertion.lisp @@ -7,7 +7,7 @@ (:import-from #:dissect #:stack) (:export #:*debug-on-error* - #:*abort-on-error* + #:*quit-on-failure* #:ok #:ng #:assert-ok @@ -25,10 +25,10 @@ (and (boundp debug-on-error-symbol) (symbol-value debug-on-error-symbol)))) -(defvar *abort-on-error* - (let ((abort-on-error-symbol (intern (string :*rove-abort-on-error*) :cl-user))) - (and (boundp abort-on-error-symbol) - (symbol-value abort-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)))) (defun form-steps (form) (if (consp form) diff --git a/core/test.lisp b/core/test.lisp index 6db4eec..3f44e49 100644 --- a/core/test.lisp +++ b/core/test.lisp @@ -5,7 +5,7 @@ #:rove/core/suite/package) (:import-from #:rove/core/assertion #:*debug-on-error* - #:*abort-on-error* + #:*quit-on-failure* #:failed-assertion) (:import-from #:dissect #:stack) @@ -38,7 +38,7 @@ :desc "Raise an error while testing.")) (return nil)))) (funcall function))))) - (when (and *abort-on-error* + (when (and *quit-on-failure* (not (passedp (stats-context *stats*)))) (format t "Failed test, with the abort option enabled. ~%") (abort))