Created
May 6, 2013 14:19
-
-
Save hitode909/5525458 to your computer and use it in GitHub Desktop.
Tap::Harnessの出力が逆になるやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use v5.14; | |
use strict; | |
use warnings; | |
use TAP::Harness; | |
package ReverseSession { | |
use Perl6::Say; | |
use Encode qw(encode_utf8 decode_utf8); | |
use parent qw(TAP::Formatter::Console::Session); | |
sub result { | |
my ($self, $result) = @_; | |
say encode_utf8(join '', reverse split '', decode_utf8($self->_format_for_output($result))); | |
} | |
} | |
package ReverseFormatter { | |
use parent qw(TAP::Formatter::Console); | |
sub open_test { | |
my ( $self, $test, $parser ) = @_; | |
ReverseSession->new({ | |
name => $test, | |
formatter => $self, | |
parser => $parser, | |
show_count => $self->show_count, | |
}); | |
} | |
}; | |
my $harness = TAP::Harness->new({ | |
formatter_class => 'ReverseFormatter', | |
merge => 1, | |
}); | |
my $aggregate = $harness->runtests(@ARGV); | |
exit $aggregate->has_errors; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% perl ~/tmp/sketch-tap-harness-reverse-output.pl t/Plack-HTTPParser-PP/simple.t | |
teg elpmis - 1 ko | |
/ TEG fo tluser - 2 ko | |
TSOP - 3 ko | |
sredaeh htiw TEG fo tluser - 4 ko | |
redaeh enilitlum - 5 ko | |
enilitlum - 6 ko | |
tnemgarf IRU - 7 ko | |
8 ko | |
#\ >- 32% - 9 ko | |
01 ko | |
gnirts yreuq retfa tnemgarf IRU - 11 ko | |
21 ko | |
31 ko | |
31..1 | |
t/Plack-HTTPParser-PP/simple.t .. ok | |
All tests successful. | |
Files=1, Tests=13, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.02 cusr 0.00 csys = 0.06 CPU) | |
Result: PASS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment