From 6e27f3b7598a96da5ffb04a99487c5fe6ad63d03 Mon Sep 17 00:00:00 2001 From: Arnold Noronha Date: Sat, 13 Jun 2020 07:46:31 -0700 Subject: [PATCH] Use Lispworks dspec functionality to locate tests by name. End goal: I want to be able to build an emacs test runner for fiveam, where I can M-. a failing test to jump directly to the failing test. AFAICT, sbcl doesn't have a mechanism for custom location types. We could potentially hack around it by definining an gentemp function name and map back the test name to the intermediate function. But in that case we'll need to make slime aware of this lookup possibility too. --- src/test.lisp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/test.lisp b/src/test.lisp index 32103d5..b9edb5e 100644 --- a/src/test.lisp +++ b/src/test.lisp @@ -62,6 +62,22 @@ If PROFILE is T profiling information will be collected as well." (ensure-list name) `(def-test ,name (,@args) ,@body))) +#+lispworks +(dspec:define-dspec-class def-test nil + "A fiveam test") + +#+lispworks +(dspec:define-form-parser def-test (name &rest rest) + `(def-test ,name)) + +#+lispworks +(dspec:define-form-parser + (def-test (:parser def-test-form-parser))) + +#+lispworks +(dspec:define-form-parser + (test (:parser def-test-form-parser))) + (defvar *default-test-compilation-time* :definition-time) (defmacro def-test (name (&key depends-on (suite '*suite* suite-p) fixture @@ -105,6 +121,9 @@ If PROFILE is T profiling information will be collected as well." `((with-fixture ,name ,args ,@body-forms))) body-forms))) `(progn + #+lispworks + (dspec:record-definition `(def-test ,',name) (dspec:location)) + (register-test ',name ,description ',effective-body ,suite-form ',depends-on ,compile-at ,profile) (when *run-test-when-defined* (run! ',name))