Permalink
Browse files

Conditionally call special TAP methods in Test::Builder.

Otherwise other formatters don't work.  This is a pretty crappy way
to do it, until we get a config event or something.
  • Loading branch information...
1 parent fcc6c8d commit 4d5555ff947bf74f3dea5fc57fa78f2ead535d9b @schwern schwern committed Aug 19, 2012
Showing with 12 additions and 0 deletions.
  1. +12 −0 lib/Test/Builder.pm
View
@@ -1361,6 +1361,9 @@ sub use_numbers {
my( $self, $use_nums ) = @_;
my $formatter = $self->formatter;
+
+ return unless $formatter->can("use_numbers");
+
if( defined $use_nums ) {
$formatter->use_numbers($use_nums);
}
@@ -1379,6 +1382,9 @@ calls to C<diag()> and C<note()>.
sub no_diag {
my $self = shift;
+ my $formatter = $self->formatter;
+ return unless $formatter->can("show_logs");
+
if( @_ ) {
my $no = shift;
$self->formatter->show_logs(!$no);
@@ -1402,6 +1408,9 @@ If this is true, none of that will be done.
sub no_ending {
my $self = shift;
+ my $formatter = $self->formatter;
+ return unless $formatter->can("show_ending_commentary");
+
if( @_ ) {
my $no = shift;
$self->{No_Ending} = $no;
@@ -1423,6 +1432,9 @@ If set to true, no "1..N" header will be printed.
sub no_header {
my $self = shift;
+ my $formatter = $self->formatter;
+ return unless $formatter->can("show_header");
+
if( @_ ) {
my $no = shift;
$self->formatter->show_header(!$no);

0 comments on commit 4d5555f

Please sign in to comment.