Skip to content
This repository
Browse code

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...
commit 4d5555ff947bf74f3dea5fc57fa78f2ead535d9b 1 parent fcc6c8d
Michael G. Schwern authored August 19, 2012

Showing 1 changed file with 12 additions and 0 deletions. Show diff stats Hide diff stats

  1. 12  lib/Test/Builder.pm
12  lib/Test/Builder.pm
@@ -1361,6 +1361,9 @@ sub use_numbers {
1361 1361
     my( $self, $use_nums ) = @_;
1362 1362
 
1363 1363
     my $formatter = $self->formatter;
  1364
+
  1365
+    return unless $formatter->can("use_numbers");
  1366
+
1364 1367
     if( defined $use_nums ) {
1365 1368
         $formatter->use_numbers($use_nums);
1366 1369
     }
@@ -1379,6 +1382,9 @@ calls to C<diag()> and C<note()>.
1379 1382
 sub no_diag {
1380 1383
     my $self = shift;
1381 1384
 
  1385
+    my $formatter = $self->formatter;
  1386
+    return unless $formatter->can("show_logs");
  1387
+
1382 1388
     if( @_ ) {
1383 1389
         my $no = shift;
1384 1390
         $self->formatter->show_logs(!$no);
@@ -1402,6 +1408,9 @@ If this is true, none of that will be done.
1402 1408
 sub no_ending {
1403 1409
     my $self = shift;
1404 1410
 
  1411
+    my $formatter = $self->formatter;
  1412
+    return unless $formatter->can("show_ending_commentary");
  1413
+
1405 1414
     if( @_ ) {
1406 1415
         my $no = shift;
1407 1416
         $self->{No_Ending} = $no;
@@ -1423,6 +1432,9 @@ If set to true, no "1..N" header will be printed.
1423 1432
 sub no_header {
1424 1433
     my $self = shift;
1425 1434
 
  1435
+    my $formatter = $self->formatter;
  1436
+    return unless $formatter->can("show_header");
  1437
+
1426 1438
     if( @_ ) {
1427 1439
         my $no = shift;
1428 1440
         $self->formatter->show_header(!$no);

0 notes on commit 4d5555f

Please sign in to comment.
Something went wrong with that request. Please try again.