Skip to content

Commit

Permalink
rt.cpan.org #14985 comment out errant LICENSE key from Makefile.PL
Browse files Browse the repository at this point in the history
  • Loading branch information
richardfoley committed May 31, 2006
1 parent 5f35347 commit 01c4d52
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 35 deletions.
6 changes: 6 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
0.63 Wed May 31 20:04:07 CEST 2006
Patch to remove redundant LICENCE key.
Submitted by "J Keen" <jkeen@verizon.net>
Implemented by "Richard Foley" <richard.foley@rfi.net>.
[rt.cpan.org 14985]

0.62 Sat Oct 8 01:25:03 PDT 2005
* Absorbed Test::Builder::Tester. The last release broke it because its
screen scraping Test::More and the failure output changed. By
Expand Down
2 changes: 1 addition & 1 deletion Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ THREAD_WARN
WriteMakefile(
NAME => $PACKAGE,
VERSION_FROM => "lib/$PACKAGE_FILE.pm", # finds $VERSION
LICENSE => 'perl',
# LICENSE => 'perl',
PREREQ_PM => {
Test::Harness => 2.03,
},
Expand Down
59 changes: 46 additions & 13 deletions lib/Test/Builder/Tester.pm
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,18 @@ Test::Builder
use Test::Builder::Tester tests => 1;
use Test::More;
test_out("not ok 1 - foo");
test_fail(+1);
test_fail(+1, "foo");
fail("foo");
test_test("fail works");
test_pass("baz");
ok(1, "baz");
test_test("pass works");
test_out("not ok 1 - bar");
ok(0, "bar");
test_test("output checking works");
=head1 DESCRIPTION
A module that helps you test testing modules that are built with
Expand Down Expand Up @@ -58,7 +65,7 @@ my $t = Test::Builder->new;
use Exporter;
@ISA = qw(Exporter);

@EXPORT = qw(test_out test_err test_fail test_diag test_test line_num);
@EXPORT = qw(test_out test_err test_fail test_diag test_test line_num test_pass);

# _export_to_level and import stolen directly from Test::More. I am
# the king of cargo cult programming ;-)
Expand Down Expand Up @@ -156,7 +163,7 @@ sub _start_testing

=head2 Methods
These are the six methods that are exported as default.
These are the seven methods that are exported as default.
=over 4
Expand All @@ -179,12 +186,12 @@ which is even the same as
test_out("ok 1");
test_out("ok 2");
Once C<test_out> or C<test_err> (or C<test_fail> or C<test_diag>) have
been called once all further output from B<Test::Builder> will be
captured by B<Test::Builder::Tester>. This means that your will not
be able perform further tests to the normal output in the normal way
until you call C<test_test> (well, unless you manually meddle with the
output filehandles)
Once C<test_out> or C<test_err> (or C<test_fail>, C<test_pass>, or
C<test_diag>) have been called once all further output from B<Test::Builder>
will be captured by B<Test::Builder::Tester>. This means that your will not be
able perform further tests to the normal output in the normal way until you
call C<test_test> (well, unless you manually meddle with the output
filehandles)
=cut

Expand Down Expand Up @@ -233,16 +240,43 @@ more simply as:
sub test_fail
{
# do we need to do any setup?
_start_testing() unless $testing;
_start_testing() unless $testing++;

# work out what line we should be on
my ($package, $filename, $line) = caller;
$line = $line + (shift() || 0); # prevent warnings

my $mess = "not ok $testing";
$mess .= ' - ' . shift if @_;
$out->expect( $mess );

# expect that on stderr
$err->expect("# Failed test ($0 at line $line)");
}

=item test_pass
Because the standard success message that B<Test::Builder> produces
whenever a test passes will be common in your test error
output, rather than forcing you to call C<test_out> with the string
all the time like so
test_out("ok 1 - some test name here");
C<test_pass> exists as a convenience method that you can call instead. It
takes one optional argument, the test description from the test you expect to
pass.
=cut

sub test_pass(;$)
{
_start_testing() unless $testing++;
my $mess = "ok $testing";
$mess .= ' - ' . shift if @_;
$out->expect( $mess, @_ );
}

=item test_diag
As most of the remaining expected output to the error stream will be
Expand Down Expand Up @@ -358,7 +392,6 @@ sub test_test
&& ($args{skip_err} || $err->check),
$mess))
{
# print out the diagnostic information about why this
# test failed

local $_;
Expand Down Expand Up @@ -543,7 +576,7 @@ sub complaint
my $self = shift;
my $type = $self->type;
my $got = $self->got;
my $wanted = join "\n", @{$self->wanted};
my $wanted = join '', @{$self->wanted};

# are we running in colour mode?
if (Test::Builder::Tester::color)
Expand Down
6 changes: 3 additions & 3 deletions lib/Test/Simple.pm
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ sub ok ($;$) {

=back
Test::Simple will start by printing number of tests run in the form
Test::Simple will start by printing the number of tests to run in the form
"1..M" (so "1..5" means you're going to run 5 tests). This strange
format lets Test::Harness know how many tests you plan on running in
case something goes horribly wrong.
Expand All @@ -103,7 +103,7 @@ So the exit codes are...
255 test died or all passed but wrong # of tests run
any other number how many failed (including missing or extras)
If you fail more than 254 tests, it will be reported as 254.
If you fail more than 254 tests, it will be reported as 254 (see CAVEATS).
This module is by no means trying to be a complete testing system.
It's just to get you started. Once you're off the ground its
Expand Down Expand Up @@ -213,7 +213,7 @@ Interprets the output of your test program.
=head1 AUTHORS
Idea by Tony Bowden and Paul Johnson, code by Michael G Schwern
E<lt>schwern@pobox.comE<gt>, wardrobe by Calvin Klein.
E<lt>schwern@pobox.comE<gt>, wardrobe allegedly by Calvin Klein.
=head1 COPYRIGHT
Expand Down
28 changes: 19 additions & 9 deletions t/tbt_01basic.t
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/perl

use Test::Builder::Tester tests => 9;
use Test::Builder::Tester tests => 12;
use Test::More;

ok(1,"This is a basic test");
Expand Down Expand Up @@ -29,27 +29,37 @@ is("foo","bar","should fail");
test_test("testing failing");


test_out("not ok 1");
test_out("not ok 2");
test_fail(+2);
test_fail(+1);
fail(); fail();
test_test("testing failing on the same line with no name");


test_out("not ok 1 - name");
test_out("not ok 2 - name");
test_fail(+2);
test_fail(+1);
fail("name"); fail("name");
test_fail(+2, 'name');
test_fail(+1, 'name_two');
fail("name"); fail("name_two");
test_test("testing failing on the same line with the same name");


test_out("not ok 1 - name # TODO Something");
test_err("# Failed (TODO) test ($0 at line 52)");
my $line = __LINE__ + 4;
test_err("# Failed (TODO) test ($0 at line $line)");
TODO: {
local $TODO = "Something";
fail("name");
}
test_test("testing failing with todo");

test_pass();
pass();
test_test("testing passing with test_pass()");

test_pass("some description");
pass("some description");
test_test("testing passing with test_pass() and description");

test_pass("one test");
test_pass("... and another");
ok(1, "one test");
ok(1, "... and another");
test_test("testing pass_test() and multiple tests");
13 changes: 4 additions & 9 deletions t/tbt_05faildiag.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,23 @@ use Test::More;

# test_fail

test_out("not ok 1 - one");
test_fail(+1);
test_fail(+1, 'one');
ok(0,"one");

test_out("not ok 2 - two");
test_fail(+2);
test_fail(+2, 'two');

ok(0,"two");

test_test("test fail");

test_fail(+2);
test_out("not ok 1 - one");
test_fail(+1, 'one');
ok(0,"one");
test_test("test_fail first");

# test_diag

use Test::Builder;
my $test = new Test::Builder;
my $test = Test::Builder->new();

test_diag("this is a test string","so is this");
$test->diag("this is a test string\n", "so is this\n");
Expand All @@ -40,5 +37,3 @@ test_diag("so is this");
$test->diag("this is a test string\n");
$test->diag("so is this\n");
test_test("test diag multiple");


0 comments on commit 01c4d52

Please sign in to comment.