-
Notifications
You must be signed in to change notification settings - Fork 128
Open
Description
So… I'm pretty sure there's a double evaluation bug in the testing library. It looks like the test suite is working around this bug because each call to xtmtest looks like:
(xtmtest '(setup-a-fixture-usually-by-binding-a-func)
form-that-evaluates-to-a-number-or-other-self-eval-value #98 Quoting the setup protects from the double eval, and the call part always evaluating to a simple constant protects that too. The test macros are also unhygenic and the test suite is written with that assumption. There's lots of code like:
(xtmtest `(bind-func test_something (lambda (x) ...))
(test_something 1) #t)
(xtmtest-result (test_something 2) #372 This means we have to be very careful about naming test functions and the like or test suites could interfere with each other. So, I propose the following (and there will be pull requests incoming)
- Writing a new
xtmtest-with-fixturemacro that would work something like:
(xtmtest-with-fixture
(bind-func test_list_membership
(lambda (x)
(let ((lst (list 1 2 3))
(result (member x lst)))
(if (not (null? result))
(println "list contains" x)
(println "list does not contain" x))
(not (null? result)))))
(test_list_membership 2) 1)
(test_list_membership 4) 0))- Test this new macro
- Rewrite the test suite to use this new macro
- Eliminate
xtmtest(and potentially renamextmtest-with-fixtureback toxtmtest - Fix double evaluation in
xtmtest-compile
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels