On Wednesday 14 March 2007 00:00, Michael G Schwern wrote: > chromatic wrote:
> > If only there were a way, perhaps in Test::Builder, to supply > > diag()nostic information to the TAP output stream. > Diagnostics (comments) in the TAP stream should not be displayed. diag() > does not go to the TAP output stream, it goes to STDERR. This is why its > displayed when a test is run by Test::Harness despite being a comment, > because TH does absolutely nothing with STDERR. I think I see the problem. There ought to be a way to capture diagnostic information in the TAP stream because it's useful for diagnosing problems. However, there's absolutely no way to capture diagnostic information in the TAP stream because test libraries tend to use Test::Builder->diag() to signify that they are sending diagnostic information, and of course Test::Builder->diag() dutifully sends all that information to STDERR. The problem is that there's no way to tell that that information sent to Test::Builder->diag() is diagnostic information for the tests because once it goes out on STDERR, it could be anything. > Even if we had an explicit way in TAP to say "please display this > information to the user", which we currently do not but probably should, > that still leaves the problem of warnings and other noise which might go to > STDERR which are not at all under the control of the TAP producer. Perhaps there should be a method in Test::Builder called send_diagnostic_information_about_the_test_to_TAP(). That would be a very easy way for TAP producers to signal their intent that a certain string of information should go into the TAP stream rather than STDERR. Perhaps it could even print that information to STDERR as well, but the name send_diagnostic_information_about_the_test_to_TAP_and_STDERR() is just too long. Maybe there could be a shorter version, such as diag(). Maybe it could even be so magical that random stuff printed to STDERR would not interfere with it... oh somehow this must be possible in Perl! I'll just get in my time machine and go back a couple of years and patch Test::Harness::Straps to understand diagnostics that come in on STDOUT too. Now if only Test::Harness::Straps could print to STDERR... ah, a man can dream. -- c