Welcome! Please see the About page for a little more info on how this works.

0 votes
in Test by
edited by

Libraries like RCF support a programming style where tests are written inline with the source code and always run when the test form is evaluated (for example if the file is reloaded) for fast feedback and better locality of tests and examples - small example tests sit next to the code, and unlike comment blocks, are at lower risk of going out of sync with the code base.

This way, forms wrapped with with-tests, deftest and set-test will run their tests when they're evaluated.

This isn't suitable for long running or heavy tests, which is why having a dynamic var which could be set per namespace seems like a decent fit.

RCF achieves it by always adding a call to test-var at the end of the test form:


(when *run-tests* `(test-var (var ~name)))

Then tests written inline with code will be able to run automatically when code is loaded and provide immediate feedback

Alternative: use tools.namespace


1 Answer

0 votes

Can you start with what problem you're trying to solve? Not sure I get it.

Edited the description, hope it clarifies
I don't understand what you want to add