There is a great Perl module Test::More that everybody uses for unit testing. Here is the very simple script t/sample_1.t:

use Test::More tests => 1;

fail('This test fails');

I wanted to write script that does the same thing, but without Test::More.

I've read several the docs about TAP (test anything protocol) to find out how to write the script. I've read:

Unfortunately the documentation wasn't enough. I had to examine the output of script that uses Test::More to find out that I need to output diagnostics to STDERR (there was nothing about this in the docs).

So, I have written a script that does completely the same things as the script with Test::More script. Here is the listing of t/sample_2.t:

$| = 1;

print "1..1\n";
print "not ok 1 - This test fails\n";
print STDERR "#   Failed test 'This test fails'\n";
print STDERR "#   at t/sample_1.t line 3.\n";
print STDERR "# Looks like you failed 1 test of 1.\n";

exit 1;

But when using prove these 2 scripts output different things. The line "# Failed test 'This test fails'" in prove is displayed on different lines for different tests. Here is the screenshot:

Perl prove output for 2 sample unit tests

I've written a test scripts that uses Capture::Tiny to chec

Edit
Report