Skip to content

Commit

Permalink
Simulate output of Test::More pre-2.0 when description for ok() is de…
Browse files Browse the repository at this point in the history
…fined but empty.

For #84
  • Loading branch information
jkeenan authored and schwern committed Nov 10, 2011
1 parent 9a79b75 commit ed6e250
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/Test/Builder2/Formatter/TAP/v13.pm
Expand Up @@ -363,7 +363,7 @@ sub accept_result {

my $name = $result->name;
$self->_escape(\$name);
$out .= " - $name" if defined $name and length $name;
$out .= " - $name" if defined $name;

my $reason = $result->reason;
$self->_escape(\$reason);
Expand Down
5 changes: 3 additions & 2 deletions t/Builder/Builder.t
Expand Up @@ -10,18 +10,19 @@ BEGIN {
use Test::Builder;
my $Test = Test::Builder->new;

$Test->plan( tests => 7 );
$Test->plan( tests => 8 );

my $default_lvl = $Test->level;
$Test->level(0);

$Test->ok( 1, 'compiled and new()' );
$Test->ok( $default_lvl == 1, 'level()' );
$Test->ok( 1, '' );

$Test->is_eq('foo', 'foo', 'is_eq');
$Test->is_num('23.0', '23', 'is_num');

$Test->is_num( $Test->current_test, 4, 'current_test() get' );
$Test->is_num( $Test->current_test, 5, 'current_test() get' );

my $test_num = $Test->current_test + 1;
$Test->current_test( $test_num );
Expand Down
6 changes: 4 additions & 2 deletions t/Builder/output.t
Expand Up @@ -75,22 +75,24 @@ END { 1 while unlink($tmpfile) }
my $out = $tb->output(\$fakeout);
$tb->exported_to(__PACKAGE__);
$tb->no_ending(1);
$tb->plan(tests => 5);
$tb->plan(tests => 6);

$tb->ok(1, "ok");
$tb->ok(1, "ok\n");
$tb->ok(1, "ok, like\nok");
$tb->skip("wibble\nmoof");
$tb->todo_skip("todo\nskip\n");
$tb->ok(1, "");

is( $fakeout, <<'OUTPUT' );
TAP version 13
1..5
1..6
ok 1 - ok
ok 2 - ok\n
ok 3 - ok, like\nok
ok 4 # SKIP wibble\nmoof
not ok 5 # TODO SKIP todo\nskip\n
ok 6 -
OUTPUT
}

Expand Down

0 comments on commit ed6e250

Please sign in to comment.