EUnit 2.0 alpha testers wanted
Vlad Dumitrescu
vlad_dumitrescu@REDACTED
Wed Apr 19 22:24:43 CEST 2006
----- Original Message -----
From: "Richard Carlsson" <richardc@REDACTED>
> Vlad Dumitrescu wrote:
>> In the bigger picture, it's not io output that's most interesting, but
>> any
>> Erlang term. Rendering the term is then left to the corresponding
>> frontend.
>
> Note that if the test returns a value, then it succeeds by definition,
> so there is little point in displaying that value, and if many tests yield
> large values, it would cause a lot of unnecessary sending of data which
> would normally be discarded by the client anyway.
>
> However, if you write a test such as ?_test(ok = foo()), and that fails,
> you will get the erroneous term included in the exception, and that is
> part of the error report. So I think I/O is the only missing piece.
I didn't explain properly. I don't mean the result of the test function, but
what normally is (as you say) printed out with io:formats in the code. What
I mean is that instead of capturing the results of io:format (i.e. the
displayed strings), I may want to get the original terms, so that another
renderer than io:format could display it in a more apropriate way (for
example folding long terms, or maybe having the terms describe a graphical
picture).
One simple way would be to have a ?_message(Format, [Terms]) that in the
simplest form translates to an io:format call, but not necessarily.
Or maybe I am just making life more complicated than it should be and there
is a better way right under my nose... :-)
regards,
Vlad
More information about the erlang-questions
mailing list