Stefan Bodewig wrote:
Hi,
while looking into the ant-contrib test failures in Gump I revisited
our logging system for the first time since long.
Consider I have a task that does log("Some message\n").
Project#fireMessageLogged() will then strip the \n (at leat on Unix)
and DefaultLogger will re-add it for the output.
AntTestListener in turn will not add a new-line but simply concatenate
all log output into a StringBuffer.
If I now say assertLogContaining("Some message\n") it fails. Should
it? Yes, I know, I shouldn't use \n in my log message in the first
place, but still.
Now say I'm doing
log("line1");
log("line2");
in the task. I have to assert that the log contains "line1line2"
right now, which is rather ugly and unreadable. Again, should it be
that way?
I guess we'd break quite a few tests if we change the behavior,
though.
Yes, a lot.
Removing the new-lines has made the tests easy to write.
- One does not need to worry about \r, \r\n or \n issues
when looking at the output.
- I do not find it too ugly!
However, I suppose that an argument may be made that the test is
not actually looking at what a task outputs to a user
and one should test for that.
Peter
Stefan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]