Make all t/lib/Mo.pm tests use done_testing

This commit is contained in:
Brian Fraser
2012-07-19 11:45:43 -03:00
parent 815b4ce961
commit ade6357157
9 changed files with 24 additions and 13 deletions

View File

@@ -11,8 +11,6 @@ use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
plan tests => 2;
package Foo::coerce;
use Mo;
@@ -24,3 +22,6 @@ my $f = Foo::coerce->new(stuff => 'fubar');
is $f->stuff, 'FUBAR', 'values passed to constructor are successfully coerced';
$f->stuff('barbaz');
is $f->stuff, 'BARBAZ', 'values passed to setters are successfully coerced';
done_testing;

View File

@@ -9,7 +9,7 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 4;
use Test::More;
use lib "$ENV{PERCONA_TOOLKIT_BRANCH}/t/lib/Mo";
use Bar;
@@ -22,3 +22,5 @@ is "@Bar::ISA", "Foo", 'Extends with multiple classes not supported';
ok 'Foo'->can('stuff'), 'Foo is loaded';
ok not('Bar'->can('buff')), 'Boo is not loaded';
done_testing;

View File

@@ -9,7 +9,7 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 82;
use Test::More;
# -------------------------------------------------------------------
@@ -478,3 +478,5 @@ is($car->stop, 'Engine::stop', '... got the right value from ->stop');
);
}
done_testing;

View File

@@ -11,8 +11,6 @@ use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
plan tests => 2;
package Foo::is;
use Mo qw(is);
@@ -24,3 +22,5 @@ my $f = Foo::is->new(stuff => 'foo');
is $f->stuff, 'foo', 'values passed to constructor are successfully accepted';
eval { $f->stuff('barbaz') };
ok $@, 'setting values after initialization throws an exception';
done_testing;

View File

@@ -9,7 +9,7 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 80;
use Test::More;
sub dies_ok (&;$) {
my $code = shift;
@@ -119,3 +119,5 @@ for my $i (4..7) {
for my $type (@types[1..$#types]) {
my $method = "my$type";
dies_ok { $foo->$method(undef) } "$type attr set to undef dies" }
done_testing;

View File

@@ -9,10 +9,12 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 2;
use Test::More;
use lib "$ENV{PERCONA_TOOLKIT_BRANCH}/t/lib/Mo";
{ package Clean; use Foo; }
is_deeply([ @Clean::ISA ], [], "Didn't mess with caller's ISA");
is(Clean->can('has'), undef, "Didn't export anything");
done_testing;

View File

@@ -11,8 +11,6 @@ use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
plan tests => 3;
#============
package Foo::required;
use Mo qw(required);
@@ -37,3 +35,5 @@ is $f->stuff, 'fubar', 'Object is correctly initialized when required values are
my $f2 = Foo::required_is->new(stuff => 'fubar');
is $f2->stuff, 'fubar', 'Object is correctly initialized when required is combined with is';
done_testing;

View File

@@ -9,9 +9,11 @@ BEGIN {
use strict;
use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More tests => 1;
use Test::More;
eval 'package Foo; use Mo; $x = 1';
like $@, qr/Global symbol "\$x" requires explicit package name/,
'Mo is strict';
done_testing;

View File

@@ -11,8 +11,6 @@ use warnings FATAL => 'all';
use English qw(-no_match_vars);
use Test::More;
plan tests => 39;
#============
package Foo;
use Mo;
@@ -138,3 +136,5 @@ my $maz = Maz->new;
is $_, 5, '$_ is untouched';
is $maz->foo, 5, 'BUILD works again';
is $maz->bar, 7, 'BUILD works in parent class';
done_testing;