"Notevn (via srfi-64 list)" <xxxxxx@srfi.schemers.org> writes:
> hello,
> new to to guile and scheme, and Im experimenting with the srfi-64 module.
>
> i noticed an inconsistency in the test runner:
>
> for example, given these two tests:
> (test-assert "truth" #t)
> (test-error "div by zero" (lambda () (/ 1 0)))
>
> when logging the test runner, the second one does not have a test-name value with the name of the test and instead have a expected-error with the name of the test.
>
> (i also tested test-equal and test-ewv and both return a test-name value)
>
> is there a reason for this inconsistency?
The general philosophy behind the arguments seems to be that the
test-name is optional. Fox example:
--8<---------------cut here---------------start------------->8---
(test-assert [test-name] expression)
(test-equal [test-name] expected test-expr)
--8<---------------cut here---------------end--------------->8---
However for `test-error', we have *two* optional arguments:
--8<---------------cut here---------------start------------->8---
(test-error [[test-name] error-type] test-expr)
--8<---------------cut here---------------end--------------->8---
So in the case only one of them is provided, the specification decided
that error-type gets the priority. Seems to be in line with the
"test-name is optional" thinking, so I am not sure I would cal it an
inconsistency.
> am i doing something wrong?
Well, yes, you are passing only two arguments, so the string is passed
as the `error-type'. Try this to test for any error while naming the
test:
--8<---------------cut here---------------start------------->8---
(test-error "div by zero" #t (lambda () (/ 1 0)))
--8<---------------cut here---------------end--------------->8---
Have a nice day,
Tomas
--
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.