use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
-package Foo;
-
-# Moose will issue a warning if we try to load it from the main
-# package.
-::use_ok('Moose');
+{
+ package Foo;
+ # Moose will issue a warning if we try to load it from the main
+ # package.
+ ::use_ok('Moose');
+}
+done_testing;
use strict;
use warnings;
-use Test::More tests => 10;
+use Test::More;
{
# AUTHOR: Aran Clary Deltac <bluefeet@cpan.org>
+done_testing;
use strict;
use warnings;
-use Test::More tests => 29;
+use Test::More;
use Test::Exception;
-
{
package Foo;
use Moose;
local $TODO = $import eq 'blessed' ? "no automatic namespace cleaning yet" : undef;
ok(!Foo->can($import), "no namespace pollution in Moose::Object ($import)" );
}
+
+done_testing;
use lib 't/lib', 'lib';
-use Test::More tests => 4;
+use Test::More;
use Test::Exception;
-
{
package Bar;
'correct error when superclass could not be found';
}
+done_testing;
use strict;
use warnings;
-use Test::More tests => 16;
+use Test::More;
use Test::Exception;
-
{
package Foo;
use Moose;
}
+done_testing;
use strict;
use warnings;
-use Test::More tests => 16;
+use Test::More;
use Test::Exception;
-
{
package Foo;
use Moose;
}
+done_testing;
use strict;
use warnings;
-use Test::More tests => 5;
-
+use Test::More;
{
is($baz->bar,
'Bar::bar -> Foo::bar(Baz::bar)',
'... got the right value from mixed augment/override bar');
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 15;
-
+use Test::More;
=pod
is($foo->foo(), 'Foo::foo', '... got the right value from &foo');
is($foo->bar(), 'Foo::bar', '... got the right value from &bar');
-is($foo->baz(), 'Foo::baz', '... got the right value from &baz');
\ No newline at end of file
+is($foo->baz(), 'Foo::baz', '... got the right value from &baz');
+
+done_testing;
#!/usr/bin/perl
-use Test::More tests => 15;
+use Test::More;
# for classes ...
{
::like($warn, qr/Argument \"hello\" isn\'t numeric in addition \(\+\)/, '.. and it is the right warning');
}
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 7;
-
+use Test::More;
{
}
}
+done_testing;
use strict;
use warnings;
-use Test::More tests => 41;
+use Test::More;
my @moose_exports = qw(
}
can_ok( 'Baz', 'blessed' );
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 9;
+use Test::More;
use Test::Exception;
-
{
package Dog;
}
+done_testing;
use strict;
use warnings;
-use Test::More tests => 7;
+use Test::More;
use Test::Exception;
use Moose::Util::TypeConstraints;
$bar->foo(Foo->new);
} '... checked the type constraint correctly';
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 11;
+use Test::More;
use Test::Exception;
use Scalar::Util 'blessed';
throws_ok { $foo->type_constrained(10.5) }
qr/^Attribute \(type_constrained\) does not pass the type constraint because\: Validation failed for 'Int' failed with value 10\.5/,
'... this failed cause of type check';
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 7;
+use Test::More;
use Test::Exception;
{
# XXX: Continuing::To::Fail gets created anyway
+done_testing;
use strict;
use warnings;
-use Test::More tests => 8;
+use Test::More;
use Moose::Meta::Class;
ok $class_and_bar->name->bar_role_applied;
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More;
{
package Foo;
}
}
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More;
use Test::Exception;
lives_ok {
isa_ok( main->new, "main");
isa_ok( main->new, "Moose::Object" );
+done_testing;
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More;
use Test::Exception;
# This tests the error handling in Moose::Object only
throws_ok { Foo->does() } qr/^\QYou must supply a role name to does()/,
'Cannot call does() without a role name';
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More;
my $test1 = Moose::Meta::Class->create_anon_class;
is( $t2_am->name(), 'Test2',
'associated_metaclass->name is Test2' );
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More;
our @demolished;
package Foo;
is_deeply(\@demolished, ['Foo::Sub::Sub', 'Foo::Sub', 'Foo'],
"Foo::Sub::Sub demolished properly");
@demolished = ();
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More;
{
package Foo;
'in_global_destruction state is passed to DEMOLISH properly (true)'
) for split //, `$^X t/010_basics/020-global-destruction-helper.pl`;
+done_testing;
use strict;
use warnings;
-use Test::More tests => 20;
+use Test::More;
use Test::Exception;
-
{
package Foo;
use Moose;
is($foo->get_lazy_foo(), 100, '... got the correct value');
}
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 29;
+use Test::More;
use Test::Exception;
use Scalar::Util 'isweak';
-
{
package Foo;
use Moose;
ok(isweak($foo->{foo_weak}), '... it is a weak reference');
}
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 57;
+use Test::More;
use Test::Exception;
use Scalar::Util 'isweak';
-
{
package Foo;
use Moose;
is_deeply( \%hash, { foo => 1, bar => 2 }, "list context");
}
-
-
+done_testing;
use Scalar::Util 'isweak';
-use Test::More tests => 43;
+use Test::More;
use Test::Exception;
-
{
package Foo;
use Moose;
Foo->meta->make_immutable, redo if Foo->meta->is_mutable;
}
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 9;
+use Test::More;
use Test::Exception;
-
{
package Foo::Role;
use Moose::Role;
} '... cannot have a isa() which is cannot does()';
}
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 15;
+use Test::More;
use Test::Exception;
-
{
package Foo;
use Moose;
Foo->new;
} qr/^Attribute \(bar\) is required/, '... must supply all the required attribute';
+done_testing;
use strict;
use warnings;
-use Test::More tests => 16;
+use Test::More;
use Test::Exception;
-
{
package Foo::Meta::Attribute;
use Moose;
isa_ok($bar_attr, 'Moose::Meta::Attribute');
}
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 18;
+use Test::More;
use Test::Exception;
-
{
package Foo;
use Moose;
Bar->new(baz => {})
} '... didnt create a new Bar with baz as a HASH ref';
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 84;
+use Test::More;
use Test::Exception;
-
{
package Thing;
use Moose;
ok(Bar->meta->get_attribute('bling')->has_handles,
'... Bar::foo should handles');
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 92;
+use Test::More;
use Test::Exception;
-
# -------------------------------------------------------------------
# HASH handles
# -------------------------------------------------------------------
my $k = Bar->new(foo => "Foo");
lives_ok { $k->foo_baz } "but not for class name";
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 48;
+use Test::More;
use Test::Exception;
=pod
can_ok( $p, "child_i_method_1" );
is( $p->parent_method_1, "parent_1", "delegate doesn't override existing method" );
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 47;
+use Test::More;
use Test::Exception;
-
{
{
package Test::Attribute::Inline::Documentation;
}
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 11;
+use Test::More;
use Test::Exception;
-
{
package Customer;
use Moose;
is_deeply [ $autoderef->bar ], [ 1, 2, 3 ], '... auto-dereffed correctly';
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More;
use Test::Exception;
$r->headers;
} '... this coerces and passes the type constraint even with lazy';
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 12;
+use Test::More;
use Test::Exception;
use Test::Moose;
-
{
package My::Attribute::Trait;
use Moose::Role;
ok(!$gorch_attr->has_applied_traits, '... no traits applied');
is($gorch_attr->applied_traits, undef, '... no traits applied');
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 23;
+use Test::More;
use Test::Exception;
use Test::Moose;
-
{
package My::Attribute::Trait;
use Moose::Role;
can_ok($quux, 'additional_method');
is(eval { $quux->additional_method }, 42, '... got the right value for additional_method');
+done_testing;
use strict;
use warnings;
-use Test::More tests => 7;
+use Test::More;
use Test::Exception;
use Test::Moose;
does_ok($c->meta->get_attribute('bar'), 'My::Attribute::Trait');
is($c->meta->get_attribute('bar')->_is_metadata, 'ro', '... got the right metaclass customization');
-
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More;
use Test::Exception;
is( $foo->foo, "blah", "field is set via setter" );
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 23;
+use Test::More;
use Test::Exception;
-
{
package Foo;
use Moose;
Fail::Bar->new(foo => 10)
} '... this fails, because initializer returns a bad type';
+done_testing;
use strict;
use warnings;
-use Test::More tests => 11;
+use Test::More;
use Test::Exception;
-
{
package Fake::DateTime;
isa_ok( $mtg->closing_date, 'Fake::DateTime' );
}
+done_testing;
use strict;
use warnings;
-use Test::More tests => 17;
+use Test::More;
use Test::Exception;
-
=pod
is => rw, writer => _foo # turns into (reader => foo, writer => _foo)
dies_ok { make_class('ro', 'accessor', "Test::Class::AccessorRO"); } "Cant define attr with ro + accessor";
+done_testing;
use strict;
use warnings;
-use Test::More tests => 2;
-
+use Test::More;
{
is($legal_option, 'my_legal_option',
'... added my_legal_option as legal option for inheritance' );
is($bar_attr->my_legal_option->(), 'Bar::B', '... overloaded my_legal_option');
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 8;
+use Test::More;
use Test::Exception;
my $exception_regex = qr/You must provide a name for the attribute/;
} 'has 0; works now';
}
+done_testing;
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 5;
+use Test::More;
{
package My::Attribute::Trait;
ok(!$other_attr->can('enam'), "the method was not installed under the other class' alias");
ok(!$other_attr->can('reversed_name'), "the method was not installed under the original name when that was excluded");
+done_testing;
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More;
use Test::Exception;
{
isa_ok($foo->bar->baz, 'Baz');
is($foo->bar->baz->hello, 'World', '... this all worked fine');
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More;
use Moose ();
use Moose::Meta::Class;
$warn = '';
$meta->add_attribute('bar', is => 'bare');
is $warn, '', 'add attribute with no methods and is => "bare"';
+
+done_testing;
BEGIN {
eval "use Test::Output;";
plan skip_all => "Test::Output is required for this test" if $@;
- plan tests => 5;
}
{
qr/^You are overwriting a locally defined method \(clear_d\) with an accessor/, 'clearer overriding gives proper warning');
stderr_like(sub { $foo_meta->add_attribute(e => (is => 'rw')) },
qr/^You are overwriting a locally defined method \(e\) with an accessor/, 'accessor overriding gives proper warning');
+
+done_testing;
use Moose;
use Moose::Util::MetaRole;
- use Test::More tests => 3;
+ use Test::More;
use Test::Exception;
Moose::Util::MetaRole::apply_metaclass_roles(
lives_ok { __PACKAGE__->meta->make_immutable; }
"Inling constructor does not use inline_slot_access";
+
+ done_testing;
}
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More;
use Test::Exception;
lives_ok {
is_deeply [$o->h_ro], [], 'uninitialized HashRef attribute/ro in list context';
} 'testing';
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 12;
+use Test::More;
{
package Foo;
Foo->meta->make_immutable, redo if Foo->meta->is_mutable;
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 5;
+use Test::More;
use Test::Exception;
{
ok($foo->test, '... the test value has now been changed');
-
-
-
-
-
-
-
+done_testing;
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More;
{
package Foo;
undef $x;
$hasfoo->foo_aliased_curried($x);
is($x, 'bar', "delegated aliasing with currying works");
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 27;
+use Test::More;
use Test::Exception;
use Moose::Meta::Role;
[ $foo_role->get_method_modifier_list('before') ],
[ 'boo' ],
'... got the right list of before method modifiers');
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 41;
+use Test::More;
use Test::Exception;
=pod
[ 'bling', 'fling' ],
'... got the right list of override method modifiers');
+done_testing;
use strict;
use warnings;
-use Test::More tests => 86;
+use Test::More;
use Test::Exception;
{
is( $foo->bar, $foo2, '... got the right value for bar now' );
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More;
use Test::Exception;
-
{
package Foo::Role;
qr/'Quux::Role' requires the methods 'meth3' and 'meth4' to be implemented by 'Quux::Class4'/,
'exception mentions all the require methods that are accessors at once, as well as missing methods, but not the one that exists';
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 88;
+use Test::More;
use Test::Exception;
=pod
is($test26->ghost, 'My::Test26::ghost', '... we access the attribute from the class and ignore the role attribute and method');
=cut
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 22;
+use Test::More;
use Test::Exception;
=pod
ok(My::Test4->meta->excludes_role('Molecule::Inorganic'), '... My::Test4 meta excludes Molecule::Organic');
ok(!My::Test4->does('Molecule::Inorganic'), '... My::Test4 does Molecule::Inorganic');
+done_testing;
use strict;
use warnings;
-use Test::More tests => 15;
+use Test::More;
use Test::Exception;
=pod
with 'Bar2::Role';
} 'required method exists in superclass as non-modifier, so we live';
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 32;
+use Test::More;
use Test::Exception;
=pod
ok(My::Test::Class4->meta->has_attribute('foo'), '... have the attribute foo as expected');
is(My::Test::Class4->new->foo, 'Role::Base::foo', '... got the right value from method');
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 74;
+use Test::More;
use Test::Exception;
-
{
# NOTE:
# this tests that repeated role
is( eval { $class->method }, "concrete b", "provided by concrete b" );
}
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 27;
+use Test::More;
use Scalar::Util qw(blessed);
-
=pod
This test can be used as a basis for the runtime role composition.
is(blessed($obj), blessed($obj2), '... they share the same anon-class/role thing again');
}
-
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 39;
+use Test::More;
use Test::Exception;
-
{
# test no conflicts here
package Role::A;
}
+done_testing;
use strict;
use warnings;
-use Test::More tests => 19;
+use Test::More;
use Test::Exception;
-
{
package My::Role;
use Moose::Role;
ok(!My::Foo::Role::Other->meta->has_method('foo'), "we dont have a foo method");
ok(My::Foo::Role::Other->meta->requires_method('foo'), '... and the &foo method is required');
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 46;
+use Test::More;
use Test::Exception;
-
{
package My::Role;
use Moose::Role;
for qw( x1 foo_x1 );
ok( ! $baz->has_method('y1'), 'Role::Baz has no y1 method' );
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 9;
+use Test::More;
use Test::Exception;
-
{
package Foo;
use Moose::Role;
is($c->baz_foo, 'Baz::foo', '... got the right method');
is($c->baz_bar, 'Baz::bar', '... got the right method');
-
-
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 11;
+use Test::More;
use Test::Exception;
use Scalar::Util 'blessed';
-
-
{
package Dog;
use Moose::Role;
} '... and setting the accessor is okay';
is($obj->fur, "dirty", "role attr initialized");
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 7;
+use Test::More;
use Test::Exception;
use Scalar::Util 'blessed';
-
-
{
package Dog;
use Moose::Role;
$foo->dog($bar)
} '... and setting the accessor is okay';
+done_testing;
use strict;
use warnings;
-use Test::More tests => 27;
+use Test::More;
use Test::Exception;
-
=pod
This basically just makes sure that using +name
} "or add new types to the union";
}
+done_testing;
use strict;
use warnings;
-use Test::More tests => 21;
+use Test::More;
use Test::Exception;
-
{
package Foo;
use Moose;
is($foo->baz, 'FOO-BAZ', '... got the expect value');
}
-
+done_testing;
BEGIN {
eval "use Test::Output;";
plan skip_all => "Test::Output is required for this test" if $@;
- plan tests => 8;
}
# this test script ensures that my idiom of:
}
}
+done_testing;
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More;
use Test::Exception;
use Moose::Meta::Role::Application::RoleSummation;
);
}
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 12;
+use Test::More;
use Test::Exception;
use Moose::Meta::Role::Application::RoleSummation;
);
} '... this fails as expected';
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 16;
+use Test::More;
use Test::Exception;
use Moose::Meta::Role::Application::RoleSummation;
);
}
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 7;
+use Test::More;
use Test::Exception;
use Moose::Meta::Role::Application::RoleSummation;
);
} '... this fails as expected';
+done_testing;
use strict;
use warnings;
-use Test::More tests => 19;
+use Test::More;
use Test::Exception;
use Moose::Meta::Role::Application::RoleSummation;
);
}
+done_testing;
use strict;
use warnings;
-use Test::More tests => 8;
+use Test::More;
use Test::Exception;
use Moose::Meta::Role::Application::RoleSummation;
)
);
} '... this fails as expected';
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 7;
+use Test::More;
use Test::Exception;
use Moose::Meta::Role::Application::RoleSummation;
'... got the right list of methods'
);
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
use Test::Exception;
use Moose::Meta::Class;
use Moose::Util;
'Create a new class with several roles'
);
+done_testing;
use strict;
use warnings;
-use Test::More tests => 17;
+use Test::More;
{
is( ClassB->foo, 'ClassB::foo', 'ClassB::foo knows its name' );
is( ClassA->foo, 'ClassA::foo', 'ClassA::foo knows its name' );
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 17;
+use Test::More;
use Test::Moose;
{
is($x->gorch, 'BAR', '... got the right value');
}
-
+done_testing;
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More;
use Moose ();
my $role = Moose::Meta::Role->create(
ok(!$role->is_anon_role, "the role is not anonymous");
+done_testing;
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 7;
+use Test::More;
use Moose ();
my $role = Moose::Meta::Role->create_anon_role(
ok(Class::MOP::is_class_loaded(Moose::Meta::Role->create_anon_role->name), "creating an anonymous role satisifes is_class_loaded");
ok(Class::MOP::class_of(Moose::Meta::Role->create_anon_role->name), "creating an anonymous role satisifes class_of");
+done_testing;
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More;
use Moose ();
use Scalar::Util 'weaken';
ok(!$weak, "the role metaclass is freed after its last reference (from a consuming anonymous class) is freed");
ok(!$name->can('improperly_freed'), "we blew away the role's symbol table entries");
+
+done_testing;
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More;
use Moose ();
do {
my $nine_role = My::Meta::Role->create_anon_role(test_serial => 9);
is($nine_role->test_serial, 9, "parameter value for the serial attribute");
+done_testing;
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
do {
package My::Meta::Role;
is(My::Role->meta->meta->name, 'My::Meta::Role');
+done_testing;
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 24;
+use Test::More;
do {
package Role::Foo;
is_deeply($aliases->get_method_exclusions, []);
is_deeply($overrides->get_method_exclusions, []);
+done_testing;
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More;
my $OPTS;
do {
is(My::Class->bar, 'My::Usual::Role', 'collateral role');
is_deeply($OPTS, { number => 1 });
+done_testing;
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More;
# test role and class
package SomeRole;
is($@, '', "$get_func for no method mods does not die");
is(scalar(@mms),0,'is an empty list');
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
{
package Foo;
local $TODO = "the special () method isn't properly composed into the class";
is("$bar", 42, 'overloading can be composed');
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More;
use Test::Exception;
{
sub bark { }
}
-package PracticalJoke;
-use Moose;
-
-::throws_ok {
- with 'Bomb', 'Spouse';
-} qr/Due to method name conflicts in roles 'Bomb' and 'Spouse', the methods 'explode' and 'fuse' must be implemented or excluded by 'PracticalJoke'/;
-
-::throws_ok {
- with (
- 'Bomb', 'Spouse',
- 'Caninish', 'Treeve',
- );
-} qr/Due to a method name conflict in roles 'Caninish' and 'Treeve', the method 'bark' must be implemented or excluded by 'PracticalJoke'/;
+{
+ package PracticalJoke;
+ use Moose;
+
+ ::throws_ok {
+ with 'Bomb', 'Spouse';
+ } qr/Due to method name conflicts in roles 'Bomb' and 'Spouse', the methods 'explode' and 'fuse' must be implemented or excluded by 'PracticalJoke'/;
+
+ ::throws_ok {
+ with (
+ 'Bomb', 'Spouse',
+ 'Caninish', 'Treeve',
+ );
+ } qr/Due to a method name conflict in roles 'Caninish' and 'Treeve', the method 'bark' must be implemented or excluded by 'PracticalJoke'/;
+}
+done_testing;
use strict;
use warnings;
-use Test::More tests => 85;
+use Test::More;
use Test::Exception;
use Scalar::Util ();
ok( ! $subtype->check('Foo'), '... this is not a Natural');
}
+done_testing;
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More;
use Test::Exception;
{
::ok( MyRef( {} ), '... Ref worked correctly' );
::ok( MyArrayRef( [] ), '... ArrayRef worked correctly' );
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 298;
+use Test::More;
use Test::Exception;
use Scalar::Util ();
ok(defined RoleName('Quux::Wibble::Role'), '... RoleName accepts anything which is a RoleName');
close($fh) || die "Could not close the filehandle $0 for test";
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 18;
+use Test::More;
use Test::Exception;
BEGIN {
# TODO:
# add tests for is_subtype_of which confirm the hierarchy
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 26;
+use Test::More;
use Test::Exception;
BEGIN {
my $tc = find_type_constraint('StrWithTrailingX');
is($tc->coerce("foo"), "fooX", "coerce when needed");
is($tc->coerce("fooX"), "fooX", "do not coerce when unneeded");
+
+done_testing;
use lib 't/lib', 'lib';
-use Test::More tests => 4;
+use Test::More;
use Test::Exception;
-
$SIG{__WARN__} = sub { 0 };
eval { require Foo; };
delete $INC{'Bar.pm'};
eval { require Bar; };
-ok(!$@, '... re-loaded Bar successfully') || diag $@;
\ No newline at end of file
+ok(!$@, '... re-loaded Bar successfully') || diag $@;
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 25;
+use Test::More;
use Test::Exception;
-
{
package HTTPHeader;
use Moose;
Engine->new(header => \(my $var));
} '... dies correctly with bad params';
+done_testing;
use strict;
use warnings;
-use Test::More tests => 35;
+use Test::More;
use Test::Exception;
BEGIN {
'Validation failed for \'ArrayRef\' failed with value 50 and Validation failed for \'HashRef\' failed with value 50 in (ArrayRef|HashRef)',
'... (ArrayRef | HashRef) cannot accept Numbers');
+done_testing;
BEGIN {
eval "use IO::String; use IO::File;";
plan skip_all => "IO::String and IO::File are required for this test" if $@;
- plan tests => 28;
}
-
{
package Email::Moose;
use Moose;
is($email->raw_body, $fh, '... and it is the one we expected');
}
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 11;
+use Test::More;
use Test::Exception;
BEGIN {
"correct error thrown"
);
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 24;
+use Test::More;
use Test::Exception;
BEGIN {
my $param_type = $anon_type->type_parameter;
isa_ok( $param_type, 'Moose::Meta::TypeConstraint::Class' );
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 10;
+use Test::More;
use Test::Exception;
BEGIN {
is_deeply([ sort @{$foo->bar} ], [ 1, 2, 3 ], '... our coercion worked!');
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 33;
+use Test::More;
use Test::Exception;
BEGIN {
[[[ 1, 2, 3 ]], [[ qw/foo bar/ ]]]
), '... [[[ 1, 2, 3 ]], [[ qw/foo bar/ ]]] failed successfully');
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 41;
+use Test::More;
BEGIN {
use_ok("Moose::Util::TypeConstraints");
'... this correctly split the union (' . $_ . ')'
) for keys %split_tests;
}
+
+done_testing;
push @invalid_metacharacters, qw/.* fish(sticks)? atreides/;
push @invalid_metacharacters, '^1?$|^(11+?)\1+$';
-plan tests => @valid_letters + @invalid_letters
- + @valid_languages + @invalid_languages
- + @valid_metacharacters + @invalid_metacharacters
- + @valid_languages + 10;
-
Moose::Util::TypeConstraints->export_type_constraints_as_functions();
ok(Letter($_), "'$_' is a letter") for @valid_letters;
ok( !$anon_enum->is_subtype_of('ThisTypeDoesNotExist'), 'enum not a subtype of nonexistant type');
ok( !$anon_enum->is_a_type_of('ThisTypeDoesNotExist'), 'enum not type of nonexistant type');
+done_testing;
use strict;
use warnings;
-use Test::More tests => 39;
+use Test::More;
use Test::Exception;
BEGIN {
as 'SubOfMyArrayRef[Str]';
}, qr/Str is not a subtype of BiggerInt/, 'Failed to parameterize with a bad type parameter';
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 21;
+use Test::More;
use Test::Exception;
BEGIN {
ok(!$t->check(1), '... validated it correctly');
}
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 28;
+use Test::More;
use Test::Exception;
BEGIN {
);
} 'non-containers cannot be parameterized';
+done_testing;
use strict;
use warnings;
-use Test::More tests => 11;
+use Test::More;
use Test::Exception;
BEGIN {
ok(!$evenlist->check(MyList->new(10, "two")), '... validated it correctly (fail)');
ok(!$evenlist->check([10, 20]), '... validated it correctly (fail)');
+done_testing;
use strict;
use warnings;
-use Test::More tests => 20;
+use Test::More;
use Test::Exception;
BEGIN {
ok( !$type->equals(Moose::Meta::TypeConstraint::Class->new( name => "__ANON__", class => "Bar" )), "doesn't equal other anon constraint" );
ok( $type->is_subtype_of(Moose::Meta::TypeConstraint::Class->new( name => "__ANON__", class => "Bar" )), "subtype of other anon constraint" );
+done_testing;
use strict;
use warnings;
-use Test::More tests => 36;
+use Test::More;
use Test::Exception;
use Moose::Util::TypeConstraints;
throws_ok sub { $obj->Maybe_Int("a") },
qr/Attribute \(Maybe_Int\) does not pass the type constraint/
=> 'failed assigned ("a")';
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 9;
+use Test::More;
use Test::Exception;
{
qr/This number \(0\) is not less than ten!/,
'gave custom supertype error message on lazy set to 0';
+done_testing;
use strict;
use warnings;
-use Test::More tests => 54;
+use Test::More;
use Test::Exception;
-
{
package Foo;
use Moose;
dies_ok { $foo->v_lazy_Str() } '... undef is NOT a Foo->Str';
dies_ok { $foo->v_lazy_String() } '... undef is NOT a Foo->String';
-
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 18;
+use Test::More;
use Test::Exception;
BEGIN {
ok( !$type->equals(Moose::Meta::TypeConstraint::Role->new( name => "__ANON__", role => "Bar" )), "doesn't equal other anon constraint" );
ok( $type->is_subtype_of(Moose::Meta::TypeConstraint::Role->new( name => "__ANON__", role => "Bar" )), "subtype of other anon constraint" );
+done_testing;
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More;
{
package SomeClass;
is($attr->get_value(SomeClass->new()), 'Six');
is(SomeClass->new()->foo, 'Six');
+done_testing;
use strict;
use warnings;
-use Test::More tests => 37;
+use Test::More;
use Test::Exception;
BEGIN {
is $union1->name, $union3->name, 'names match';
is $union2->name, $union3->name, 'names match';
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 12;
+use Test::More;
use Test::Exception;
BEGIN {
},
qr/Attribute \(from_parameterizable\) does not pass the type constraint/
=> 'from_parameterizable throws expected error';
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More;
use Test::Exception;
BEGIN {
subtype 'MySubType' => as 'Int' => where { 1 };
} qr/cannot be created again/, 'Trying to create same type twice throws';
+done_testing;
use strict;
use warnings;
-use Test::More tests => 26;
+use Test::More;
use Test::Exception;
use Moose::Util::TypeConstraints;
lives_ok {
Quux::Ier->new(age => (bless {}, 'Negative'))
};
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More;
use Moose::Util::TypeConstraints;
is( $type->parent->name, 'Foo', 'parent type is Foo' );
isa_ok( $type->parent, 'Moose::Meta::TypeConstraint::Class',
'parent type constraint is a class type' );
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
use Moose::Util::TypeConstraints;
like( $@, qr/\QYou must pass in at least 2 type names to make a union/,
'can throw a proper error without Moose being loaded by the caller' );
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More;
use Test::Exception;
use Moose::Meta::TypeConstraint;
is( Moose::Util::TypeConstraints::find_or_parse_type_constraint('ArrayRef[Va.lid]'),
'ArrayRef[Va.lid]',
'find_or_parse_type_constraint returns name for valid name' );
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 5;
+use Test::More;
use Test::Exception;
{
# try with the other constraint form
lives_ok { DucktypeTest->new( other_swan => Swan->new ) } 'but a Swan can honk';
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More;
use Test::Exception;
my @phonograph;
$t->walk;
is_deeply([splice @phonograph], ['footsteps']);
+done_testing;
use strict;
use warnings;
-use Test::More tests => 25;
+use Test::More;
use Test::Exception;
use Moose::Util::TypeConstraints;
not_enough_matches( [] )
} qr/No cases matched for /, '... not enough matches';
-
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More;
use Test::Exception;
-
{
package My::Custom::Meta::Attr;
use Moose;
isa_ok($c->meta->get_attribute('bling_bling'), 'My::Custom::Meta::Attr');
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More;
use Test::Exception;
-;
-
lives_ok {
package MooseX::Attribute::Test;
use Moose::Role;
extends 'Moose::Meta::Attribute';
with 'MooseX::Attribute::Test';
} 'custom attribute metaclass extending role is okay';
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More;
use Test::Exception;
-
=pod
This test demonstrates that Moose will respect
qr/^Bar already has a metaclass, but it does not inherit Moose::Meta::Class/,
'... got the right error too');
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 16;
+use Test::More;
use Test::Exception;
-
=pod
This test demonstrates the ability to extend
ok($attr->has_accessor, '... the attribute does have an accessor (as expected)');
}
+done_testing;
use strict;
use warnings;
-use Test::More tests => 7;
+use Test::More;
use Test::Exception;
-
BEGIN {
package MyFramework::Base;
use Moose;
is($obj->foo, 10, '... got the right value');
-
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More;
use Moose ();
isa_ok( Foo->meta, 'Moose::Meta::Class' );
is($meta, Foo->meta, '... our metas are the same');
+
+done_testing;
BEGIN {
eval "use Test::Output;";
plan skip_all => "Test::Output is required for this test" if $@;
- plan tests => 65;
}
ok( ! UseAllOptions->can($_), "UseAllOptions::$_ has been unimported" )
for qw( with_meta1 with_meta2 with_caller1 with_caller2 as_is1 );
}
+
+done_testing;
use lib 't/lib', 'lib';
-use Test::More tests => 32;
+use Test::More;
use Test::Exception;
{
is( $instance->an_attr, 'value', 'Can get value' );
}
'Can create instance and access attributes';
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 8;
+use Test::More;
use Test::Exception;
# Some packages out in the wild cooperate with Moose by using goto
ok( Bar->can('meta'),
'Bar has a meta method' );
isa_ok( Bar->meta(), 'Moose::Meta::Class' );
+
+done_testing;
use lib 't/lib', 'lib';
-use Test::More tests => 91;
+use Test::More;
use Test::Exception;
use Moose::Util::MetaRole;
);
}
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 8;
+use Test::More;
use Moose::Util::MetaRole;
ok( $supers{$parent}, $desc );
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More;
use Test::Exception;
{
$child->attr("ition");
is($child->attr, "ition", "setter inherited properly");
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 24;
+use Test::More;
use Test::Exception;
{
q{Foo::Sub::Sub's error_class does Role::Foo} );
ok( Foo::Sub::Sub->meta->error_class->isa('Moose::Error::Croak'),
q{Foo::Sub::Sub's error_class now subclasses Moose::Error::Croak} );
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 15;
+use Test::More;
use Test::Exception;
{
die $@ if $@;
} 'failed to use trait without required attr';
+done_testing;
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 5;
+use Test::More;
{
package My::Trait;
ok(!$other_meta->can('enam'), "the method was not installed under the other class' alias");
ok(!$other_meta->can('reversed_name'), "the method was not installed under the original name when that was excluded");
+done_testing;
package MyExporter::User;
use MyExporter;
-use Test::More (tests => 4);
+use Test::More;
use Test::Exception;
lives_and {
is($caller, 'MyExporter', "As-is prototype code gets called from MyMooseX");
};
} "check function with prototype";
+
+done_testing;
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More;
do {
package My::Meta::Class;
is(My::Class->meta->meta->name, 'My::Meta::Class');
is(My::Class::Aliased->meta->meta->name, 'My::Meta::Class');
+done_testing;
use strict;
use warnings;
-use Test::More tests => 13;
+use Test::More;
use Test::Moose qw(does_ok);
{
::isa_ok(Foo2::Role->meta, 'Moose::Meta::Role');
::does_ok(Foo2::Role->meta, 'Foo::Trait::Class');
}
+
+done_testing;
use base qw/SubClassUseBase/;
}
-use Test::More tests => 2;
+use Test::More;
use Moose::Util qw/find_meta does_role/;
my $subsubclass_meta = Moose->init_meta( for_class => 'SubSubClassUseBase' );
my $subclass_meta = find_meta('SubClassUseBase');
ok does_role($subclass_meta, 'My::Role'),
'SubClass metaclass does role from parent metaclass';
+
+done_testing;
use Moose;
}
-use Test::More tests => 1;
+use Test::More;
use Test::Exception;
lives_ok {
Moose->init_meta(for_class => 'SomeClass');
} 'Moose class => use base => Moose Class, then Moose->init_meta on middle class ok';
+
+done_testing;
BEGIN {
eval "use Module::Refresh;";
plan skip_all => "Module::Refresh is required for this test" if $@;
- plan tests => 23;
}
=pod
unlink $test_module_file;
-
-
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More;
use Test::Exception;
-
=pod
This test demonstrates that Moose will respect
isa_ok($baz, 'Foo');
isa_ok($baz, 'Moose::Object');
+done_testing;
use strict;
use warnings;
-use Test::More tests => 6;
+use Test::More;
use Test::Exception;
-
{
package Elk;
}
'Can subclass the same non-Moose class twice with different metaclasses';
+done_testing;
use strict;
use warnings;
-use Test::More tests => 18;
+use Test::More;
use Class::MOP ();
{
Class::MOP::remove_metaclass_by_name($_)
for qw( SubClassUseBase OtherSubClassUseBase );
+done_testing;
use strict;
use warnings;
-use Test::More tests => 7;
-
+use Test::More;
use Moose ();
+
BEGIN {
use_ok('Moose::Meta::Attribute::Native');
use_ok('Moose::Meta::Attribute::Native::Trait::Bool');
use_ok('Moose::Meta::Attribute::Native::Trait::Number');
use_ok('Moose::Meta::Attribute::Native::Trait::String');
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More;
use Test::Exception;
{
::lives_ok{ with 'Bulkie::Role';
} '... this should work correctly';
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 11;
+use Test::More;
use Test::Exception;
{
inc_counter
reset_counter
];
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 28;
+use Test::More;
{
package Subject;
$count->inc_counter;
is( $count->count, 0, 'Back to zero' );
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 16;
+use Test::More;
use Test::Moose 'does_ok';
{
'... got the right handles methods'
);
+done_testing;
use strict;
use warnings;
-use Test::More tests => 68;
+use Test::More;
use Test::Exception;
use Test::Moose 'does_ok';
is( $options->type_constraint->type_parameter, 'Str',
'... got the right container type' );
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 46;
+use Test::More;
use Test::Exception;
use Test::Moose 'does_ok';
},
'... got the right hash elements'
);
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 25;
+use Test::More;
use Test::Moose;
{
'... got the right handles mapping'
);
+done_testing;
use strict;
use warnings;
-use Test::More tests => 43;
+use Test::More;
use Test::Exception;
use Test::Moose 'does_ok';
}
'... sort rejects arg of invalid type';
+done_testing;
use strict;
use warnings;
-use Test::More tests => 22;
+use Test::More;
use Test::Moose 'does_ok';
my $uc;
'... got the right handles methods'
);
+done_testing;
use strict;
use warnings;
-use Test::More tests => 8;
+use Test::More;
{
package Room;
ok( !$room->is_lit, 'toggle is_lit back to 0 again using ->flip_switch' );
ok( $room->is_dark, 'check if is_dark does the right thing' );
+done_testing;
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More;
{
package Thingy;
$thingy->invoke_callback;
is($i, 1);
is($thingy->multiply(3), 6);
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
=pod
{ package Object::Test; }
-package Foo;
-::use_ok('Moose');
+{
+ package Foo;
+ ::use_ok('Moose');
+}
+
+done_testing;
use lib 't/lib', 'lib';
-use Test::More tests => 2;
-
-
+use Test::More;
use_ok('MyMooseA');
-use_ok('MyMooseB');
\ No newline at end of file
+use_ok('MyMooseB');
+
+done_testing;
use lib 't/lib', 'lib';
-use Test::More tests => 1;
+use Test::More;
-use_ok('MyMooseObject');
\ No newline at end of file
+use_ok('MyMooseObject');
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 2;
-
-
+use Test::More;
=pod
my $bar = Bar->new;
isa_ok($bar, 'Bar');
-isa_ok($bar, 'Foo');
\ No newline at end of file
+isa_ok($bar, 'Foo');
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
use Test::Exception;
-
=pod
This was a bug, but it is fixed now. This
} '... this didnt die';
}
+done_testing;
use strict;
use warnings;
-use Test::More tests => 15;
+use Test::More;
use Test::Exception;
{
is($blart->a, 'Foo::a', '... got the right delgated value');
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More;
{
package Foo;
is($foo->$reader, 10, "Reader works as expected");
}
-
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 3;
-
+use Test::More;
{
'Foo::foo(Baz::foo and Foo::foo())',
'... got the right value for 1 augmented subclass calling non-augmented subclass');
+done_testing;
use strict;
use warnings;
-use Test::More tests => 2;
-
+use Test::More;
{
$foo->bar();
is($Foo::bar_default_called, 1, "bar default was only called once when lazy attribute is accessed");
+
+done_testing;
use warnings;
use FindBin;
-use Test::More tests => 144;
+use Test::More;
use Test::Exception;
use Moose::Util::TypeConstraints;
}
}
-1;
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 12;
+use Test::More;
use Test::Exception;
if Quux->meta->is_mutable
}
+done_testing;
sub _build_foo { undef }
package main;
-use Test::More tests => 4;
+use Test::More;
ok ( !defined(Foo->new->bar), 'NonLazyBuild: Undef default' );
ok ( !defined(Foo->new->bar(undef)), 'NonLazyBuild: Undef explicit' );
## This test fails at the time of creation.
ok ( !defined(Foo->new->foo(undef)), 'LazyBuild: Undef explicit' );
-
-1;
+done_testing;
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 5;
+use Test::More;
my @called;
is_deeply([splice @called], ['Child::DEMOLISHALL', 'Class::DEMOLISHALL', 'Child::DEMOLISH', 'Class::DEMOLISH']);
+done_testing;
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
use Test::Exception;
-
{
package My::Role;
use Moose::Role;
} qr/You cannot inherit from a Moose Role \(My\:\:Role\)/,
'... this croaks correctly';
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More;
use Test::Exception;
-
# RT #37569
{
qr/Attribute \(nt\) does not pass the type constraint because: blessed/,
'... got the right error message';
+done_testing;
use strict;
use warnings;
-use Test::More tests => 36;
+use Test::More;
use Test::Exception;
-
BEGIN {
package MyRole;
use Moose::Role;
ok( MyClass->meta->meta->does_role('MyRole'), 'metaclass does MyRole' );
is( MyClass->meta->foo, 'i am foo', '... foo method returns expected value' );
+done_testing;
#!/usr/bin/env perl
-use Test::More tests => 10;
+use Test::More;
{
my $package = qq{
my $obj = Test::Moose::Go::Boom5->new;
::is( $obj->id, '0 but true', 'value is still the same' );
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More;
{
package A;
is( C->new->foo, 'c' );
is( C->new->bar, 'cb' );
is( C->new->baz, 'cba' );
+
+done_testing;
package main;
-use Test::More tests => 2;
+use Test::More;
my $m = DemolishAll::WithDemolish->new;
undef $m;
undef $m;
is ( $Role::DemolishAll::ok, 1, 'DemolishAll wo/ explicit DEMOLISH sub' );
-1;
+done_testing;
package main;
-use Test::More tests => 4;
+use Test::More;
{
local $TODO = 'Role composition does not clone methods yet';
isnt(MyClass1->foo, "MyClass2::foo", "role method is not confused with other class" );
isnt(MyClass2->foo, "MyClass1::foo", "role method is not confused with other class" );
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More;
use Test::Exception;
{
# help us prevent it happening in the future.
lives_ok { $object->DESTROY }
'can call DESTROY on an object without a metaclass object in the CMOP cache (immutable version)';
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 10;
+use Test::More;
{
package Ball;
undef $method_meta;
}
+
+done_testing;
use warnings;
use Test::Exception;
-use Test::More tests => 2;
+use Test::More;
{
my $foo = Foo->new;
::isa_ok $foo, 'Bar';
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
use Test::Exception;
use Moose::Meta::Class;
}
'Class is created successfully';
}
+
+done_testing;
#!/usr/bin/perl
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
{
package Foo;
ok(Foo->new()->bug(), 'call constructor on object reference with overloading');
+done_testing;
use strict;
use warnings;
-use Test::More tests => 20;
+use Test::More;
use Test::Exception;
-
## Roles
{
ok(!defined($at_least_10_chars->validate('barrrrrrrrr')), '... validated correctly');
is($at_least_10_chars->validate('bar'), 'must be at least 10 chars', '... validation failed correctly');
+done_testing;
plan skip_all => "DBM::Deep 1.0003 (or greater) is required for this test" if $@;
eval "use DateTime::Format::MySQL;";
plan skip_all => "DateTime::Format::MySQL is required for this test" if $@;
- plan tests => 88;
}
use Test::Exception;
}
-
=pod
This example creates a very basic Object Database which
}
+done_testing;
use strict;
use warnings;
-use Test::More tests => 30;
+use Test::More;
use Test::Exception;
sub U {
is($coll2->print, '1, 4, 9, 16, 25, 36, 49, 64, 81, 100', '... new collection is changed');
}
-
-
-
-
-
-
-
+done_testing;
BEGIN {
eval "use Declare::Constraints::Simple;";
plan skip_all => "Declare::Constraints::Simple is required for this test" if $@;
- plan tests => 9;
}
use Test::Exception;
$foo->baz({});
} '... validation failed correctly';
-
-
-
-
-
-
+done_testing;
BEGIN {
eval "use Test::Deep;";
plan skip_all => "Test::Deep is required for this test" if $@;
- plan tests => 5;
}
use Test::Exception;
$foo->bar([{ foo => 3 }]);
} '... validation failed correctly';
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 28;
+use Test::More;
=pod
is(Foo->bar, 100, '... still got the original value stored in the prototype (through the Foo class)');
is(Bar->bar, 100, '... still got the original value stored in the prototype (through the Bar class)');
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 23;
+use Test::More;
=pod
'... parent2 and orphan child have the same last name ('
. $parent2->last_name
. ')' );
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 8;
+use Test::More;
use Test::Exception;
-
{
package Record;
use Moose;
is($rsi->first_name, 'Jim', '... got the right first name');
is($rsi->last_name, 'Johnson', '... got the right last name');
-
-
-
-
-
-
-
-
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 15;
+use Test::More;
use Test::Exception;
use Moose::Meta::Role;
Nothing here yet, but soon :)
=cut
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More;
use Test::Exception;
-
{
package My::Role;
use Moose::Role;
is($foo->baz, 'My::Role::baz(Foo::baz)', '... got the right value');
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
use Test::Exception;
-
{
package My::Meta;
My::Meta->meta()->make_immutable(debug => 0)
} '... can make a meta class immutable';
+done_testing;
use strict;
use warnings;
-use Test::More tests => 10;
+use Test::More;
use Test::Exception;
=pod
Foo->meta->make_immutable(debug => 0) unless $is_immutable;
}
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 5;
+use Test::More;
use Test::Exception;
-
{
package Foo;
use Moose;
is( Foo->meta->get_method('DESTROY')->package_name, 'Foo',
'Foo has a DESTROY method in the Bar class (not inherited)' );
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More;
use Test::Exception;
-
{
package AClass;
lives_ok { AClass->new(bar => 'bar') } '... no triggers called';
-
-
+done_testing;
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More;
use Test::Exception;
-
=pod
This tests to make sure that we provide the same error messages from
throws_ok { Foo->new(undef) } qr/\QSingle parameters to new() must be a HASH ref/,
'undef provided to immutable constructor gives useful error message';
+done_testing;
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More;
{
package Foo;
}
}
-
+done_testing;
BEGIN {
eval "use Test::Output;";
plan skip_all => "Test::Output is required for this test" if $@;
- plan tests => 6;
}
{
'no warning when inheriting from a class that has already made itself immutable'
);
}
+
+done_testing;
BEGIN {
eval "use Test::Output;";
plan skip_all => "Test::Output is required for this test" if $@;
- plan tests => 1;
}
{
'got a warning that Foo may not have an inlined constructor'
);
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 12;
+use Test::More;
use Test::Exception;
{
'default value for buz attr' );
is( $bar->faz, qq{\0},
'default value for faz attr' );
+
+done_testing;
BEGIN {
eval "use Test::Output;";
plan skip_all => "Test::Output is required for this test" if $@;
- plan tests => 1;
}
{
);
}
+done_testing;
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 14;
+use Test::More;
{
package FooTrait;
"class_of and ->meta are the same on Foo's metaclass (immutable)");
isa_ok(Class::MOP::class_of($meta), 'Moose::Meta::Class');
ok($meta->meta->does_role('FooTrait'), "still does the trait after immutable");
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
{
package FooBar;
my $f = FooBar->new( name => 'SUSAN' );
is( $f->DESTROY, 'SUSAN', 'Did moose overload DESTROY?' );
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
BEGIN {
use_ok('Moose::Util');
-}
\ No newline at end of file
+}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 8;
+use Test::More;
BEGIN {
use_ok('Moose::Util', ':all');
#ok(does_role('Foo::Foo', 'Foo'), '... Foo::Foo does do Foo');
+done_testing;
use strict;
use warnings;
-use Test::More tests => 5;
+use Test::More;
BEGIN {
use_ok('Moose::Util', ':all');
}
is search_class_by_role('SCBR::D', 'SCBR::Role'), 'SCBR::D', '... nearest class being direct class returned';
+done_testing;
use strict;
use warnings;
-use Test::More tests => 16;
+use Test::More;
use Moose::Util qw( resolve_metaclass_alias resolve_metatrait_alias );
is( resolve_metatrait_alias( 'Attribute', 'Bar' ),
'My::Trait::Bar',
'resolve_metatrait_alias finds Moose::Meta::Attribute::Custom::Trait::Bar as My::Trait::Bar via alias (Bar) a second time' );
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 8;
+use Test::More;
BEGIN {
use_ok('Moose::Util', ':all');
[ Foo->meta, Foo->meta, Bar->meta ],
"unchanged, since all roles are already applied",
);
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 8;
+use Test::More;
use Test::Moose qw(does_ok);
BEGIN {
isa_ok($bwmc_meta->get_attribute('bar'), 'Bar::Meta::Attribute');
does_ok($bwmt_meta, 'Bar::Meta::Role');
does_ok($bwmt_meta->get_attribute('bar'), 'Bar::Meta::Role::Attribute');
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
BEGIN {
use_ok('Test::Moose');
-}
\ No newline at end of file
+}
+
+done_testing;
use strict;
use warnings;
-use Test::Builder::Tester tests => 2;
+use Test::Builder::Tester;
use Test::More;
BEGIN {
test_test ('does_ok');
+done_testing;
use strict;
use warnings;
-use Test::Builder::Tester tests => 2;
+use Test::Builder::Tester;
use Test::More;
BEGIN {
test_test ('has_attribute_ok');
+done_testing;
use strict;
use warnings;
-use Test::Builder::Tester tests => 2;
+use Test::Builder::Tester;
use Test::More;
BEGIN {
test_test ('meta_ok');
+done_testing;
use strict;
use warnings;
-use Test::Builder::Tester tests => 5;
+use Test::Builder::Tester;
use Test::More;
BEGIN {
} qw(Bar);
test_test('with_immutable success');
ok($ret, "all tests succeeded");
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 4;
+use Test::More;
use Test::Exception;
BEGIN {
ok($errmsg !~ /Validation failed for 'ChildConstraint'/, 'exception references failing parent constraint');
};
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 39;
+use Test::More;
use Test::Exception;
sub req_or_has ($$) {
isa_ok( $robot->get_method("twist"), "Moose::Meta::Method::Accessor" );
}
+done_testing;
+
__END__
I think Attribute needs to be refactored in some way to better support roles.
use strict;
use warnings;
-use Test::More tests => 20;
+use Test::More;
# if make_immutable is removed from the following code the tests pass
redo tests;
}
}
+
+done_testing;
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
use Test::Exception;
-
=pod
See this for some details:
fail('Moose type constraints and threads dont get along');
}
-
-
-
+done_testing;