tokuhirom / Test-Pretty

Other
20 stars 17 forks source link

prettifies only Test::Simple/Test::More tests, but not arbitrary TAP #22

Closed daxim closed 10 years ago

daxim commented 10 years ago

file simple.t

use Test::Simple tests => 1;
ok 1, 'some test';

file more.t

use Test::More;
ok 1, 'some test';
done_testing;

Running these tests produces the pretty output with colours, checkmarks and fat arrows around filenames – as expected.

$ prove -v -Pretty simple.t more.t

==> simple.t <==

✓  some test

ok

==> more.t <====

✓  some test

ok
All tests successful.
Files=2, Tests=2,  0 wallclock secs ( 0.03 usr  0.00 sys +  0.09 cusr  0.00 csys =  0.12 CPU)
Result: PASS

If TAP is generated in other ways, Test::Pretty fails to do its work.

file manual-tap.t

#!/usr/bin/perl
print <<'END'
ok 1 - some test
1..1
END

No colours/checkmarks:

$ prove -v -Pretty manual-tap.t

ok 1 - some test
1..1

ok
All 1 subtests passed

Non-Perl TAP generation:

file manual-tap.sh

#!/bin/sh
echo "ok 1 - some test"
echo "1..1"

No colours/checkmarks:

$ prove -v -Pretty -e sh manual-tap.sh

ok 1 - some test
1..1

Recorded TAP stream:

file manual-tap.tap

ok 1 - some test
1..1

No colours/checkmarks:

$ prove -v -Pretty -e cat manual-tap.tap

ok 1 - some test
1..1

Streaming TAP into pipe:

$ printf "ok 1 - some test\n1..1\n" | prove -v -Pretty -e 'cat -' /dev/null

Checkmark is missing.

==> /dev/null <==

ok 1 - some test
1..1
All tests successful.
Files=1, Tests=1,  0 wallclock secs ( 0.02 usr +  0.00 sys =  0.02 CPU)
Result: PASS
tokuhirom commented 10 years ago

Test::Pretty hacks perl level functions. It don't affect to non-perl programs.