isa_ok( $point, 'Point' );
isa_ok( $point, 'Moose::Object' );
-is( $point->x, 1, '... got the right value for x' );
-is( $point->y, 2, '... got the right value for y' );
+is( $point->x, 1, 'got the right value for x' );
+is( $point->y, 2, 'got the right value for y' );
$point->y(10);
-is( $point->y, 10, '... got the right (changed) value for y' );
+is( $point->y, 10, 'got the right (changed) value for y' );
dies_ok {
$point->y('Foo');
}
-'... cannot assign a non-Int to y';
+'cannot assign a non-Int to y';
dies_ok {
Point->new();
}
-'... must provide required attributes to new';
+'must provide required attributes to new';
$point->clear();
-is( $point->x, 0, '... got the right (cleared) value for x' );
-is( $point->y, 0, '... got the right (cleared) value for y' );
+is( $point->x, 0, 'got the right (cleared) value for x' );
+is( $point->y, 0, 'got the right (cleared) value for y' );
# check the type constraints on the constructor
lives_ok {
Point->new( x => 0, y => 0 );
}
-'... can assign a 0 to x and y';
+'can assign a 0 to x and y';
dies_ok {
Point->new( x => 10, y => 'Foo' );
}
-'... cannot assign a non-Int to y';
+'cannot assign a non-Int to y';
dies_ok {
Point->new( x => 'Foo', y => 10 );
}
-'... cannot assign a non-Int to x';
+'cannot assign a non-Int to x';
# Point3D
isa_ok( $point3d, 'Point' );
isa_ok( $point3d, 'Moose::Object' );
-is( $point3d->x, 10, '... got the right value for x' );
-is( $point3d->y, 15, '... got the right value for y' );
-is( $point3d->{'z'}, 3, '... got the right value for z' );
+is( $point3d->x, 10, 'got the right value for x' );
+is( $point3d->y, 15, 'got the right value for y' );
+is( $point3d->{'z'}, 3, 'got the right value for z' );
$point3d->clear();
-is( $point3d->x, 0, '... got the right (cleared) value for x' );
-is( $point3d->y, 0, '... got the right (cleared) value for y' );
-is( $point3d->z, 0, '... got the right (cleared) value for z' );
+is( $point3d->x, 0, 'got the right (cleared) value for x' );
+is( $point3d->y, 0, 'got the right (cleared) value for y' );
+is( $point3d->z, 0, 'got the right (cleared) value for z' );
dies_ok {
Point3D->new( x => 10, y => 'Foo', z => 3 );
}
-'... cannot assign a non-Int to y';
+'cannot assign a non-Int to y';
dies_ok {
Point3D->new( x => 'Foo', y => 10, z => 3 );
}
-'... cannot assign a non-Int to x';
+'cannot assign a non-Int to x';
dies_ok {
Point3D->new( x => 0, y => 10, z => 'Bar' );
}
-'... cannot assign a non-Int to z';
+'cannot assign a non-Int to z';
dies_ok {
Point3D->new( x => 10, y => 3 );
}
-'... z is a required attribute for Point3D';
+'z is a required attribute for Point3D';
# test some class introspection
isa_ok( Point3D->meta, 'Moose::Meta::Class' );
isnt( Point->meta, Point3D->meta,
- '... they are different metaclasses as well' );
+ 'they are different metaclasses as well' );
# poke at Point
is_deeply(
[ Point->meta->superclasses ],
['Moose::Object'],
- '... Point got the automagic base class'
+ 'Point got the automagic base class'
);
my @Point_methods = qw(meta x y clear);
is_deeply(
[ sort @Point_methods ],
[ sort Point->meta->get_method_list() ],
- '... we match the method list for Point'
+ 'we match the method list for Point'
);
is_deeply(
[ sort @Point_attrs ],
[ sort Point->meta->get_attribute_list() ],
- '... we match the attribute list for Point'
+ 'we match the attribute list for Point'
);
foreach my $method (@Point_methods) {
ok( Point->meta->has_method($method),
- '... Point has the method "' . $method . '"' );
+ 'Point has the method "' . $method . '"' );
}
foreach my $attr_name (@Point_attrs) {
ok( Point->meta->has_attribute($attr_name),
- '... Point has the attribute "' . $attr_name . '"' );
+ 'Point has the attribute "' . $attr_name . '"' );
my $attr = Point->meta->get_attribute($attr_name);
ok( $attr->has_type_constraint,
- '... Attribute ' . $attr_name . ' has a type constraint' );
+ 'Attribute ' . $attr_name . ' has a type constraint' );
isa_ok( $attr->type_constraint, 'Moose::Meta::TypeConstraint' );
is( $attr->type_constraint->name, 'Int',
- '... Attribute ' . $attr_name . ' has an Int type constraint' );
+ 'Attribute ' . $attr_name . ' has an Int type constraint' );
}
# poke at Point3D
is_deeply(
[ Point3D->meta->superclasses ],
['Point'],
- '... Point3D gets the parent given to it'
+ 'Point3D gets the parent given to it'
);
my @Point3D_methods = qw( meta z clear );
is_deeply(
[ sort @Point3D_methods ],
[ sort Point3D->meta->get_method_list() ],
- '... we match the method list for Point3D'
+ 'we match the method list for Point3D'
);
is_deeply(
[ sort @Point3D_attrs ],
[ sort Point3D->meta->get_attribute_list() ],
- '... we match the attribute list for Point3D'
+ 'we match the attribute list for Point3D'
);
foreach my $method (@Point3D_methods) {
ok( Point3D->meta->has_method($method),
- '... Point3D has the method "' . $method . '"' );
+ 'Point3D has the method "' . $method . '"' );
}
foreach my $attr_name (@Point3D_attrs) {
ok( Point3D->meta->has_attribute($attr_name),
- '... Point3D has the attribute "' . $attr_name . '"' );
+ 'Point3D has the attribute "' . $attr_name . '"' );
my $attr = Point3D->meta->get_attribute($attr_name);
ok( $attr->has_type_constraint,
- '... Attribute ' . $attr_name . ' has a type constraint' );
+ 'Attribute ' . $attr_name . ' has a type constraint' );
isa_ok( $attr->type_constraint, 'Moose::Meta::TypeConstraint' );
is( $attr->type_constraint->name, 'Int',
- '... Attribute ' . $attr_name . ' has an Int type constraint' );
+ 'Attribute ' . $attr_name . ' has an Int type constraint' );
}
=end testing
$savings_account = BankAccount->new( balance => 250 );
isa_ok( $savings_account, 'BankAccount' );
- is( $savings_account->balance, 250, '... got the right savings balance' );
+ is( $savings_account->balance, 250, 'got the right savings balance' );
lives_ok {
$savings_account->withdraw(50);
}
- '... withdrew from savings successfully';
+ 'withdrew from savings successfully';
is( $savings_account->balance, 200,
- '... got the right savings balance after withdrawl' );
+ 'got the right savings balance after withdrawl' );
$savings_account->deposit(150);
is( $savings_account->balance, 350,
- '... got the right savings balance after deposit' );
+ 'got the right savings balance after deposit' );
}
{
isa_ok( $checking_account, 'BankAccount' );
is( $checking_account->overdraft_account, $savings_account,
- '... got the right overdraft account' );
+ 'got the right overdraft account' );
is( $checking_account->balance, 100,
- '... got the right checkings balance' );
+ 'got the right checkings balance' );
lives_ok {
$checking_account->withdraw(50);
}
- '... withdrew from checking successfully';
+ 'withdrew from checking successfully';
is( $checking_account->balance, 50,
- '... got the right checkings balance after withdrawl' );
+ 'got the right checkings balance after withdrawl' );
is( $savings_account->balance, 350,
- '... got the right savings balance after checking withdrawl (no overdraft)'
+ 'got the right savings balance after checking withdrawl (no overdraft)'
);
lives_ok {
$checking_account->withdraw(200);
}
- '... withdrew from checking successfully';
+ 'withdrew from checking successfully';
is( $checking_account->balance, 0,
- '... got the right checkings balance after withdrawl' );
+ 'got the right checkings balance after withdrawl' );
is( $savings_account->balance, 200,
- '... got the right savings balance after overdraft withdrawl' );
+ 'got the right savings balance after overdraft withdrawl' );
}
{
isa_ok( $checking_account, 'BankAccount' );
is( $checking_account->overdraft_account, undef,
- '... no overdraft account' );
+ 'no overdraft account' );
is( $checking_account->balance, 100,
- '... got the right checkings balance' );
+ 'got the right checkings balance' );
lives_ok {
$checking_account->withdraw(50);
}
- '... withdrew from checking successfully';
+ 'withdrew from checking successfully';
is( $checking_account->balance, 50,
- '... got the right checkings balance after withdrawl' );
+ 'got the right checkings balance after withdrawl' );
dies_ok {
$checking_account->withdraw(200);
}
- '... withdrawl failed due to attempted overdraft';
+ 'withdrawl failed due to attempted overdraft';
is( $checking_account->balance, 50,
- '... got the right checkings balance after withdrawl failure' );
+ 'got the right checkings balance after withdrawl failure' );
}
=end testing
my $root = BinaryTree->new(node => 'root');
isa_ok($root, 'BinaryTree');
-is($root->node, 'root', '... got the right node value');
+is($root->node, 'root', 'got the right node value');
-ok(!$root->has_left, '... no left node yet');
-ok(!$root->has_right, '... no right node yet');
+ok(!$root->has_left, 'no left node yet');
+ok(!$root->has_right, 'no right node yet');
-ok(!$root->has_parent, '... no parent for root node');
+ok(!$root->has_parent, 'no parent for root node');
# make a left node
my $left = $root->left;
isa_ok($left, 'BinaryTree');
-is($root->left, $left, '... got the same node (and it is $left)');
-ok($root->has_left, '... we have a left node now');
+is($root->left, $left, 'got the same node (and it is $left)');
+ok($root->has_left, 'we have a left node now');
-ok($left->has_parent, '... lefts has a parent');
-is($left->parent, $root, '... lefts parent is the root');
+ok($left->has_parent, 'lefts has a parent');
+is($left->parent, $root, 'lefts parent is the root');
-ok(isweak($left->{parent}), '... parent is a weakened ref');
+ok(isweak($left->{parent}), 'parent is a weakened ref');
-ok(!$left->has_left, '... $left no left node yet');
-ok(!$left->has_right, '... $left no right node yet');
+ok(!$left->has_left, '$left no left node yet');
+ok(!$left->has_right, '$left no right node yet');
-is($left->node, undef, '... left has got no node value');
+is($left->node, undef, 'left has got no node value');
lives_ok {
$left->node('left')
-} '... assign to lefts node';
+} 'assign to lefts node';
-is($left->node, 'left', '... left now has a node value');
+is($left->node, 'left', 'left now has a node value');
# make a right node
-ok(!$root->has_right, '... still no right node yet');
+ok(!$root->has_right, 'still no right node yet');
-is($root->right->node, undef, '... right has got no node value');
+is($root->right->node, undef, 'right has got no node value');
-ok($root->has_right, '... now we have a right node');
+ok($root->has_right, 'now we have a right node');
my $right = $root->right;
isa_ok($right, 'BinaryTree');
lives_ok {
$right->node('right')
-} '... assign to rights node';
+} 'assign to rights node';
-is($right->node, 'right', '... left now has a node value');
+is($right->node, 'right', 'left now has a node value');
-is($root->right, $right, '... got the same node (and it is $right)');
-ok($root->has_right, '... we have a right node now');
+is($root->right, $right, 'got the same node (and it is $right)');
+ok($root->has_right, 'we have a right node now');
-ok($right->has_parent, '... rights has a parent');
-is($right->parent, $root, '... rights parent is the root');
+ok($right->has_parent, 'rights has a parent');
+is($right->parent, $root, 'rights parent is the root');
-ok(isweak($right->{parent}), '... parent is a weakened ref');
+ok(isweak($right->{parent}), 'parent is a weakened ref');
# make a left node of the left node
my $left_left = $left->left;
isa_ok($left_left, 'BinaryTree');
-ok($left_left->has_parent, '... left does have a parent');
+ok($left_left->has_parent, 'left does have a parent');
-is($left_left->parent, $left, '... got a parent node (and it is $left)');
-ok($left->has_left, '... we have a left node now');
-is($left->left, $left_left, '... got a left node (and it is $left_left)');
+is($left_left->parent, $left, 'got a parent node (and it is $left)');
+ok($left->has_left, 'we have a left node now');
+is($left->left, $left_left, 'got a left node (and it is $left_left)');
-ok(isweak($left_left->{parent}), '... parent is a weakened ref');
+ok(isweak($left_left->{parent}), 'parent is a weakened ref');
# make a right node of the left node
lives_ok {
$left->right($left_right)
-} '... assign to rights node';
+} 'assign to rights node';
-ok($left_right->has_parent, '... left does have a parent');
+ok($left_right->has_parent, 'left does have a parent');
-is($left_right->parent, $left, '... got a parent node (and it is $left)');
-ok($left->has_right, '... we have a left node now');
-is($left->right, $left_right, '... got a left node (and it is $left_left)');
+is($left_right->parent, $left, 'got a parent node (and it is $left)');
+ok($left->has_right, 'we have a left node now');
+is($left->right, $left_right, 'got a left node (and it is $left_left)');
-ok(isweak($left_right->{parent}), '... parent is a weakened ref');
+ok(isweak($left_right->{parent}), 'parent is a weakened ref');
# and check the error
dies_ok {
$left_right->right($left_left)
-} '... cant assign a node which already has a parent';
+} 'cant assign a node which already has a parent';
=end testing
}
);
}
-'... created the entire company successfully';
+'created the entire company successfully';
isa_ok( $ii, 'Company' );
is( $ii->name, 'Infinity Interactive',
- '... got the right name for the company' );
+ 'got the right name for the company' );
isa_ok( $ii->address, 'Address' );
is( $ii->address->street, '565 Plandome Rd., Suite 307',
- '... got the right street address' );
-is( $ii->address->city, 'Manhasset', '... got the right city' );
-is( $ii->address->state, 'NY', '... got the right state' );
-is( $ii->address->zip_code, 11030, '... got the zip code' );
+ 'got the right street address' );
+is( $ii->address->city, 'Manhasset', 'got the right city' );
+is( $ii->address->state, 'NY', 'got the right state' );
+is( $ii->address->zip_code, 11030, 'got the zip code' );
-is( $ii->get_employee_count, 3, '... got the right employee count' );
+is( $ii->get_employee_count, 3, 'got the right employee count' );
# employee #1
isa_ok( $ii->employees->[0], 'Person' );
is( $ii->employees->[0]->first_name, 'Jeremy',
- '... got the right first name' );
-is( $ii->employees->[0]->last_name, 'Shao', '... got the right last name' );
-ok( !$ii->employees->[0]->has_middle_initial, '... no middle initial' );
+ 'got the right first name' );
+is( $ii->employees->[0]->last_name, 'Shao', 'got the right last name' );
+ok( !$ii->employees->[0]->has_middle_initial, 'no middle initial' );
is( $ii->employees->[0]->middle_initial, undef,
- '... got the right middle initial value' );
+ 'got the right middle initial value' );
is( $ii->employees->[0]->full_name,
'Jeremy Shao, President / Senior Consultant',
- '... got the right full name' );
+ 'got the right full name' );
is( $ii->employees->[0]->title, 'President / Senior Consultant',
- '... got the right title' );
-is( $ii->employees->[0]->employer, $ii, '... got the right company' );
+ 'got the right title' );
+is( $ii->employees->[0]->employer, $ii, 'got the right company' );
ok( isweak( $ii->employees->[0]->{employer} ),
- '... the company is a weak-ref' );
+ 'the company is a weak-ref' );
isa_ok( $ii->employees->[0]->address, 'Address' );
is( $ii->employees->[0]->address->city, 'Manhasset',
- '... got the right city' );
-is( $ii->employees->[0]->address->state, 'NY', '... got the right state' );
+ 'got the right city' );
+is( $ii->employees->[0]->address->state, 'NY', 'got the right state' );
# employee #2
isa_ok( $ii->employees->[1], 'Person' );
is( $ii->employees->[1]->first_name, 'Tommy',
- '... got the right first name' );
-is( $ii->employees->[1]->last_name, 'Lee', '... got the right last name' );
-ok( !$ii->employees->[1]->has_middle_initial, '... no middle initial' );
+ 'got the right first name' );
+is( $ii->employees->[1]->last_name, 'Lee', 'got the right last name' );
+ok( !$ii->employees->[1]->has_middle_initial, 'no middle initial' );
is( $ii->employees->[1]->middle_initial, undef,
- '... got the right middle initial value' );
+ 'got the right middle initial value' );
is( $ii->employees->[1]->full_name,
'Tommy Lee, Vice President / Senior Developer',
- '... got the right full name' );
+ 'got the right full name' );
is( $ii->employees->[1]->title, 'Vice President / Senior Developer',
- '... got the right title' );
-is( $ii->employees->[1]->employer, $ii, '... got the right company' );
+ 'got the right title' );
+is( $ii->employees->[1]->employer, $ii, 'got the right company' );
ok( isweak( $ii->employees->[1]->{employer} ),
- '... the company is a weak-ref' );
+ 'the company is a weak-ref' );
isa_ok( $ii->employees->[1]->address, 'Address' );
is( $ii->employees->[1]->address->city, 'New York',
- '... got the right city' );
-is( $ii->employees->[1]->address->state, 'NY', '... got the right state' );
+ 'got the right city' );
+is( $ii->employees->[1]->address->state, 'NY', 'got the right state' );
# employee #3
isa_ok( $ii->employees->[2], 'Person' );
is( $ii->employees->[2]->first_name, 'Stevan',
- '... got the right first name' );
-is( $ii->employees->[2]->last_name, 'Little', '... got the right last name' );
-ok( $ii->employees->[2]->has_middle_initial, '... got middle initial' );
+ 'got the right first name' );
+is( $ii->employees->[2]->last_name, 'Little', 'got the right last name' );
+ok( $ii->employees->[2]->has_middle_initial, 'got middle initial' );
is( $ii->employees->[2]->middle_initial, 'C',
- '... got the right middle initial value' );
+ 'got the right middle initial value' );
is( $ii->employees->[2]->full_name, 'Stevan C. Little, Senior Developer',
- '... got the right full name' );
+ 'got the right full name' );
is( $ii->employees->[2]->title, 'Senior Developer',
- '... got the right title' );
-is( $ii->employees->[2]->employer, $ii, '... got the right company' );
+ 'got the right title' );
+is( $ii->employees->[2]->employer, $ii, 'got the right company' );
ok( isweak( $ii->employees->[2]->{employer} ),
- '... the company is a weak-ref' );
+ 'the company is a weak-ref' );
isa_ok( $ii->employees->[2]->address, 'Address' );
-is( $ii->employees->[2]->address->city, 'Madison', '... got the right city' );
-is( $ii->employees->[2]->address->state, 'CT', '... got the right state' );
+is( $ii->employees->[2]->address->city, 'Madison', 'got the right city' );
+is( $ii->employees->[2]->address->state, 'CT', 'got the right state' );
# create new company
my $ii_employees = $ii->employees;
foreach my $employee (@$ii_employees) {
- is( $employee->employer, $ii, '... has the ii company' );
+ is( $employee->employer, $ii, 'has the ii company' );
}
$new_company->employees($ii_employees);
foreach my $employee ( @{ $new_company->employees } ) {
is( $employee->employer, $new_company,
- '... has the different company now' );
+ 'has the different company now' );
}
## check some error conditions for the subtypes
dies_ok {
Address->new( street => {} ),;
}
-'... we die correctly with bad args';
+'we die correctly with bad args';
dies_ok {
Address->new( city => {} ),;
}
-'... we die correctly with bad args';
+'we die correctly with bad args';
dies_ok {
Address->new( state => 'British Columbia' ),;
}
-'... we die correctly with bad args';
+'we die correctly with bad args';
lives_ok {
Address->new( state => 'Connecticut' ),;
}
-'... we live correctly with good args';
+'we live correctly with good args';
dies_ok {
Address->new( zip_code => 'AF5J6$' ),;
}
-'... we die correctly with bad args';
+'we die correctly with bad args';
lives_ok {
Address->new( zip_code => '06443' ),;
}
-'... we live correctly with good args';
+'we live correctly with good args';
dies_ok {
Company->new(),;
}
-'... we die correctly without good args';
+'we die correctly without good args';
lives_ok {
Company->new( name => 'Foo' ),;
}
-'... we live correctly without good args';
+'we live correctly without good args';
dies_ok {
Company->new( name => 'Foo', employees => [ Person->new ] ),;
}
-'... we die correctly with good args';
+'we die correctly with good args';
lives_ok {
Company->new( name => 'Foo', employees => [] ),;
}
-'... we live correctly with good args';
+'we live correctly with good args';
=end testing
isa_ok( $header, 'HTTP::Headers' );
is( $r->headers->content_type, '',
- '... got no content type in the header' );
+ 'got no content type in the header' );
$r->headers( { content_type => 'text/plain' } );
my $header2 = $r->headers;
isa_ok( $header2, 'HTTP::Headers' );
- isnt( $header, $header2, '... created a new HTTP::Header object' );
+ isnt( $header, $header2, 'created a new HTTP::Header object' );
is( $header2->content_type, 'text/plain',
- '... got the right content type in the header' );
+ 'got the right content type in the header' );
$r->headers( [ content_type => 'text/html' ] );
my $header3 = $r->headers;
isa_ok( $header3, 'HTTP::Headers' );
- isnt( $header2, $header3, '... created a new HTTP::Header object' );
+ isnt( $header2, $header3, 'created a new HTTP::Header object' );
is( $header3->content_type, 'text/html',
- '... got the right content type in the header' );
+ 'got the right content type in the header' );
$r->headers( HTTP::Headers->new( content_type => 'application/pdf' ) );
my $header4 = $r->headers;
isa_ok( $header4, 'HTTP::Headers' );
- isnt( $header3, $header4, '... created a new HTTP::Header object' );
+ isnt( $header3, $header4, 'created a new HTTP::Header object' );
is( $header4->content_type, 'application/pdf',
- '... got the right content type in the header' );
+ 'got the right content type in the header' );
dies_ok {
$r->headers('Foo');
}
- '... dies when it gets bad params';
+ 'dies when it gets bad params';
}
{
- is( $r->protocol, undef, '... got nothing by default' );
+ is( $r->protocol, undef, 'got nothing by default' );
lives_ok {
$r->protocol('HTTP/1.0');
}
- '... set the protocol correctly';
- is( $r->protocol, 'HTTP/1.0', '... got nothing by default' );
+ 'set the protocol correctly';
+ is( $r->protocol, 'HTTP/1.0', 'got nothing by default' );
dies_ok {
$r->protocol('http/1.0');
}
- '... the protocol died with bar params correctly';
+ 'the protocol died with bar params correctly';
}
{
is(
$tps_report->create,
q{<page><header/><report type="tps"/><footer/></page>},
- '... got the right TPS report'
+ 'got the right TPS report'
);
=end testing
is(
$app->dump, q{name: Google
The site's URL: http://google.com
-}, '... got the expected dump value'
+}, 'got the expected dump value'
);
=end testing
is(
$app2->dump, q{name: Google
The site's URL: http://google.com
-}, '... got the expected dump value'
+}, 'got the expected dump value'
);
=begin testing
-ok( US::Currency->does('Comparable'), '... US::Currency does Comparable' );
-ok( US::Currency->does('Eq'), '... US::Currency does Eq' );
-ok( US::Currency->does('Printable'), '... US::Currency does Printable' );
+ok( US::Currency->does('Comparable'), 'US::Currency does Comparable' );
+ok( US::Currency->does('Eq'), 'US::Currency does Eq' );
+ok( US::Currency->does('Printable'), 'US::Currency does Printable' );
my $hundred = US::Currency->new( amount => 100.00 );
isa_ok( $hundred, 'US::Currency' );
ok( $hundred->DOES("Comparable"), "UNIVERSAL::DOES for role" );
can_ok( $hundred, 'amount' );
-is( $hundred->amount, 100, '... got the right amount' );
+is( $hundred->amount, 100, 'got the right amount' );
can_ok( $hundred, 'to_string' );
is( $hundred->to_string, '$100.00 USD',
- '... got the right stringified value' );
+ 'got the right stringified value' );
-ok( $hundred->does('Comparable'), '... US::Currency does Comparable' );
-ok( $hundred->does('Eq'), '... US::Currency does Eq' );
-ok( $hundred->does('Printable'), '... US::Currency does Printable' );
+ok( $hundred->does('Comparable'), 'US::Currency does Comparable' );
+ok( $hundred->does('Eq'), 'US::Currency does Eq' );
+ok( $hundred->does('Printable'), 'US::Currency does Printable' );
my $fifty = US::Currency->new( amount => 50.00 );
isa_ok( $fifty, 'US::Currency' );
can_ok( $fifty, 'amount' );
-is( $fifty->amount, 50, '... got the right amount' );
+is( $fifty->amount, 50, 'got the right amount' );
can_ok( $fifty, 'to_string' );
-is( $fifty->to_string, '$50.00 USD', '... got the right stringified value' );
-
-ok( $hundred->greater_than($fifty), '... 100 gt 50' );
-ok( $hundred->greater_than_or_equal_to($fifty), '... 100 ge 50' );
-ok( !$hundred->less_than($fifty), '... !100 lt 50' );
-ok( !$hundred->less_than_or_equal_to($fifty), '... !100 le 50' );
-ok( !$hundred->equal_to($fifty), '... !100 eq 50' );
-ok( $hundred->not_equal_to($fifty), '... 100 ne 50' );
-
-ok( !$fifty->greater_than($hundred), '... !50 gt 100' );
-ok( !$fifty->greater_than_or_equal_to($hundred), '... !50 ge 100' );
-ok( $fifty->less_than($hundred), '... 50 lt 100' );
-ok( $fifty->less_than_or_equal_to($hundred), '... 50 le 100' );
-ok( !$fifty->equal_to($hundred), '... !50 eq 100' );
-ok( $fifty->not_equal_to($hundred), '... 50 ne 100' );
-
-ok( !$fifty->greater_than($fifty), '... !50 gt 50' );
-ok( $fifty->greater_than_or_equal_to($fifty), '... !50 ge 50' );
-ok( !$fifty->less_than($fifty), '... 50 lt 50' );
-ok( $fifty->less_than_or_equal_to($fifty), '... 50 le 50' );
-ok( $fifty->equal_to($fifty), '... 50 eq 50' );
-ok( !$fifty->not_equal_to($fifty), '... !50 ne 50' );
+is( $fifty->to_string, '$50.00 USD', 'got the right stringified value' );
+
+ok( $hundred->greater_than($fifty), '100 gt 50' );
+ok( $hundred->greater_than_or_equal_to($fifty), '100 ge 50' );
+ok( !$hundred->less_than($fifty), '!100 lt 50' );
+ok( !$hundred->less_than_or_equal_to($fifty), '!100 le 50' );
+ok( !$hundred->equal_to($fifty), '!100 eq 50' );
+ok( $hundred->not_equal_to($fifty), '100 ne 50' );
+
+ok( !$fifty->greater_than($hundred), '!50 gt 100' );
+ok( !$fifty->greater_than_or_equal_to($hundred), '!50 ge 100' );
+ok( $fifty->less_than($hundred), '50 lt 100' );
+ok( $fifty->less_than_or_equal_to($hundred), '50 le 100' );
+ok( !$fifty->equal_to($hundred), '!50 eq 100' );
+ok( $fifty->not_equal_to($hundred), '50 ne 100' );
+
+ok( !$fifty->greater_than($fifty), '!50 gt 50' );
+ok( $fifty->greater_than_or_equal_to($fifty), '!50 ge 50' );
+ok( !$fifty->less_than($fifty), '50 lt 50' );
+ok( $fifty->less_than_or_equal_to($fifty), '50 le 50' );
+ok( $fifty->equal_to($fifty), '50 eq 50' );
+ok( !$fifty->not_equal_to($fifty), '!50 ne 50' );
## ... check some meta-stuff
my $eq_meta = Eq->meta;
isa_ok( $eq_meta, 'Moose::Meta::Role' );
-ok( $eq_meta->has_method('not_equal_to'), '... Eq has_method not_equal_to' );
+ok( $eq_meta->has_method('not_equal_to'), 'Eq has_method not_equal_to' );
ok( $eq_meta->requires_method('equal_to'),
- '... Eq requires_method not_equal_to' );
+ 'Eq requires_method not_equal_to' );
# Comparable
my $comparable_meta = Comparable->meta;
isa_ok( $comparable_meta, 'Moose::Meta::Role' );
-ok( $comparable_meta->does_role('Eq'), '... Comparable does Eq' );
+ok( $comparable_meta->does_role('Eq'), 'Comparable does Eq' );
foreach my $method_name (
qw(
)
) {
ok( $comparable_meta->has_method($method_name),
- '... Comparable has_method ' . $method_name );
+ 'Comparable has_method ' . $method_name );
}
ok( $comparable_meta->requires_method('compare'),
- '... Comparable requires_method compare' );
+ 'Comparable requires_method compare' );
# Printable
isa_ok( $printable_meta, 'Moose::Meta::Role' );
ok( $printable_meta->requires_method('to_string'),
- '... Printable requires_method to_string' );
+ 'Printable requires_method to_string' );
# US::Currency
isa_ok( $currency_meta, 'Moose::Meta::Class' );
ok( $currency_meta->does_role('Comparable'),
- '... US::Currency does Comparable' );
-ok( $currency_meta->does_role('Eq'), '... US::Currency does Eq' );
+ 'US::Currency does Comparable' );
+ok( $currency_meta->does_role('Eq'), 'US::Currency does Eq' );
ok( $currency_meta->does_role('Printable'),
- '... US::Currency does Printable' );
+ 'US::Currency does Printable' );
foreach my $method_name (
qw(
)
) {
ok( $currency_meta->has_method($method_name),
- '... US::Currency has_method ' . $method_name );
+ 'US::Currency has_method ' . $method_name );
}
=end testing
$broken->start();
- is( $cnt, 1, '... start called explode' );
+ is( $cnt, 1, 'start called explode' );
$broken->stop();
- is( $cnt, 2, '... stop also called explode' );
+ is( $cnt, 2, 'stop also called explode' );
}
=end testing
can_ok('Foo', 'meta');
isa_ok(Foo->meta, 'Moose::Meta::Class');
-ok(Foo->meta->has_method('meta'), '... we got the &meta method');
-ok(Foo->isa('Moose::Object'), '... Foo is automagically a Moose::Object');
+ok(Foo->meta->has_method('meta'), 'we got the &meta method');
+ok(Foo->isa('Moose::Object'), 'Foo is automagically a Moose::Object');
dies_ok {
Foo->meta->has_method()
-} '... has_method requires an arg';
+} 'has_method requires an arg';
dies_ok {
Foo->meta->has_method('')
-} '... has_method requires an arg';
+} 'has_method requires an arg';
can_ok('Foo', 'does');
coerce from via
find_type_constraint
)) {
- ok(!Foo->meta->has_method($function), '... the meta does not treat "' . $function . '" as a method');
+ ok(!Foo->meta->has_method($function), 'the meta does not treat "' . $function . '" as a method');
}
foreach my $import (qw(
isa_ok($baz, 'Bar');
isa_ok($baz, 'Foo');
-is($baz->foo(), 'Foo::foo', '... got the right value from &foo');
-is($baz->bar(), 'Baz::bar -> Bar::bar -> Foo::bar', '... got the right value from &bar');
-is($baz->baz(), 'Baz::baz -> Foo::baz', '... got the right value from &baz');
+is($baz->foo(), 'Foo::foo', 'got the right value from &foo');
+is($baz->bar(), 'Baz::bar -> Bar::bar -> Foo::bar', 'got the right value from &bar');
+is($baz->baz(), 'Baz::baz -> Foo::baz', 'got the right value from &baz');
my $bar = Bar->new();
isa_ok($bar, 'Bar');
isa_ok($bar, 'Foo');
-is($bar->foo(), 'Foo::foo', '... got the right value from &foo');
-is($bar->bar(), 'Bar::bar -> Foo::bar', '... got the right value from &bar');
-is($bar->baz(), 'Foo::baz', '... got the right value from &baz');
+is($bar->foo(), 'Foo::foo', 'got the right value from &foo');
+is($bar->bar(), 'Bar::bar -> Foo::bar', 'got the right value from &bar');
+is($bar->baz(), 'Foo::baz', 'got the right value from &baz');
my $foo = Foo->new();
isa_ok($foo, 'Foo');
-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');
+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');
# some error cases
::dies_ok {
override 'bling' => sub {};
- } '... cannot override a method which has a local equivalent';
+ } 'cannot override a method which has a local equivalent';
}
isa_ok($baz, 'Bar');
isa_ok($baz, 'Foo');
-is($baz->foo(), 'Foo::foo(Bar::foo(Baz::foo))', '... got the right value from &foo');
-is($baz->bar(), 'Foo::bar(Bar::bar)', '... got the right value from &bar');
-is($baz->baz(), 'Foo::baz(Baz::baz)', '... got the right value from &baz');
+is($baz->foo(), 'Foo::foo(Bar::foo(Baz::foo))', 'got the right value from &foo');
+is($baz->bar(), 'Foo::bar(Bar::bar)', 'got the right value from &bar');
+is($baz->baz(), 'Foo::baz(Baz::baz)', 'got the right value from &baz');
my $bar = Bar->new();
isa_ok($bar, 'Bar');
isa_ok($bar, 'Foo');
-is($bar->foo(), 'Foo::foo(Bar::foo())', '... got the right value from &foo');
-is($bar->bar(), 'Foo::bar(Bar::bar)', '... got the right value from &bar');
-is($bar->baz(), 'Foo::baz()', '... got the right value from &baz');
+is($bar->foo(), 'Foo::foo(Bar::foo())', 'got the right value from &foo');
+is($bar->bar(), 'Foo::bar(Bar::bar)', 'got the right value from &bar');
+is($bar->baz(), 'Foo::baz()', 'got the right value from &baz');
my $foo = Foo->new();
isa_ok($foo, 'Foo');
-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');
+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');
# some error cases
::dies_ok {
augment 'bling' => sub {};
- } '... cannot augment a method which has a local equivalent';
+ } 'cannot augment a method which has a local equivalent';
}
is($baz->foo,
'Baz::foo -> Foo::foo(Bar::foo)',
- '... got the right value from mixed augment/override foo');
+ 'got the right value from mixed augment/override foo');
=pod
is($baz->bar,
'Bar::bar -> Foo::bar(Baz::bar)',
- '... got the right value from mixed augment/override bar');
+ 'got the right value from mixed augment/override bar');
isa_ok($baz, 'Bar');
isa_ok($baz, 'Foo');
-is($baz->foo(), 'Foo::foo', '... got the right value from &foo');
-is($baz->bar(), 'Baz::bar -> Bar::bar -> Foo::bar', '... got the right value from &bar');
-is($baz->baz(), 'Baz::baz -> Foo::baz', '... got the right value from &baz');
+is($baz->foo(), 'Foo::foo', 'got the right value from &foo');
+is($baz->bar(), 'Baz::bar -> Bar::bar -> Foo::bar', 'got the right value from &bar');
+is($baz->baz(), 'Baz::baz -> Foo::baz', 'got the right value from &baz');
my $bar = Bar->new();
isa_ok($bar, 'Bar');
isa_ok($bar, 'Foo');
-is($bar->foo(), 'Foo::foo', '... got the right value from &foo');
-is($bar->bar(), 'Bar::bar -> Foo::bar', '... got the right value from &bar');
-is($bar->baz(), 'Foo::baz', '... got the right value from &baz');
+is($bar->foo(), 'Foo::foo', 'got the right value from &foo');
+is($bar->bar(), 'Bar::bar -> Foo::bar', 'got the right value from &bar');
+is($bar->baz(), 'Foo::baz', 'got the right value from &baz');
my $foo = Foo->new();
isa_ok($foo, 'Foo');
-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->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
use Moose;
eval '$foo = 5;';
- ::ok($@, '... got an error because strict is on');
- ::like($@, qr/Global symbol \"\$foo\" requires explicit package name at/, '... got the right error');
+ ::ok($@, 'got an error because strict is on');
+ ::like($@, qr/Global symbol \"\$foo\" requires explicit package name at/, 'got the right error');
{
my $warn;
local $SIG{__WARN__} = sub { $warn = $_[0] };
- ::ok(!$warn, '... no warning yet');
+ ::ok(!$warn, 'no warning yet');
eval 'my $bar = 1 + "hello"';
- ::ok($warn, '... got a warning');
+ ::ok($warn, 'got a warning');
::like($warn, qr/Argument \"hello\" isn\'t numeric in addition \(\+\)/, '.. and it is the right warning');
}
}
use Moose::Role;
eval '$foo = 5;';
- ::ok($@, '... got an error because strict is on');
- ::like($@, qr/Global symbol \"\$foo\" requires explicit package name at/, '... got the right error');
+ ::ok($@, 'got an error because strict is on');
+ ::like($@, qr/Global symbol \"\$foo\" requires explicit package name at/, 'got the right error');
{
my $warn;
local $SIG{__WARN__} = sub { $warn = $_[0] };
- ::ok(!$warn, '... no warning yet');
+ ::ok(!$warn, 'no warning yet');
eval 'my $bar = 1 + "hello"';
- ::ok($warn, '... got a warning');
+ ::ok($warn, 'got a warning');
::like($warn, qr/Argument \"hello\" isn\'t numeric in addition \(\+\)/, '.. and it is the right warning');
}
}
use Moose::Exporter;
eval '$foo = 5;';
- ::ok($@, '... got an error because strict is on');
- ::like($@, qr/Global symbol \"\$foo\" requires explicit package name at/, '... got the right error');
+ ::ok($@, 'got an error because strict is on');
+ ::like($@, qr/Global symbol \"\$foo\" requires explicit package name at/, 'got the right error');
{
my $warn;
local $SIG{__WARN__} = sub { $warn = $_[0] };
- ::ok(!$warn, '... no warning yet');
+ ::ok(!$warn, 'no warning yet');
eval 'my $bar = 1 + "hello"';
- ::ok($warn, '... got a warning');
+ ::ok($warn, 'got a warning');
::like($warn, qr/Argument \"hello\" isn\'t numeric in addition \(\+\)/, '.. and it is the right warning');
}
}
die $@ if $@;
}
-ok(!Foo->can($_), '... Foo can no longer do ' . $_) for @moose_exports;
+ok(!Foo->can($_), 'Foo can no longer do ' . $_) for @moose_exports;
# and check the type constraints as well
die $@ if $@;
}
-ok(!Bar->can($_), '... Bar can no longer do ' . $_) for @moose_type_constraint_exports;
+ok(!Bar->can($_), 'Bar can no longer do ' . $_) for @moose_type_constraint_exports;
{
::dies_ok {
before qr/bark.*/ => sub {};
- } '... this is not currently supported';
+ } 'this is not currently supported';
::dies_ok {
around qr/bark.*/ => sub {};
- } '... this is not currently supported';
+ } 'this is not currently supported';
::dies_ok {
after qr/bark.*/ => sub {};
- } '... this is not currently supported';
+ } 'this is not currently supported';
}
my $foo_constraint = find_type_constraint('Foo');
isa_ok($foo_constraint, 'Moose::Meta::TypeConstraint');
-is($foo_constraint->parent->name, 'Value', '... got the Value subtype for Foo');
+is($foo_constraint->parent->name, 'Value', 'got the Value subtype for Foo');
-ok($foo_constraint->check('Foo'), '... my constraint passed correctly');
-ok(!$foo_constraint->check('Bar'), '... my constraint failed correctly');
+ok($foo_constraint->check('Foo'), 'my constraint passed correctly');
+ok(!$foo_constraint->check('Bar'), 'my constraint failed correctly');
{
package Bar;
lives_ok {
$bar->foo('Foo');
-} '... checked the type constraint correctly';
+} 'checked the type constraint correctly';
dies_ok {
$bar->foo(Foo->new);
-} '... checked the type constraint correctly';
+} 'checked the type constraint correctly';
# try to rebless, except it will fail due to Child's stricter type constraint
throws_ok { Child->meta->rebless_instance($foo) }
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';
+'this failed cause of type check';
throws_ok { Child->meta->rebless_instance($bar) }
qr/^Attribute \(type_constrained\) does not pass the type constraint because\: Validation failed for 'Int' failed with value 5\.5/,
-'... this failed cause of type check';;
+'this failed cause of type check';;
$foo->type_constrained(10);
$bar->type_constrained(5);
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';
+'this failed cause of type check';
is( $class->new( 37 )->bar, 37, "single arg" );
{
my $o = $class->new(bar => 42, baz => 47);
- is($o->bar, 42, '... got the right bar');
- is($o->baz, 47, '... got the right bar');
+ is($o->bar, 42, 'got the right bar');
+ is($o->baz, 47, 'got the right bar');
}
{
my $o = $class->new(42, baz => 47);
- is($o->bar, 42, '... got the right bar');
- is($o->baz, 47, '... got the right bar');
+ is($o->bar, 42, 'got the right bar');
+ is($o->baz, 47, 'got the right bar');
}
}
reader => 'get_foo'
);
};
- ::ok(!$@, '... created the reader method okay');
+ ::ok(!$@, 'created the reader method okay');
eval {
has 'lazy_foo' => (
default => sub { 10 }
);
};
- ::ok(!$@, '... created the lazy reader method okay') or warn $@;
+ ::ok(!$@, 'created the lazy reader method okay') or warn $@;
my $warn;
reder => 'get_mftnpy'
);
};
- ::ok($warn, '... got a warning for mispelled attribute argument');
+ ::ok($warn, 'got a warning for mispelled attribute argument');
}
{
isa_ok($foo, 'Foo');
can_ok($foo, 'get_foo');
- is($foo->get_foo(), undef, '... got an undefined value');
+ is($foo->get_foo(), undef, 'got an undefined value');
dies_ok {
$foo->get_foo(100);
- } '... get_foo is a read-only';
+ } 'get_foo is a read-only';
- ok(!exists($foo->{lazy_foo}), '... no value in get_lazy_foo slot');
+ ok(!exists($foo->{lazy_foo}), 'no value in get_lazy_foo slot');
can_ok($foo, 'get_lazy_foo');
- is($foo->get_lazy_foo(), 10, '... got an deferred value');
+ is($foo->get_lazy_foo(), 10, 'got an deferred value');
dies_ok {
$foo->get_lazy_foo(100);
- } '... get_lazy_foo is a read-only';
+ } 'get_lazy_foo is a read-only';
}
{
my $foo = Foo->new(foo => 10, lazy_foo => 100);
isa_ok($foo, 'Foo');
- is($foo->get_foo(), 10, '... got the correct value');
- is($foo->get_lazy_foo(), 100, '... got the correct value');
+ is($foo->get_foo(), 10, 'got the correct value');
+ is($foo->get_lazy_foo(), 100, 'got the correct value');
}
writer => 'set_foo',
);
};
- ::ok(!$@, '... created the writer method okay');
+ ::ok(!$@, 'created the writer method okay');
eval {
has 'foo_required' => (
required => 1,
);
};
- ::ok(!$@, '... created the required writer method okay');
+ ::ok(!$@, 'created the required writer method okay');
eval {
has 'foo_int' => (
isa => 'Int',
);
};
- ::ok(!$@, '... created the writer method with type constraint okay');
+ ::ok(!$@, 'created the writer method with type constraint okay');
eval {
has 'foo_weak' => (
weak_ref => 1
);
};
- ::ok(!$@, '... created the writer method with weak_ref okay');
+ ::ok(!$@, 'created the writer method with weak_ref okay');
}
{
# regular writer
can_ok($foo, 'set_foo');
- is($foo->get_foo(), undef, '... got an unset value');
+ is($foo->get_foo(), undef, 'got an unset value');
lives_ok {
$foo->set_foo(100);
- } '... set_foo wrote successfully';
- is($foo->get_foo(), 100, '... got the correct set value');
+ } 'set_foo wrote successfully';
+ is($foo->get_foo(), 100, 'got the correct set value');
- ok(!isweak($foo->{foo}), '... it is not a weak reference');
+ ok(!isweak($foo->{foo}), 'it is not a weak reference');
# required writer
dies_ok {
Foo->new;
- } '... cannot create without the required attribute';
+ } 'cannot create without the required attribute';
can_ok($foo, 'set_foo_required');
- is($foo->get_foo_required(), 'required', '... got an unset value');
+ is($foo->get_foo_required(), 'required', 'got an unset value');
lives_ok {
$foo->set_foo_required(100);
- } '... set_foo_required wrote successfully';
- is($foo->get_foo_required(), 100, '... got the correct set value');
+ } 'set_foo_required wrote successfully';
+ is($foo->get_foo_required(), 100, 'got the correct set value');
dies_ok {
$foo->set_foo_required();
- } '... set_foo_required died successfully with no value';
+ } 'set_foo_required died successfully with no value';
lives_ok {
$foo->set_foo_required(undef);
- } '... set_foo_required did accept undef';
+ } 'set_foo_required did accept undef';
- ok(!isweak($foo->{foo_required}), '... it is not a weak reference');
+ ok(!isweak($foo->{foo_required}), 'it is not a weak reference');
# with type constraint
can_ok($foo, 'set_foo_int');
- is($foo->get_foo_int(), undef, '... got an unset value');
+ is($foo->get_foo_int(), undef, 'got an unset value');
lives_ok {
$foo->set_foo_int(100);
- } '... set_foo_int wrote successfully';
- is($foo->get_foo_int(), 100, '... got the correct set value');
+ } 'set_foo_int wrote successfully';
+ is($foo->get_foo_int(), 100, 'got the correct set value');
dies_ok {
$foo->set_foo_int("Foo");
- } '... set_foo_int died successfully';
+ } 'set_foo_int died successfully';
- ok(!isweak($foo->{foo_int}), '... it is not a weak reference');
+ ok(!isweak($foo->{foo_int}), 'it is not a weak reference');
# with weak_ref
my $test = [];
can_ok($foo, 'set_foo_weak');
- is($foo->get_foo_weak(), undef, '... got an unset value');
+ is($foo->get_foo_weak(), undef, 'got an unset value');
lives_ok {
$foo->set_foo_weak($test);
- } '... set_foo_weak wrote successfully';
- is($foo->get_foo_weak(), $test, '... got the correct set value');
+ } 'set_foo_weak wrote successfully';
+ is($foo->get_foo_weak(), $test, 'got the correct set value');
- ok(isweak($foo->{foo_weak}), '... it is a weak reference');
+ ok(isweak($foo->{foo_weak}), 'it is a weak reference');
}
accessor => 'foo',
);
};
- ::ok(!$@, '... created the accessor method okay');
+ ::ok(!$@, 'created the accessor method okay');
eval {
has 'lazy_foo' => (
default => sub { 10 }
);
};
- ::ok(!$@, '... created the lazy accessor method okay');
+ ::ok(!$@, 'created the lazy accessor method okay');
eval {
required => 1,
);
};
- ::ok(!$@, '... created the required accessor method okay');
+ ::ok(!$@, 'created the required accessor method okay');
eval {
has 'foo_int' => (
isa => 'Int',
);
};
- ::ok(!$@, '... created the accessor method with type constraint okay');
+ ::ok(!$@, 'created the accessor method with type constraint okay');
eval {
has 'foo_weak' => (
weak_ref => 1
);
};
- ::ok(!$@, '... created the accessor method with weak_ref okay');
+ ::ok(!$@, 'created the accessor method with weak_ref okay');
eval {
has 'foo_deref' => (
auto_deref => 1,
);
};
- ::ok(!$@, '... created the accessor method with auto_deref okay');
+ ::ok(!$@, 'created the accessor method with auto_deref okay');
eval {
has 'foo_deref_ro' => (
auto_deref => 1,
);
};
- ::ok(!$@, '... created the reader method with auto_deref okay');
+ ::ok(!$@, 'created the reader method with auto_deref okay');
eval {
has 'foo_deref_hash' => (
auto_deref => 1,
);
};
- ::ok(!$@, '... created the reader method with auto_deref okay');
+ ::ok(!$@, 'created the reader method with auto_deref okay');
}
{
# regular accessor
can_ok($foo, 'foo');
- is($foo->foo(), undef, '... got an unset value');
+ is($foo->foo(), undef, 'got an unset value');
lives_ok {
$foo->foo(100);
- } '... foo wrote successfully';
- is($foo->foo(), 100, '... got the correct set value');
+ } 'foo wrote successfully';
+ is($foo->foo(), 100, 'got the correct set value');
- ok(!isweak($foo->{foo}), '... it is not a weak reference');
+ ok(!isweak($foo->{foo}), 'it is not a weak reference');
# required writer
dies_ok {
Foo->new;
- } '... cannot create without the required attribute';
+ } 'cannot create without the required attribute';
can_ok($foo, 'foo_required');
- is($foo->foo_required(), 'required', '... got an unset value');
+ is($foo->foo_required(), 'required', 'got an unset value');
lives_ok {
$foo->foo_required(100);
- } '... foo_required wrote successfully';
- is($foo->foo_required(), 100, '... got the correct set value');
+ } 'foo_required wrote successfully';
+ is($foo->foo_required(), 100, 'got the correct set value');
lives_ok {
$foo->foo_required(undef);
- } '... foo_required did not die with undef';
+ } 'foo_required did not die with undef';
is($foo->foo_required, undef, "value is undef");
- ok(!isweak($foo->{foo_required}), '... it is not a weak reference');
+ ok(!isweak($foo->{foo_required}), 'it is not a weak reference');
# lazy
- ok(!exists($foo->{lazy_foo}), '... no value in lazy_foo slot');
+ ok(!exists($foo->{lazy_foo}), 'no value in lazy_foo slot');
can_ok($foo, 'lazy_foo');
- is($foo->lazy_foo(), 10, '... got an deferred value');
+ is($foo->lazy_foo(), 10, 'got an deferred value');
# with type constraint
can_ok($foo, 'foo_int');
- is($foo->foo_int(), undef, '... got an unset value');
+ is($foo->foo_int(), undef, 'got an unset value');
lives_ok {
$foo->foo_int(100);
- } '... foo_int wrote successfully';
- is($foo->foo_int(), 100, '... got the correct set value');
+ } 'foo_int wrote successfully';
+ is($foo->foo_int(), 100, 'got the correct set value');
dies_ok {
$foo->foo_int("Foo");
- } '... foo_int died successfully';
+ } 'foo_int died successfully';
- ok(!isweak($foo->{foo_int}), '... it is not a weak reference');
+ ok(!isweak($foo->{foo_int}), 'it is not a weak reference');
# with weak_ref
my $test = [];
can_ok($foo, 'foo_weak');
- is($foo->foo_weak(), undef, '... got an unset value');
+ is($foo->foo_weak(), undef, 'got an unset value');
lives_ok {
$foo->foo_weak($test);
- } '... foo_weak wrote successfully';
- is($foo->foo_weak(), $test, '... got the correct set value');
+ } 'foo_weak wrote successfully';
+ is($foo->foo_weak(), $test, 'got the correct set value');
- ok(isweak($foo->{foo_weak}), '... it is a weak reference');
+ ok(isweak($foo->{foo_weak}), 'it is a weak reference');
can_ok( $foo, 'foo_deref');
- is_deeply( [$foo->foo_deref()], [], '... default default value');
+ is_deeply( [$foo->foo_deref()], [], 'default default value');
my @list;
lives_ok {
@list = $foo->foo_deref();
lives_ok {
$foo->foo_deref( [ qw/foo bar gorch/ ] );
- } '... foo_deref wrote successfully';
+ } 'foo_deref wrote successfully';
is( Scalar::Util::reftype( scalar $foo->foo_deref() ), "ARRAY", "returns an array reference in scalar context" );
is_deeply( scalar($foo->foo_deref()), [ qw/foo bar gorch/ ], "correct array" );
lives_ok {
$foo->foo_deref_hash( { foo => 1, bar => 2 } );
- } '... foo_deref_hash wrote successfully';
+ } 'foo_deref_hash wrote successfully';
is_deeply( scalar($foo->foo_deref_hash), { foo => 1, bar => 2 }, "scalar context" );
lives_ok {
$foo->bar($bar);
- } '... did not die setting bar';
+ } 'did not die setting bar';
- is($foo->bar, $bar, '... set the value foo.bar correctly');
- is($bar->foo, $foo, '... which in turn set the value bar.foo correctly');
+ is($foo->bar, $bar, 'set the value foo.bar correctly');
+ is($bar->foo, $foo, 'which in turn set the value bar.foo correctly');
- ok(isweak($bar->{foo}), '... bar.foo is a weak reference');
+ ok(isweak($bar->{foo}), 'bar.foo is a weak reference');
lives_ok {
$foo->bar(undef);
- } '... did not die un-setting bar';
+ } 'did not die un-setting bar';
- is($foo->bar, undef, '... set the value foo.bar correctly');
- is($bar->foo, $foo, '... which in turn set the value bar.foo correctly');
+ is($foo->bar, undef, 'set the value foo.bar correctly');
+ is($bar->foo, $foo, 'which in turn set the value bar.foo correctly');
# test the writer
lives_ok {
$foo->set_baz($baz);
- } '... did not die setting baz';
+ } 'did not die setting baz';
- is($foo->get_baz, $baz, '... set the value foo.baz correctly');
- is($baz->foo, $foo, '... which in turn set the value baz.foo correctly');
+ is($foo->get_baz, $baz, 'set the value foo.baz correctly');
+ is($baz->foo, $foo, 'which in turn set the value baz.foo correctly');
- ok(isweak($baz->{foo}), '... baz.foo is a weak reference');
+ ok(isweak($baz->{foo}), 'baz.foo is a weak reference');
}
{
my $foo = Foo->new(bar => $bar, baz => $baz);
isa_ok($foo, 'Foo');
- is($foo->bar, $bar, '... set the value foo.bar correctly');
- is($bar->foo, $foo, '... which in turn set the value bar.foo correctly');
+ is($foo->bar, $bar, 'set the value foo.bar correctly');
+ is($bar->foo, $foo, 'which in turn set the value bar.foo correctly');
- ok(isweak($bar->{foo}), '... bar.foo is a weak reference');
+ ok(isweak($bar->{foo}), 'bar.foo is a weak reference');
- is($foo->get_baz, $baz, '... set the value foo.baz correctly');
- is($baz->foo, $foo, '... which in turn set the value baz.foo correctly');
+ is($foo->get_baz, $baz, 'set the value foo.baz correctly');
+ is($baz->foo, $foo, 'which in turn set the value baz.foo correctly');
- ok(isweak($baz->{foo}), '... baz.foo is a weak reference');
+ ok(isweak($baz->{foo}), 'baz.foo is a weak reference');
}
# some errors
::dies_ok {
has('bling' => (is => 'rw', trigger => 'Fail'));
- } '... a trigger must be a CODE ref';
+ } 'a trigger must be a CODE ref';
::dies_ok {
has('bling' => (is => 'rw', trigger => []));
- } '... a trigger must be a CODE ref';
+ } 'a trigger must be a CODE ref';
}
# Triggers do not fire on built values
lives_ok {
$foo->bar($bar);
-} '... bar passed the type constraint okay';
+} 'bar passed the type constraint okay';
dies_ok {
$foo->bar($foo);
-} '... foo did not pass the type constraint okay';
+} 'foo did not pass the type constraint okay';
lives_ok {
$foo->baz($bar);
-} '... baz passed the type constraint okay';
+} 'baz passed the type constraint okay';
dies_ok {
$foo->baz($foo);
-} '... foo did not pass the type constraint okay';
+} 'foo did not pass the type constraint okay';
lives_ok {
$bar->foo($foo);
-} '... foo passed the type constraint okay';
+} 'foo passed the type constraint okay';
# if it does not,.. we have a conflict... so we die loudly
::dies_ok {
has 'foo' => (isa => 'Foo::Class', does => 'Bar::Class');
- } '... cannot have a does() which is not done by the isa()';
+ } 'cannot have a does() which is not done by the isa()';
}
{
# if it does not,.. we have a conflict... so we die loudly
::dies_ok {
has 'foo' => (isa => 'Bling', does => 'Bar::Class');
- } '... cannot have a isa() which is cannot does()';
+ } 'cannot have a isa() which is cannot does()';
}
my $foo = Foo->new(bar => 10, baz => 20, boo => 100);
isa_ok($foo, 'Foo');
- is($foo->bar, 10, '... got the right bar');
- is($foo->baz, 20, '... got the right baz');
- is($foo->boo, 100, '... got the right boo');
+ is($foo->bar, 10, 'got the right bar');
+ is($foo->baz, 20, 'got the right baz');
+ is($foo->boo, 100, 'got the right boo');
}
{
my $foo = Foo->new(bar => 10, boo => 5);
isa_ok($foo, 'Foo');
- is($foo->bar, 10, '... got the right bar');
- is($foo->baz, 100, '... got the right baz');
- is($foo->boo, 5, '... got the right boo');
+ is($foo->bar, 10, 'got the right bar');
+ is($foo->baz, 100, 'got the right baz');
+ is($foo->boo, 5, 'got the right boo');
}
{
my $foo = Foo->new(bar => 10);
isa_ok($foo, 'Foo');
- is($foo->bar, 10, '... got the right bar');
- is($foo->baz, 100, '... got the right baz');
- is($foo->boo, 50, '... got the right boo');
+ is($foo->bar, 10, 'got the right bar');
+ is($foo->baz, 100, 'got the right baz');
+ is($foo->boo, 50, 'got the right boo');
}
#Yeah.. this doesn't work like this anymore, see below. (groditi)
#throws_ok {
# Foo->new(bar => 10, baz => undef);
-#} qr/^Attribute \(baz\) is required and cannot be undef/, '... must supply all the required attribute';
+#} qr/^Attribute \(baz\) is required and cannot be undef/, 'must supply all the required attribute';
#throws_ok {
# Foo->new(bar => 10, boo => undef);
-#} qr/^Attribute \(boo\) is required and cannot be undef/, '... must supply all the required attribute';
+#} qr/^Attribute \(boo\) is required and cannot be undef/, 'must supply all the required attribute';
lives_ok {
Foo->new(bar => 10, baz => undef);
-} '... undef is a valid attribute value';
+} 'undef is a valid attribute value';
lives_ok {
Foo->new(bar => 10, boo => undef);
-} '... undef is a valid attribute value';
+} 'undef is a valid attribute value';
throws_ok {
Foo->new;
-} qr/^Attribute \(bar\) is required/, '... must supply all the required attribute';
+} qr/^Attribute \(bar\) is required/, 'must supply all the required attribute';
isa_ok($foo_attr, 'Foo::Meta::Attribute');
isa_ok($foo_attr, 'Moose::Meta::Attribute');
- is($foo_attr->name, 'foo', '... got the right name for our meta-attribute');
- ok($foo_attr->has_accessor, '... our meta-attrubute created the accessor for us');
+ is($foo_attr->name, 'foo', 'got the right name for our meta-attribute');
+ ok($foo_attr->has_accessor, 'our meta-attrubute created the accessor for us');
- ok($foo_attr->has_type_constraint, '... our meta-attrubute created the type_constraint for us');
+ ok($foo_attr->has_type_constraint, 'our meta-attrubute created the type_constraint for us');
my $foo_attr_type_constraint = $foo_attr->type_constraint;
isa_ok($foo_attr_type_constraint, 'Moose::Meta::TypeConstraint');
- is($foo_attr_type_constraint->name, 'Foo', '... got the right type constraint name');
- is($foo_attr_type_constraint->parent->name, 'Object', '... got the right type constraint parent name');
+ is($foo_attr_type_constraint->name, 'Foo', 'got the right type constraint name');
+ is($foo_attr_type_constraint->parent->name, 'Object', 'got the right type constraint parent name');
}
{
package Bar::Meta::Attribute;
::lives_ok {
has 'bar' => (metaclass => 'Bar::Meta::Attribute');
- } '... the attribute metaclass need not be a Moose::Meta::Attribute as long as it behaves';
+ } 'the attribute metaclass need not be a Moose::Meta::Attribute as long as it behaves';
}
{
::lives_ok {
has 'foo' => (metaclass => 'Foo');
- } '... the attribute metaclass alias worked correctly';
+ } 'the attribute metaclass alias worked correctly';
::lives_ok {
has 'bar' => (metaclass => 'Bar', is => 'bare');
- } '... the attribute metaclass alias worked correctly';
+ } 'the attribute metaclass alias worked correctly';
}
{
lives_ok {
$foo->bar([])
-} '... set bar successfully with an ARRAY ref';
+} 'set bar successfully with an ARRAY ref';
lives_ok {
$foo->bar({})
-} '... set bar successfully with a HASH ref';
+} 'set bar successfully with a HASH ref';
dies_ok {
$foo->bar(100)
-} '... couldnt set bar successfully with a number';
+} 'couldnt set bar successfully with a number';
dies_ok {
$foo->bar(sub {})
-} '... couldnt set bar successfully with a CODE ref';
+} 'couldnt set bar successfully with a CODE ref';
# check the constructor
lives_ok {
Foo->new(bar => [])
-} '... created new Foo with bar successfully set with an ARRAY ref';
+} 'created new Foo with bar successfully set with an ARRAY ref';
lives_ok {
Foo->new(bar => {})
-} '... created new Foo with bar successfully set with a HASH ref';
+} 'created new Foo with bar successfully set with a HASH ref';
dies_ok {
Foo->new(bar => 50)
-} '... didnt create a new Foo with bar as a number';
+} 'didnt create a new Foo with bar as a number';
dies_ok {
Foo->new(bar => sub {})
-} '... didnt create a new Foo with bar as a CODE ref';
+} 'didnt create a new Foo with bar as a CODE ref';
{
package Bar;
lives_ok {
$bar->baz('a string')
-} '... set baz successfully with a string';
+} 'set baz successfully with a string';
lives_ok {
$bar->baz(sub { 'a sub' })
-} '... set baz successfully with a CODE ref';
+} 'set baz successfully with a CODE ref';
dies_ok {
$bar->baz(\(my $var1))
-} '... couldnt set baz successfully with a SCALAR ref';
+} 'couldnt set baz successfully with a SCALAR ref';
dies_ok {
$bar->baz({})
-} '... couldnt set bar successfully with a HASH ref';
+} 'couldnt set bar successfully with a HASH ref';
# check the constructor
lives_ok {
Bar->new(baz => 'a string')
-} '... created new Bar with baz successfully set with a string';
+} 'created new Bar with baz successfully set with a string';
lives_ok {
Bar->new(baz => sub { 'a sub' })
-} '... created new Bar with baz successfully set with a CODE ref';
+} 'created new Bar with baz successfully set with a CODE ref';
dies_ok {
Bar->new(baz => \(my $var2))
-} '... didnt create a new Bar with baz as a number';
+} 'didnt create a new Bar with baz as a number';
dies_ok {
Bar->new(baz => {})
-} '... didnt create a new Bar with baz as a HASH ref';
+} 'didnt create a new Bar with baz as a HASH ref';
::lives_ok {
has '+bar' => (default => 'Bar::bar');
- } '... we can change the default attribute option';
+ } 'we can change the default attribute option';
::lives_ok {
has '+baz' => (isa => 'ArrayRef');
- } '... we can add change the isa as long as it is a subtype';
+ } 'we can add change the isa as long as it is a subtype';
::lives_ok {
has '+foo' => (coerce => 1);
- } '... we can change/add coerce as an attribute option';
+ } 'we can change/add coerce as an attribute option';
::lives_ok {
has '+gorch' => (required => 1);
- } '... we can change/add required as an attribute option';
+ } 'we can change/add required as an attribute option';
::lives_ok {
has '+gloum' => (lazy => 1);
- } '... we can change/add lazy as an attribute option';
+ } 'we can change/add lazy as an attribute option';
::lives_ok {
has '+gloum' => (lazy_build => 1);
- } '... we can add lazy_build as an attribute option';
+ } 'we can add lazy_build as an attribute option';
::lives_ok {
has '+bunch_of_stuff' => (isa => 'ArrayRef[Int]');
- } '... extend an attribute with parameterized type';
+ } 'extend an attribute with parameterized type';
::lives_ok {
has '+one_last_one' => (isa => subtype('Ref', where { blessed $_ eq 'CODE' }));
- } '... extend an attribute with anon-subtype';
+ } 'extend an attribute with anon-subtype';
::lives_ok {
has '+one_last_one' => (isa => 'Value');
- } '... now can extend an attribute with a non-subtype';
+ } 'now can extend an attribute with a non-subtype';
::lives_ok {
has '+fleem' => (weak_ref => 1);
- } '... now allowed to add the weak_ref option via inheritance';
+ } 'now allowed to add the weak_ref option via inheritance';
::lives_ok {
has '+bling' => (handles => ['hello']);
- } '... we can add the handles attribute option';
+ } 'we can add the handles attribute option';
# this one will *not* work here ....
::dies_ok {
has '+blang' => (handles => ['hello']);
- } '... we can not alter the handles attribute option';
+ } 'we can not alter the handles attribute option';
::lives_ok {
has '+fail' => (isa => 'Ref');
- } '... can now create an attribute with an improper subtype relation';
+ } 'can now create an attribute with an improper subtype relation';
::dies_ok {
has '+other_fail' => (trigger => sub {});
- } '... cannot create an attribute with an illegal option';
+ } 'cannot create an attribute with an illegal option';
::throws_ok {
has '+does_not_exist' => (isa => 'Str');
- } qr/in Bar/, '... cannot extend a non-existing attribute';
+ } qr/in Bar/, 'cannot extend a non-existing attribute';
}
my $foo = Foo->new;
isa_ok($foo, 'Foo');
-is($foo->foo, undef, '... got the right undef default value');
-lives_ok { $foo->foo('FooString') } '... assigned foo correctly';
-is($foo->foo, 'FooString', '... got the right value for foo');
+is($foo->foo, undef, 'got the right undef default value');
+lives_ok { $foo->foo('FooString') } 'assigned foo correctly';
+is($foo->foo, 'FooString', 'got the right value for foo');
-dies_ok { $foo->foo([]) } '... foo is not coercing (as expected)';
+dies_ok { $foo->foo([]) } 'foo is not coercing (as expected)';
-is($foo->bar, 'Foo::bar', '... got the right default value');
-dies_ok { $foo->bar(10) } '... Foo::bar is a read/only attr';
+is($foo->bar, 'Foo::bar', 'got the right default value');
+dies_ok { $foo->bar(10) } 'Foo::bar is a read/only attr';
-is($foo->baz, undef, '... got the right undef default value');
+is($foo->baz, undef, 'got the right undef default value');
{
my $hash_ref = {};
- lives_ok { $foo->baz($hash_ref) } '... Foo::baz accepts hash refs';
- is($foo->baz, $hash_ref, '... got the right value assigned to baz');
+ lives_ok { $foo->baz($hash_ref) } 'Foo::baz accepts hash refs';
+ is($foo->baz, $hash_ref, 'got the right value assigned to baz');
my $array_ref = [];
- lives_ok { $foo->baz($array_ref) } '... Foo::baz accepts an array ref';
- is($foo->baz, $array_ref, '... got the right value assigned to baz');
+ lives_ok { $foo->baz($array_ref) } 'Foo::baz accepts an array ref';
+ is($foo->baz, $array_ref, 'got the right value assigned to baz');
my $scalar_ref = \(my $var);
- lives_ok { $foo->baz($scalar_ref) } '... Foo::baz accepts scalar ref';
- is($foo->baz, $scalar_ref, '... got the right value assigned to baz');
+ lives_ok { $foo->baz($scalar_ref) } 'Foo::baz accepts scalar ref';
+ is($foo->baz, $scalar_ref, 'got the right value assigned to baz');
- lives_ok { $foo->bunch_of_stuff([qw[one two three]]) } '... Foo::bunch_of_stuff accepts an array of strings';
+ lives_ok { $foo->bunch_of_stuff([qw[one two three]]) } 'Foo::bunch_of_stuff accepts an array of strings';
- lives_ok { $foo->one_last_one(sub { 'Hello World'}) } '... Foo::one_last_one accepts a code ref';
+ lives_ok { $foo->one_last_one(sub { 'Hello World'}) } 'Foo::one_last_one accepts a code ref';
my $code_ref = sub { 1 };
- lives_ok { $foo->baz($code_ref) } '... Foo::baz accepts a code ref';
- is($foo->baz, $code_ref, '... got the right value assigned to baz');
+ lives_ok { $foo->baz($code_ref) } 'Foo::baz accepts a code ref';
+ is($foo->baz, $code_ref, 'got the right value assigned to baz');
}
dies_ok {
Bar->new;
-} '... cannot create Bar without required gorch param';
+} 'cannot create Bar without required gorch param';
my $bar = Bar->new(gorch => 'Bar::gorch');
isa_ok($bar, 'Bar');
isa_ok($bar, 'Foo');
-is($bar->foo, undef, '... got the right undef default value');
-lives_ok { $bar->foo('FooString') } '... assigned foo correctly';
-is($bar->foo, 'FooString', '... got the right value for foo');
-lives_ok { $bar->foo([]) } '... assigned foo correctly';
-is($bar->foo, 'FooArrayRef', '... got the right value for foo');
+is($bar->foo, undef, 'got the right undef default value');
+lives_ok { $bar->foo('FooString') } 'assigned foo correctly';
+is($bar->foo, 'FooString', 'got the right value for foo');
+lives_ok { $bar->foo([]) } 'assigned foo correctly';
+is($bar->foo, 'FooArrayRef', 'got the right value for foo');
-is($bar->gorch, 'Bar::gorch', '... got the right default value');
+is($bar->gorch, 'Bar::gorch', 'got the right default value');
-is($bar->bar, 'Bar::bar', '... got the right default value');
-dies_ok { $bar->bar(10) } '... Bar::bar is a read/only attr';
+is($bar->bar, 'Bar::bar', 'got the right default value');
+dies_ok { $bar->bar(10) } 'Bar::bar is a read/only attr';
-is($bar->baz, undef, '... got the right undef default value');
+is($bar->baz, undef, 'got the right undef default value');
{
my $hash_ref = {};
- dies_ok { $bar->baz($hash_ref) } '... Bar::baz does not accept hash refs';
+ dies_ok { $bar->baz($hash_ref) } 'Bar::baz does not accept hash refs';
my $array_ref = [];
- lives_ok { $bar->baz($array_ref) } '... Bar::baz can accept an array ref';
- is($bar->baz, $array_ref, '... got the right value assigned to baz');
+ lives_ok { $bar->baz($array_ref) } 'Bar::baz can accept an array ref';
+ is($bar->baz, $array_ref, 'got the right value assigned to baz');
my $scalar_ref = \(my $var);
- dies_ok { $bar->baz($scalar_ref) } '... Bar::baz does not accept a scalar ref';
+ dies_ok { $bar->baz($scalar_ref) } 'Bar::baz does not accept a scalar ref';
- lives_ok { $bar->bunch_of_stuff([1, 2, 3]) } '... Bar::bunch_of_stuff accepts an array of ints';
- dies_ok { $bar->bunch_of_stuff([qw[one two three]]) } '... Bar::bunch_of_stuff does not accept an array of strings';
+ lives_ok { $bar->bunch_of_stuff([1, 2, 3]) } 'Bar::bunch_of_stuff accepts an array of ints';
+ dies_ok { $bar->bunch_of_stuff([qw[one two three]]) } 'Bar::bunch_of_stuff does not accept an array of strings';
my $code_ref = sub { 1 };
- dies_ok { $bar->baz($code_ref) } '... Bar::baz does not accept a code ref';
+ dies_ok { $bar->baz($code_ref) } 'Bar::baz does not accept a code ref';
}
# check some meta-stuff
-ok(Bar->meta->has_attribute('foo'), '... Bar has a foo attr');
-ok(Bar->meta->has_attribute('bar'), '... Bar has a bar attr');
-ok(Bar->meta->has_attribute('baz'), '... Bar has a baz attr');
-ok(Bar->meta->has_attribute('gorch'), '... Bar has a gorch attr');
-ok(Bar->meta->has_attribute('gloum'), '... Bar has a gloum attr');
-ok(Bar->meta->has_attribute('bling'), '... Bar has a bling attr');
-ok(Bar->meta->has_attribute('bunch_of_stuff'), '... Bar does have a bunch_of_stuff attr');
-ok(!Bar->meta->has_attribute('blang'), '... Bar has a blang attr');
-ok(Bar->meta->has_attribute('fail'), '... Bar has a fail attr');
-ok(!Bar->meta->has_attribute('other_fail'), '... Bar does not have an other_fail attr');
+ok(Bar->meta->has_attribute('foo'), 'Bar has a foo attr');
+ok(Bar->meta->has_attribute('bar'), 'Bar has a bar attr');
+ok(Bar->meta->has_attribute('baz'), 'Bar has a baz attr');
+ok(Bar->meta->has_attribute('gorch'), 'Bar has a gorch attr');
+ok(Bar->meta->has_attribute('gloum'), 'Bar has a gloum attr');
+ok(Bar->meta->has_attribute('bling'), 'Bar has a bling attr');
+ok(Bar->meta->has_attribute('bunch_of_stuff'), 'Bar does have a bunch_of_stuff attr');
+ok(!Bar->meta->has_attribute('blang'), 'Bar has a blang attr');
+ok(Bar->meta->has_attribute('fail'), 'Bar has a fail attr');
+ok(!Bar->meta->has_attribute('other_fail'), 'Bar does not have an other_fail attr');
isnt(Foo->meta->get_attribute('foo'),
Bar->meta->get_attribute('foo'),
- '... Foo and Bar have different copies of foo');
+ 'Foo and Bar have different copies of foo');
isnt(Foo->meta->get_attribute('bar'),
Bar->meta->get_attribute('bar'),
- '... Foo and Bar have different copies of bar');
+ 'Foo and Bar have different copies of bar');
isnt(Foo->meta->get_attribute('baz'),
Bar->meta->get_attribute('baz'),
- '... Foo and Bar have different copies of baz');
+ 'Foo and Bar have different copies of baz');
isnt(Foo->meta->get_attribute('gorch'),
Bar->meta->get_attribute('gorch'),
- '... Foo and Bar have different copies of gorch');
+ 'Foo and Bar have different copies of gorch');
isnt(Foo->meta->get_attribute('gloum'),
Bar->meta->get_attribute('gloum'),
- '... Foo and Bar have different copies of gloum');
+ 'Foo and Bar have different copies of gloum');
isnt(Foo->meta->get_attribute('bling'),
Bar->meta->get_attribute('bling'),
- '... Foo and Bar have different copies of bling');
+ 'Foo and Bar have different copies of bling');
isnt(Foo->meta->get_attribute('bunch_of_stuff'),
Bar->meta->get_attribute('bunch_of_stuff'),
- '... Foo and Bar have different copies of bunch_of_stuff');
+ 'Foo and Bar have different copies of bunch_of_stuff');
ok(Bar->meta->get_attribute('bar')->has_type_constraint,
- '... Bar::bar inherited the type constraint too');
+ 'Bar::bar inherited the type constraint too');
ok(Bar->meta->get_attribute('baz')->has_type_constraint,
- '... Bar::baz inherited the type constraint too');
+ 'Bar::baz inherited the type constraint too');
is(Bar->meta->get_attribute('bar')->type_constraint->name,
- 'Str', '... Bar::bar inherited the right type constraint too');
+ 'Str', 'Bar::bar inherited the right type constraint too');
is(Foo->meta->get_attribute('baz')->type_constraint->name,
- 'Ref', '... Foo::baz inherited the right type constraint too');
+ 'Ref', 'Foo::baz inherited the right type constraint too');
is(Bar->meta->get_attribute('baz')->type_constraint->name,
- 'ArrayRef', '... Bar::baz inherited the right type constraint too');
+ 'ArrayRef', 'Bar::baz inherited the right type constraint too');
ok(!Foo->meta->get_attribute('gorch')->is_required,
- '... Foo::gorch is not a required attr');
+ 'Foo::gorch is not a required attr');
ok(Bar->meta->get_attribute('gorch')->is_required,
- '... Bar::gorch is a required attr');
+ 'Bar::gorch is a required attr');
is(Foo->meta->get_attribute('bunch_of_stuff')->type_constraint->name,
'ArrayRef',
- '... Foo::bunch_of_stuff is an ArrayRef');
+ 'Foo::bunch_of_stuff is an ArrayRef');
is(Bar->meta->get_attribute('bunch_of_stuff')->type_constraint->name,
'ArrayRef[Int]',
- '... Bar::bunch_of_stuff is an ArrayRef[Int]');
+ 'Bar::bunch_of_stuff is an ArrayRef[Int]');
ok(!Foo->meta->get_attribute('gloum')->is_lazy,
- '... Foo::gloum is not a required attr');
+ 'Foo::gloum is not a required attr');
ok(Bar->meta->get_attribute('gloum')->is_lazy,
- '... Bar::gloum is a required attr');
+ 'Bar::gloum is a required attr');
ok(!Foo->meta->get_attribute('foo')->should_coerce,
- '... Foo::foo should not coerce');
+ 'Foo::foo should not coerce');
ok(Bar->meta->get_attribute('foo')->should_coerce,
- '... Bar::foo should coerce');
+ 'Bar::foo should coerce');
ok(!Foo->meta->get_attribute('bling')->has_handles,
- '... Foo::foo should not handles');
+ 'Foo::foo should not handles');
ok(Bar->meta->get_attribute('bling')->has_handles,
- '... Bar::foo should handles');
+ 'Bar::foo should handles');
my $bar = Bar->new;
isa_ok($bar, 'Bar');
-ok($bar->foo, '... we have something in bar->foo');
+ok($bar->foo, 'we have something in bar->foo');
isa_ok($bar->foo, 'Foo');
my $meth = Bar->meta->get_method('foo_bar');
is($meth->associated_attribute->name, 'foo',
'associated_attribute->name for this method is foo');
-is($bar->foo->bar, 10, '... bar->foo->bar returned the right default');
+is($bar->foo->bar, 10, 'bar->foo->bar returned the right default');
can_ok($bar, 'foo_bar');
-is($bar->foo_bar, 10, '... bar->foo_bar delegated correctly');
+is($bar->foo_bar, 10, 'bar->foo_bar delegated correctly');
# change the value ...
# and make sure the delegation picks it up
-is($bar->foo->bar, 30, '... bar->foo->bar returned the right (changed) value');
-is($bar->foo_bar, 30, '... bar->foo_bar delegated correctly');
+is($bar->foo->bar, 30, 'bar->foo->bar returned the right (changed) value');
+is($bar->foo_bar, 30, 'bar->foo_bar delegated correctly');
# change the value through the delegation ...
# and make sure everyone sees it
-is($bar->foo->bar, 50, '... bar->foo->bar returned the right (changed) value');
-is($bar->foo_bar, 50, '... bar->foo_bar delegated correctly');
+is($bar->foo->bar, 50, 'bar->foo->bar returned the right (changed) value');
+is($bar->foo_bar, 50, 'bar->foo_bar delegated correctly');
# change the object we are delegating too
my $foo = Foo->new(bar => 25);
isa_ok($foo, 'Foo');
-is($foo->bar, 25, '... got the right foo->bar');
+is($foo->bar, 25, 'got the right foo->bar');
lives_ok {
$bar->foo($foo);
-} '... assigned the new Foo to Bar->foo';
+} 'assigned the new Foo to Bar->foo';
-is($bar->foo, $foo, '... assigned bar->foo with the new Foo');
+is($bar->foo, $foo, 'assigned bar->foo with the new Foo');
-is($bar->foo->bar, 25, '... bar->foo->bar returned the right result');
-is($bar->foo_bar, 25, '... and bar->foo_bar delegated correctly again');
+is($bar->foo->bar, 25, 'bar->foo->bar returned the right result');
+is($bar->foo_bar, 25, 'and bar->foo_bar delegated correctly again');
# curried handles
$bar->foo_bar_to_20;
-is($bar->foo_bar, 20, '... correctly curried a single argument');
+is($bar->foo_bar, 20, 'correctly curried a single argument');
# -------------------------------------------------------------------
# ARRAY handles
can_ok($car->engine, 'go');
can_ok($car->engine, 'stop');
-is($car->engine->go, 'Engine::go', '... got the right value from ->engine->go');
-is($car->engine->stop, 'Engine::stop', '... got the right value from ->engine->stop');
+is($car->engine->go, 'Engine::go', 'got the right value from ->engine->go');
+is($car->engine->stop, 'Engine::stop', 'got the right value from ->engine->stop');
can_ok($car, 'go');
can_ok($car, 'stop');
-is($car->go, 'Engine::go', '... got the right value from ->go');
-is($car->stop, 'Engine::stop', '... got the right value from ->stop');
+is($car->go, 'Engine::go', 'got the right value from ->go');
+is($car->stop, 'Engine::stop', 'got the right value from ->stop');
# -------------------------------------------------------------------
# REGEXP handles
can_ok($baz_proxy, 'bar');
can_ok($baz_proxy, 'boo');
- is($baz_proxy->foo, 'Baz::foo', '... got the right proxied return value');
- is($baz_proxy->bar, 'Baz::bar', '... got the right proxied return value');
- is($baz_proxy->boo, 'Baz::boo', '... got the right proxied return value');
+ is($baz_proxy->foo, 'Baz::foo', 'got the right proxied return value');
+ is($baz_proxy->bar, 'Baz::bar', 'got the right proxied return value');
+ is($baz_proxy->boo, 'Baz::boo', 'got the right proxied return value');
}
{
my $baz_proxy = Baz::Proxy2->new;
can_ok($baz_proxy, 'foo');
can_ok($baz_proxy, 'boo');
- is($baz_proxy->foo, 'Baz::foo', '... got the right proxied return value');
- is($baz_proxy->boo, 'Baz::boo', '... got the right proxied return value');
+ is($baz_proxy->foo, 'Baz::foo', 'got the right proxied return value');
+ is($baz_proxy->boo, 'Baz::boo', 'got the right proxied return value');
}
{
my $baz_proxy = Baz::Proxy3->new;
can_ok($baz_proxy, 'bar');
can_ok($baz_proxy, 'boo');
- is($baz_proxy->bar, 'Baz::bar', '... got the right proxied return value');
- is($baz_proxy->boo, 'Baz::boo', '... got the right proxied return value');
+ is($baz_proxy->bar, 'Baz::bar', 'got the right proxied return value');
+ is($baz_proxy->boo, 'Baz::boo', 'got the right proxied return value');
}
# -------------------------------------------------------------------
isa_ok($foo, 'Foo::Thing');
isa_ok($foo->thing, 'Foo::Baz');
- ok($foo->meta->has_method('foo'), '... we have the method we expect');
- ok($foo->meta->has_method('bar'), '... we have the method we expect');
- ok(!$foo->meta->has_method('baz'), '... we dont have the method we expect');
+ ok($foo->meta->has_method('foo'), 'we have the method we expect');
+ ok($foo->meta->has_method('bar'), 'we have the method we expect');
+ ok(!$foo->meta->has_method('baz'), 'we dont have the method we expect');
- is($foo->foo, 'Foo::Baz::FOO', '... got the right value');
- is($foo->bar, 'Foo::Baz::BAR', '... got the right value');
- is($foo->thing->baz, 'Foo::Baz::BAZ', '... got the right value');
+ is($foo->foo, 'Foo::Baz::FOO', 'got the right value');
+ is($foo->bar, 'Foo::Baz::BAR', 'got the right value');
+ is($foo->thing->baz, 'Foo::Baz::BAZ', 'got the right value');
}
# -------------------------------------------------------------------
default => sub { Foo::Autoloaded->new },
handles => qr/bar/
);
- } '... you cannot delegate to AUTOLOADED class with regexp';
+ } 'you cannot delegate to AUTOLOADED class with regexp';
}
# check HASH based delegation w/ AUTOLOAD
my $bar = Bar::Autoloaded->new;
isa_ok($bar, 'Bar::Autoloaded');
- ok($bar->foo, '... we have something in bar->foo');
+ ok($bar->foo, 'we have something in bar->foo');
isa_ok($bar->foo, 'Foo::Autoloaded');
# change the value ...
# and make sure the delegation picks it up
- is($bar->foo->bar, 30, '... bar->foo->bar returned the right (changed) value');
- is($bar->foo_bar, 30, '... bar->foo_bar delegated correctly');
+ is($bar->foo->bar, 30, 'bar->foo->bar returned the right (changed) value');
+ is($bar->foo_bar, 30, 'bar->foo_bar delegated correctly');
# change the value through the delegation ...
# and make sure everyone sees it
- is($bar->foo->bar, 50, '... bar->foo->bar returned the right (changed) value');
- is($bar->foo_bar, 50, '... bar->foo_bar delegated correctly');
+ is($bar->foo->bar, 50, 'bar->foo->bar returned the right (changed) value');
+ is($bar->foo_bar, 50, 'bar->foo_bar delegated correctly');
# change the object we are delegating too
$foo->bar(25);
- is($foo->bar, 25, '... got the right foo->bar');
+ is($foo->bar, 25, 'got the right foo->bar');
lives_ok {
$bar->foo($foo);
- } '... assigned the new Foo to Bar->foo';
+ } 'assigned the new Foo to Bar->foo';
- is($bar->foo, $foo, '... assigned bar->foo with the new Foo');
+ is($bar->foo, $foo, 'assigned bar->foo with the new Foo');
- is($bar->foo->bar, 25, '... bar->foo->bar returned the right result');
- is($bar->foo_bar, 25, '... and bar->foo_bar delegated correctly again');
+ is($bar->foo->bar, 25, 'bar->foo->bar returned the right result');
+ is($bar->foo_bar, 25, 'and bar->foo_bar delegated correctly again');
}
# check ARRAY based delegation w/ AUTOLOAD
my $baz = Baz::Autoloaded->new;
isa_ok($baz, 'Baz::Autoloaded');
- ok($baz->foo, '... we have something in baz->foo');
+ ok($baz->foo, 'we have something in baz->foo');
isa_ok($baz->foo, 'Foo::Autoloaded');
# change the value ...
# and make sure the delegation picks it up
- is($baz->foo->bar, 30, '... baz->foo->bar returned the right (changed) value');
- is($baz->bar, 30, '... baz->foo_bar delegated correctly');
+ is($baz->foo->bar, 30, 'baz->foo->bar returned the right (changed) value');
+ is($baz->bar, 30, 'baz->foo_bar delegated correctly');
# change the value through the delegation ...
# and make sure everyone sees it
- is($baz->foo->bar, 50, '... baz->foo->bar returned the right (changed) value');
- is($baz->bar, 50, '... baz->foo_bar delegated correctly');
+ is($baz->foo->bar, 50, 'baz->foo->bar returned the right (changed) value');
+ is($baz->bar, 50, 'baz->foo_bar delegated correctly');
# change the object we are delegating too
$foo->bar(25);
- is($foo->bar, 25, '... got the right foo->bar');
+ is($foo->bar, 25, 'got the right foo->bar');
lives_ok {
$baz->foo($foo);
- } '... assigned the new Foo to Baz->foo';
+ } 'assigned the new Foo to Baz->foo';
- is($baz->foo, $foo, '... assigned baz->foo with the new Foo');
+ is($baz->foo, $foo, 'assigned baz->foo with the new Foo');
- is($baz->foo->bar, 25, '... baz->foo->bar returned the right result');
- is($baz->bar, 25, '... and baz->foo_bar delegated correctly again');
+ is($baz->foo->bar, 25, 'baz->foo->bar returned the right result');
+ is($baz->bar, 25, 'and baz->foo_bar delegated correctly again');
}
# Check that removing attributes removes their handles methods also.
isa_ok( $p->child_e, "ChildE" );
isa_ok( $p->child_f, "ChildF" );
-ok(!$p->can('child_g'), '... no child_g accessor defined');
+ok(!$p->can('child_g'), 'no child_g accessor defined');
is( $p->parent_method, "p", "parent method" );
my $foo_attr = Test::Attribute::Inline::Documentation->meta->get_attribute('foo');
- ok($foo_attr->has_documentation, '... the foo has docs');
+ ok($foo_attr->has_documentation, 'the foo has docs');
is($foo_attr->documentation,
q{
The 'foo' attribute is my favorite
attribute in the whole wide world.
},
- '... got the foo docs');
+ 'got the foo docs');
}
{
dies_ok {
$test->bad_lazy_attr;
- } '... this does not work';
+ } 'this does not work';
lives_ok {
$test->good_lazy_attr;
- } '... this does not work';
+ } 'this does not work';
}
{
dies_ok {
Test::UndefDefault::Attributes->new;
- } '... default must return a value which passes the type constraint';
+ } 'default must return a value which passes the type constraint';
}
throws_ok {
$moose_obj->a_str( $moose_obj )
} qr/Attribute \(a_str\) does not pass the type constraint because\: Validation failed for 'Str' failed with value OverloadedStr=HASH\(0x.+?\)/,
- '... dies without overloading the string';
+ 'dies without overloading the string';
}
throws_ok {
OverloadBreaker->new;
} qr/Attribute \(a_num\) does not pass the type constraint because\: Validation failed for 'Int' failed with value 7\.5/,
- '... this doesnt trip overload to break anymore ';
+ 'this doesnt trip overload to break anymore ';
lives_ok {
OverloadBreaker->new(a_num => 5);
- } '... this works fine though';
+ } 'this works fine though';
}
dies_ok {
Test::Builder::Attribute::Broken->new;
- } '... no builder, wtf';
+ } 'no builder, wtf';
}
(blessed($_) && $_->isa('Customer') || return) for @$_; 1 }),
auto_deref => 1,
);
- } '... successfully created attr';
+ } 'successfully created attr';
}
{
is_deeply(
[ $firm->customers ],
[ $customer ],
- '... got the right dereferenced value'
+ 'got the right dereferenced value'
);
}
is_deeply(
[ $firm->customers ],
[],
- '... got the right dereferenced value'
+ 'got the right dereferenced value'
);
}
dies_ok {
$autoderef->bar(1, 2, 3);
- } '... its auto-de-ref-ing, not auto-en-ref-ing';
+ } 'its auto-de-ref-ing, not auto-en-ref-ing';
lives_ok {
$autoderef->bar([ 1, 2, 3 ])
- } '... set the results of bar correctly';
+ } 'set the results of bar correctly';
- is_deeply [ $autoderef->bar ], [ 1, 2, 3 ], '... auto-dereffed correctly';
+ is_deeply [ $autoderef->bar ], [ 1, 2, 3 ], 'auto-dereffed correctly';
}
lives_ok {
$r->headers;
-} '... this coerces and passes the type constraint even with lazy';
+} 'this coerces and passes the type constraint even with lazy';
my $c = My::Class->new(bar => 100);
isa_ok($c, 'My::Class');
-is($c->bar, 100, '... got the right value for bar');
-is($c->gorch, 10, '... got the right value for gorch');
+is($c->bar, 100, 'got the right value for bar');
+is($c->gorch, 10, 'got the right value for gorch');
can_ok($c, 'baz');
-is($c->baz, 100, '... got the right value for baz');
+is($c->baz, 100, 'got the right value for baz');
my $bar_attr = $c->meta->get_attribute('bar');
does_ok($bar_attr, 'My::Attribute::Trait');
-ok($bar_attr->has_applied_traits, '... got the applied traits');
-is_deeply($bar_attr->applied_traits, [qw/My::Attribute::Trait/], '... got the applied traits');
+ok($bar_attr->has_applied_traits, 'got the applied traits');
+is_deeply($bar_attr->applied_traits, [qw/My::Attribute::Trait/], 'got the applied traits');
is($bar_attr->foo, "blah", "attr initialized");
my $gorch_attr = $c->meta->get_attribute('gorch');
-ok(!$gorch_attr->does('My::Attribute::Trait'), '... gorch doesnt do the trait');
-ok(!$gorch_attr->has_applied_traits, '... no traits applied');
-is($gorch_attr->applied_traits, undef, '... no traits applied');
+ok(!$gorch_attr->does('My::Attribute::Trait'), 'gorch doesnt do the trait');
+ok(!$gorch_attr->has_applied_traits, 'no traits applied');
+is($gorch_attr->applied_traits, undef, 'no traits applied');
my $c = My::Class->new(bar => 100);
isa_ok($c, 'My::Class');
-is($c->bar, 100, '... got the right value for bar');
+is($c->bar, 100, 'got the right value for bar');
can_ok($c, 'baz') and
-is($c->baz, 100, '... got the right value for baz');
+is($c->baz, 100, 'got the right value for baz');
my $bar_attr = $c->meta->get_attribute('bar');
does_ok($bar_attr, 'My::Attribute::Trait');
my $quux = My::Derived::Class->new(bar => 1000);
-is($quux->bar, 1000, '... got the right value for bar');
+is($quux->bar, 1000, 'got the right value for bar');
can_ok($quux, 'baz');
-is($quux->baz, 1000, '... got the right value for baz');
+is($quux->baz, 1000, 'got the right value for baz');
my $derived_bar_attr = $quux->meta->get_attribute("bar");
does_ok($derived_bar_attr, 'My::Attribute::Trait' );
ok(!$derived_bar_attr->does('Fictional'), "attr->does returns false for nonexistent roles");
can_ok($quux, 'additional_method');
-is(eval { $quux->additional_method }, 42, '... got the right value for additional_method');
+is(eval { $quux->additional_method }, 42, 'got the right value for additional_method');
my $c = My::Class->new(bar => 100);
isa_ok($c, 'My::Class');
-is($c->bar, 100, '... got the right value for bar');
+is($c->bar, 100, 'got the right value for bar');
can_ok($c, 'baz');
-is($c->baz, 100, '... got the right value for baz');
+is($c->baz, 100, 'got the right value for baz');
isa_ok($c->meta->get_attribute('bar'), 'My::Meta::Attribute::DefaultReadOnly');
does_ok($c->meta->get_attribute('bar'), 'My::Attribute::Trait');
-is($c->meta->get_attribute('bar')->_is_metadata, 'ro', '... got the right metaclass customization');
+is($c->meta->get_attribute('bar')->_is_metadata, 'ro', 'got the right metaclass customization');
init_arg => undef,
);
};
- ::ok(!$@, '... created the attr okay');
+ ::ok(!$@, 'created the attr okay');
}
{
my ($self, $value, $callback, $attr) = @_;
::isa_ok($attr, 'Moose::Meta::Attribute');
- ::is($attr->name, 'foo', '... got the right name');
+ ::is($attr->name, 'foo', 'got the right name');
$callback->($value * 2);
},
my ($self, $value, $callback, $attr) = @_;
::isa_ok($attr, 'Moose::Meta::Attribute');
- ::is($attr->name, 'lazy_foo', '... got the right name');
+ ::is($attr->name, 'lazy_foo', 'got the right name');
$callback->($value * 2);
},
my ($self, $value, $callback, $attr) = @_;
::isa_ok($attr, 'Moose::Meta::Attribute');
- ::is($attr->name, 'lazy_foo_w_type', '... got the right name');
+ ::is($attr->name, 'lazy_foo_w_type', 'got the right name');
$callback->($value * 2);
},
my ($self, $value, $callback, $attr) = @_;
::isa_ok($attr, 'Moose::Meta::Attribute');
- ::is($attr->name, 'lazy_foo_builder', '... got the right name');
+ ::is($attr->name, 'lazy_foo_builder', 'got the right name');
$callback->($value * 2);
},
my ($self, $value, $callback, $attr) = @_;
::isa_ok($attr, 'Moose::Meta::Attribute');
- ::is($attr->name, 'lazy_foo_builder_w_type', '... got the right name');
+ ::is($attr->name, 'lazy_foo_builder_w_type', 'got the right name');
$callback->($value * 2);
},
my ($self, $value, $callback, $attr) = @_;
::isa_ok($attr, 'Moose::Meta::Attribute');
- ::is($attr->name, 'foo', '... got the right name');
+ ::is($attr->name, 'foo', 'got the right name');
$callback->($value * 2);
},
my ($self, $value, $callback, $attr) = @_;
::isa_ok($attr, 'Moose::Meta::Attribute');
- ::is($attr->name, 'foo', '... got the right name');
+ ::is($attr->name, 'foo', 'got the right name');
$callback->("Hello $value World");
},
dies_ok {
Fail::Bar->new(foo => 10)
-} '... this fails, because initializer returns a bad type';
+} 'this fails, because initializer returns a bad type';
coerce => 1,
trigger => sub {
my ( $self, $val ) = @_;
- ::pass('... trigger is being called');
+ ::pass('trigger is being called');
::isa_ok( $self->closing_date, 'Fake::DateTime' );
::isa_ok( $val, 'Fake::DateTime' );
}
}
Mortgage->meta->make_immutable;
-ok( Mortgage->meta->is_immutable, '... Mortgage is now immutable' );
+ok( Mortgage->meta->is_immutable, 'Mortgage is now immutable' );
{
my $mtg = Mortgage->new( closing_date => 'yesterday' );
$_ eq 'my_legal_option'
} $bar_attr->legal_options_for_inheritance;
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');
+ 'added my_legal_option as legal option for inheritance' );
+is($bar_attr->my_legal_option->(), 'Bar::B', 'overloaded my_legal_option');
isa_ok($foo, 'Foo');
isa_ok($foo->bar, 'Bar');
isa_ok($foo->bar->baz, 'Baz');
-is($foo->bar->baz->hello, 'World', '... this all worked fine');
+is($foo->bar->baz->hello, 'World', 'this all worked fine');
isa_ok($foo, 'Foo::Extended');
isa_ok($foo, 'Foo');
-ok(!$foo->test, '... the test value has not been changed');
+ok(!$foo->test, 'the test value has not been changed');
-is($foo->baz, 'Bar::baz', '... got the right delegated method');
+is($foo->baz, 'Bar::baz', 'got the right delegated method');
-ok($foo->test, '... the test value has now been changed');
+ok($foo->test, 'the test value has now been changed');
isa_ok($foo_role, 'Moose::Meta::Role');
isa_ok($foo_role, 'Class::MOP::Module');
-is($foo_role->name, 'FooRole', '... got the right name of FooRole');
-is($foo_role->version, '0.01', '... got the right version of FooRole');
+is($foo_role->name, 'FooRole', 'got the right name of FooRole');
+is($foo_role->version, '0.01', 'got the right version of FooRole');
# methods ...
-ok($foo_role->has_method('foo'), '... FooRole has the foo method');
-is($foo_role->get_method('foo')->body, \&FooRole::foo, '... FooRole got the foo method');
+ok($foo_role->has_method('foo'), 'FooRole has the foo method');
+is($foo_role->get_method('foo')->body, \&FooRole::foo, 'FooRole got the foo method');
isa_ok($foo_role->get_method('foo'), 'Moose::Meta::Role::Method');
is_deeply(
[ $foo_role->get_method_list() ],
[ 'foo' ],
- '... got the right method list');
+ 'got the right method list');
# attributes ...
is_deeply(
[ $foo_role->get_attribute_list() ],
[],
- '... got the right attribute list');
+ 'got the right attribute list');
-ok(!$foo_role->has_attribute('bar'), '... FooRole does not have the bar attribute');
+ok(!$foo_role->has_attribute('bar'), 'FooRole does not have the bar attribute');
lives_ok {
$foo_role->add_attribute('bar' => (is => 'rw', isa => 'Foo'));
-} '... added the bar attribute okay';
+} 'added the bar attribute okay';
is_deeply(
[ $foo_role->get_attribute_list() ],
[ 'bar' ],
- '... got the right attribute list');
+ 'got the right attribute list');
-ok($foo_role->has_attribute('bar'), '... FooRole does have the bar attribute');
+ok($foo_role->has_attribute('bar'), 'FooRole does have the bar attribute');
is_deeply(
$foo_role->get_attribute('bar'),
{ is => 'rw', isa => 'Foo' },
- '... got the correct description of the bar attribute');
+ 'got the correct description of the bar attribute');
lives_ok {
$foo_role->add_attribute('baz' => (is => 'ro'));
-} '... added the baz attribute okay';
+} 'added the baz attribute okay';
is_deeply(
[ sort $foo_role->get_attribute_list() ],
[ 'bar', 'baz' ],
- '... got the right attribute list');
+ 'got the right attribute list');
-ok($foo_role->has_attribute('baz'), '... FooRole does have the baz attribute');
+ok($foo_role->has_attribute('baz'), 'FooRole does have the baz attribute');
is_deeply(
$foo_role->get_attribute('baz'),
{ is => 'ro' },
- '... got the correct description of the baz attribute');
+ 'got the correct description of the baz attribute');
lives_ok {
$foo_role->remove_attribute('bar');
-} '... removed the bar attribute okay';
+} 'removed the bar attribute okay';
is_deeply(
[ $foo_role->get_attribute_list() ],
[ 'baz' ],
- '... got the right attribute list');
+ 'got the right attribute list');
-ok(!$foo_role->has_attribute('bar'), '... FooRole does not have the bar attribute');
-ok($foo_role->has_attribute('baz'), '... FooRole does still have the baz attribute');
+ok(!$foo_role->has_attribute('bar'), 'FooRole does not have the bar attribute');
+ok($foo_role->has_attribute('baz'), 'FooRole does still have the baz attribute');
# method modifiers
-ok(!$foo_role->has_before_method_modifiers('boo'), '... no boo:before modifier');
+ok(!$foo_role->has_before_method_modifiers('boo'), 'no boo:before modifier');
my $method = sub { "FooRole::boo:before" };
lives_ok {
$foo_role->add_before_method_modifier('boo' => $method);
-} '... added a method modifier okay';
+} 'added a method modifier okay';
-ok($foo_role->has_before_method_modifiers('boo'), '... now we have a boo:before modifier');
-is(($foo_role->get_before_method_modifiers('boo'))[0], $method, '... got the right method back');
+ok($foo_role->has_before_method_modifiers('boo'), 'now we have a boo:before modifier');
+is(($foo_role->get_before_method_modifiers('boo'))[0], $method, 'got the right method back');
is_deeply(
[ $foo_role->get_method_modifier_list('before') ],
[ 'boo' ],
- '... got the right list of before method modifiers');
+ 'got the right list of before method modifiers');
override 'bling' => sub { "FooRole::bling:override" };
override 'fling' => sub { "FooRole::fling:override" };
- ::dies_ok { extends() } '... extends() is not supported';
- ::dies_ok { augment() } '... augment() is not supported';
- ::dies_ok { inner() } '... inner() is not supported';
+ ::dies_ok { extends() } 'extends() is not supported';
+ ::dies_ok { augment() } 'augment() is not supported';
+ ::dies_ok { inner() } 'inner() is not supported';
no Moose::Role;
}
isa_ok($foo_role, 'Moose::Meta::Role');
isa_ok($foo_role, 'Class::MOP::Module');
-is($foo_role->name, 'FooRole', '... got the right name of FooRole');
-is($foo_role->version, '0.01', '... got the right version of FooRole');
+is($foo_role->name, 'FooRole', 'got the right name of FooRole');
+is($foo_role->version, '0.01', 'got the right version of FooRole');
# methods ...
-ok($foo_role->has_method('foo'), '... FooRole has the foo method');
-is($foo_role->get_method('foo')->body, \&FooRole::foo, '... FooRole got the foo method');
+ok($foo_role->has_method('foo'), 'FooRole has the foo method');
+is($foo_role->get_method('foo')->body, \&FooRole::foo, 'FooRole got the foo method');
isa_ok($foo_role->get_method('foo'), 'Moose::Meta::Role::Method');
-ok($foo_role->has_method('boo'), '... FooRole has the boo method');
-is($foo_role->get_method('boo')->body, \&FooRole::boo, '... FooRole got the boo method');
+ok($foo_role->has_method('boo'), 'FooRole has the boo method');
+is($foo_role->get_method('boo')->body, \&FooRole::boo, 'FooRole got the boo method');
isa_ok($foo_role->get_method('boo'), 'Moose::Meta::Role::Method');
is_deeply(
[ sort $foo_role->get_method_list() ],
[ 'boo', 'foo', 'meta' ],
- '... got the right method list');
+ 'got the right method list');
ok(FooRole->can('foo'), "locally defined methods are still there");
ok(!FooRole->can('has'), "sugar was unimported");
is_deeply(
[ sort $foo_role->get_attribute_list() ],
[ 'bar', 'baz' ],
- '... got the right attribute list');
+ 'got the right attribute list');
-ok($foo_role->has_attribute('bar'), '... FooRole does have the bar attribute');
+ok($foo_role->has_attribute('bar'), 'FooRole does have the bar attribute');
my $bar_attr = $foo_role->get_attribute('bar');
is($bar_attr->{is}, 'rw',
is($bar_attr->{definition_context}->{package}, 'FooRole',
'bar was defined in FooRole');
-ok($foo_role->has_attribute('baz'), '... FooRole does have the baz attribute');
+ok($foo_role->has_attribute('baz'), 'FooRole does have the baz attribute');
my $baz_attr = $foo_role->get_attribute('baz');
is($baz_attr->{is}, 'ro',
# method modifiers
-ok($foo_role->has_before_method_modifiers('boo'), '... now we have a boo:before modifier');
+ok($foo_role->has_before_method_modifiers('boo'), 'now we have a boo:before modifier');
is(($foo_role->get_before_method_modifiers('boo'))[0]->(),
"FooRole::boo:before",
- '... got the right method back');
+ 'got the right method back');
is_deeply(
[ $foo_role->get_method_modifier_list('before') ],
[ 'boo' ],
- '... got the right list of before method modifiers');
+ 'got the right list of before method modifiers');
-ok($foo_role->has_after_method_modifiers('boo'), '... now we have a boo:after modifier');
+ok($foo_role->has_after_method_modifiers('boo'), 'now we have a boo:after modifier');
is(($foo_role->get_after_method_modifiers('boo'))[0]->(),
"FooRole::boo:after1",
- '... got the right method back');
+ 'got the right method back');
is(($foo_role->get_after_method_modifiers('boo'))[1]->(),
"FooRole::boo:after2",
- '... got the right method back');
+ 'got the right method back');
is_deeply(
[ $foo_role->get_method_modifier_list('after') ],
[ 'boo' ],
- '... got the right list of after method modifiers');
+ 'got the right list of after method modifiers');
-ok($foo_role->has_around_method_modifiers('boo'), '... now we have a boo:around modifier');
+ok($foo_role->has_around_method_modifiers('boo'), 'now we have a boo:around modifier');
is(($foo_role->get_around_method_modifiers('boo'))[0]->(),
"FooRole::boo:around",
- '... got the right method back');
+ 'got the right method back');
is_deeply(
[ $foo_role->get_method_modifier_list('around') ],
[ 'boo' ],
- '... got the right list of around method modifiers');
+ 'got the right list of around method modifiers');
## overrides
-ok($foo_role->has_override_method_modifier('bling'), '... now we have a bling:override modifier');
+ok($foo_role->has_override_method_modifier('bling'), 'now we have a bling:override modifier');
is($foo_role->get_override_method_modifier('bling')->(),
"FooRole::bling:override",
- '... got the right method back');
+ 'got the right method back');
-ok($foo_role->has_override_method_modifier('fling'), '... now we have a fling:override modifier');
+ok($foo_role->has_override_method_modifier('fling'), 'now we have a fling:override modifier');
is($foo_role->get_override_method_modifier('fling')->(),
"FooRole::fling:override",
- '... got the right method back');
+ 'got the right method back');
is_deeply(
[ sort $foo_role->get_method_modifier_list('override') ],
[ 'bling', 'fling' ],
- '... got the right list of override method modifiers');
+ 'got the right list of override method modifiers');
dies_ok {
$foo_class_meta->does_role();
}
-'... does_role requires a role name';
+'does_role requires a role name';
dies_ok {
$foo_class_meta->add_role();
}
-'... apply_role requires a role';
+'apply_role requires a role';
dies_ok {
$foo_class_meta->add_role( bless( {} => 'Fail' ) );
}
-'... apply_role requires a role';
+'apply_role requires a role';
ok( $foo_class_meta->does_role('FooRole'),
- '... the FooClass->meta does_role FooRole' );
+ 'the FooClass->meta does_role FooRole' );
ok( !$foo_class_meta->does_role('OtherRole'),
- '... the FooClass->meta !does_role OtherRole' );
+ 'the FooClass->meta !does_role OtherRole' );
ok( $foobar_class_meta->does_role('FooRole'),
- '... the FooBarClass->meta does_role FooRole' );
+ 'the FooBarClass->meta does_role FooRole' );
ok( $foobar_class_meta->does_role('BarRole'),
- '... the FooBarClass->meta does_role BarRole' );
+ 'the FooBarClass->meta does_role BarRole' );
ok( !$foobar_class_meta->does_role('OtherRole'),
- '... the FooBarClass->meta !does_role OtherRole' );
+ 'the FooBarClass->meta !does_role OtherRole' );
foreach my $method_name (qw(bar baz foo boo blau goo)) {
ok( $foo_class_meta->has_method($method_name),
- '... FooClass has the method ' . $method_name );
+ 'FooClass has the method ' . $method_name );
ok( $foobar_class_meta->has_method($method_name),
- '... FooBarClass has the method ' . $method_name );
+ 'FooBarClass has the method ' . $method_name );
}
ok( !$foo_class_meta->has_method('woot'),
- '... FooClass lacks the method woot' );
+ 'FooClass lacks the method woot' );
ok( $foobar_class_meta->has_method('woot'),
- '... FooBarClass has the method woot' );
+ 'FooBarClass has the method woot' );
foreach my $attr_name (qw(bar baz)) {
ok( $foo_class_meta->has_attribute($attr_name),
- '... FooClass has the attribute ' . $attr_name );
+ 'FooClass has the attribute ' . $attr_name );
ok( $foobar_class_meta->has_attribute($attr_name),
- '... FooBarClass has the attribute ' . $attr_name );
+ 'FooBarClass has the attribute ' . $attr_name );
}
can_ok( 'FooClass', 'does' );
-ok( FooClass->does('FooRole'), '... the FooClass does FooRole' );
-ok( !FooClass->does('BarRole'), '... the FooClass does not do BarRole' );
-ok( !FooClass->does('OtherRole'), '... the FooClass does not do OtherRole' );
+ok( FooClass->does('FooRole'), 'the FooClass does FooRole' );
+ok( !FooClass->does('BarRole'), 'the FooClass does not do BarRole' );
+ok( !FooClass->does('OtherRole'), 'the FooClass does not do OtherRole' );
can_ok( 'FooBarClass', 'does' );
-ok( FooBarClass->does('FooRole'), '... the FooClass does FooRole' );
-ok( FooBarClass->does('BarRole'), '... the FooBarClass does FooBarRole' );
+ok( FooBarClass->does('FooRole'), 'the FooClass does FooRole' );
+ok( FooBarClass->does('BarRole'), 'the FooBarClass does FooBarRole' );
ok( !FooBarClass->does('OtherRole'),
- '... the FooBarClass does not do OtherRole' );
+ 'the FooBarClass does not do OtherRole' );
my $foo = FooClass->new();
isa_ok( $foo, 'FooClass' );
my $foobar = FooBarClass->new();
isa_ok( $foobar, 'FooBarClass' );
-is( $foo->goo, 'FooClass::goo', '... got the right value of goo' );
-is( $foobar->goo, 'FooRole::goo', '... got the right value of goo' );
+is( $foo->goo, 'FooClass::goo', 'got the right value of goo' );
+is( $foobar->goo, 'FooRole::goo', 'got the right value of goo' );
is( $foo->boo, 'FooRole::boo -> BarClass::boo',
- '... got the right value from ->boo' );
+ 'got the right value from ->boo' );
is( $foobar->boo, 'FooRole::boo -> FooRole::boo -> BarClass::boo',
- '... got the right value from ->boo (double wrapped)' );
+ 'got the right value from ->boo (double wrapped)' );
is( $foo->blau, 'FooRole::blau -> FooClass::blau',
- '... got the right value from ->blau' );
+ 'got the right value from ->blau' );
is( $foobar->blau, 'FooRole::blau -> FooRole::blau -> FooClass::blau',
- '... got the right value from ->blau' );
+ 'got the right value from ->blau' );
foreach my $foo ( $foo, $foobar ) {
can_ok( $foo, 'does' );
- ok( $foo->does('FooRole'), '... an instance of FooClass does FooRole' );
+ ok( $foo->does('FooRole'), 'an instance of FooClass does FooRole' );
ok( !$foo->does('OtherRole'),
- '... and instance of FooClass does not do OtherRole' );
+ 'and instance of FooClass does not do OtherRole' );
can_ok( $foobar, 'does' );
ok( $foobar->does('FooRole'),
- '... an instance of FooBarClass does FooRole' );
+ 'an instance of FooBarClass does FooRole' );
ok( $foobar->does('BarRole'),
- '... an instance of FooBarClass does BarRole' );
+ 'an instance of FooBarClass does BarRole' );
ok( !$foobar->does('OtherRole'),
- '... and instance of FooBarClass does not do OtherRole' );
+ 'and instance of FooBarClass does not do OtherRole' );
for my $method (qw/bar baz foo boo goo blau/) {
can_ok( $foo, $method );
}
- is( $foo->foo, 'FooRole::foo', '... got the right value of foo' );
+ is( $foo->foo, 'FooRole::foo', 'got the right value of foo' );
- ok( !defined( $foo->baz ), '... $foo->baz is undefined' );
- ok( !defined( $foo->bar ), '... $foo->bar is undefined' );
+ ok( !defined( $foo->baz ), '$foo->baz is undefined' );
+ ok( !defined( $foo->bar ), '$foo->bar is undefined' );
dies_ok {
$foo->baz(1);
}
- '... baz is a read-only accessor';
+ 'baz is a read-only accessor';
dies_ok {
$foo->bar(1);
}
- '... bar is a read-write accessor with a type constraint';
+ 'bar is a read-write accessor with a type constraint';
my $foo2 = FooClass->new();
isa_ok( $foo2, 'FooClass' );
lives_ok {
$foo->bar($foo2);
}
- '... bar is a read-write accessor with a type constraint';
+ 'bar is a read-write accessor with a type constraint';
- is( $foo->bar, $foo2, '... got the right value for bar now' );
+ is( $foo->bar, $foo2, 'got the right value for bar now' );
}
is_deeply(
[ sort Foo::Role->meta->get_required_method_list ],
['foo'],
- '... the Foo::Role has a required method (foo)'
+ 'the Foo::Role has a required method (foo)'
);
# classes which does not implement required method
use Moose;
::dies_ok { with('Foo::Role') }
- '... no foo method implemented by Foo::Class';
+ 'no foo method implemented by Foo::Class';
}
# class which does implement required method
use Moose;
::dies_ok { with('Foo::Class') }
- '... cannot consume a class, it must be a role';
+ 'cannot consume a class, it must be a role';
::lives_ok { with('Foo::Role') }
- '... has a foo method implemented by Bar::Class';
+ 'has a foo method implemented by Bar::Class';
sub foo {'Bar::Class::foo'}
}
use Moose::Role;
::lives_ok { with('Foo::Role') }
- '... has a foo method implemented by Bar::Role';
+ 'has a foo method implemented by Bar::Role';
sub foo {'Bar::Role::foo'}
}
is_deeply(
[ sort Bar::Role->meta->get_required_method_list ],
[],
- '... the Bar::Role has not inherited the required method from Foo::Role'
+ 'the Bar::Role has not inherited the required method from Foo::Role'
);
# role which does not implement required method
use Moose::Role;
::lives_ok { with('Foo::Role') }
- '... no foo method implemented by Baz::Role';
+ 'no foo method implemented by Baz::Role';
}
is_deeply(
[ sort Baz::Role->meta->get_required_method_list ],
['foo'],
- '... the Baz::Role has inherited the required method from Foo::Role'
+ 'the Baz::Role has inherited the required method from Foo::Role'
);
# classes which does not implement required method
use Moose;
::dies_ok { with('Baz::Role') }
- '... no foo method implemented by Baz::Class2';
+ 'no foo method implemented by Baz::Class2';
}
# class which does implement required method
use Moose;
::lives_ok { with('Baz::Role') }
- '... has a foo method implemented by Baz::Class2';
+ 'has a foo method implemented by Baz::Class2';
sub foo {'Baz::Class2::foo'}
}
::lives_ok {
with 'Role::Foo', 'Role::Bar';
- } '... our mutually recursive roles combine okay';
+ } 'our mutually recursive roles combine okay';
package My::Test2;
use Moose;
::lives_ok {
with 'Role::Bar', 'Role::Foo';
- } '... our mutually recursive roles combine okay (no matter what order)';
+ } 'our mutually recursive roles combine okay (no matter what order)';
}
my $test1 = My::Test1->new;
isa_ok($test1, 'My::Test1');
-ok($test1->does('Role::Foo'), '... $test1 does Role::Foo');
-ok($test1->does('Role::Bar'), '... $test1 does Role::Bar');
+ok($test1->does('Role::Foo'), '$test1 does Role::Foo');
+ok($test1->does('Role::Bar'), '$test1 does Role::Bar');
can_ok($test1, 'foo');
can_ok($test1, 'bar');
-is($test1->foo, 'Role::Bar::foo', '... $test1->foo worked');
-is($test1->bar, 'Role::Foo::bar', '... $test1->bar worked');
+is($test1->foo, 'Role::Bar::foo', '$test1->foo worked');
+is($test1->bar, 'Role::Foo::bar', '$test1->bar worked');
my $test2 = My::Test2->new;
isa_ok($test2, 'My::Test2');
-ok($test2->does('Role::Foo'), '... $test2 does Role::Foo');
-ok($test2->does('Role::Bar'), '... $test2 does Role::Bar');
+ok($test2->does('Role::Foo'), '$test2 does Role::Foo');
+ok($test2->does('Role::Bar'), '$test2 does Role::Bar');
can_ok($test2, 'foo');
can_ok($test2, 'bar');
-is($test2->foo, 'Role::Bar::foo', '... $test2->foo worked');
-is($test2->bar, 'Role::Foo::bar', '... $test2->bar worked');
+is($test2->foo, 'Role::Bar::foo', '$test2->foo worked');
+is($test2->bar, 'Role::Foo::bar', '$test2->bar worked');
# check some meta-stuff
-ok(Role::Foo->meta->has_method('bar'), '... it still has the bar method');
-ok(Role::Foo->meta->requires_method('foo'), '... it still has the required foo method');
+ok(Role::Foo->meta->has_method('bar'), 'it still has the bar method');
+ok(Role::Foo->meta->requires_method('foo'), 'it still has the required foo method');
-ok(Role::Bar->meta->has_method('foo'), '... it still has the foo method');
-ok(Role::Bar->meta->requires_method('bar'), '... it still has the required bar method');
+ok(Role::Bar->meta->has_method('foo'), 'it still has the foo method');
+ok(Role::Bar->meta->requires_method('bar'), 'it still has the required bar method');
=pod
::throws_ok {
with 'Role::Bling', 'Role::Bling::Bling';
- } qr/Due to a method name conflict in roles 'Role::Bling' and 'Role::Bling::Bling', the method 'bling' must be implemented or excluded by 'My::Test3'/, '... role methods conflict and method was required';
+ } qr/Due to a method name conflict in roles 'Role::Bling' and 'Role::Bling::Bling', the method 'bling' must be implemented or excluded by 'My::Test3'/, 'role methods conflict and method was required';
package My::Test4;
use Moose;
::lives_ok {
with 'Role::Bling';
with 'Role::Bling::Bling';
- } '... role methods didnt conflict when manually combined';
+ } 'role methods didnt conflict when manually combined';
package My::Test5;
use Moose;
::lives_ok {
with 'Role::Bling::Bling';
with 'Role::Bling';
- } '... role methods didnt conflict when manually combined (in opposite order)';
+ } 'role methods didnt conflict when manually combined (in opposite order)';
package My::Test6;
use Moose;
::lives_ok {
with 'Role::Bling::Bling', 'Role::Bling';
- } '... role methods didnt conflict when manually resolved';
+ } 'role methods didnt conflict when manually resolved';
sub bling { 'My::Test6::bling' }
}
-ok(!My::Test3->meta->has_method('bling'), '... we didnt get any methods in the conflict');
-ok(My::Test4->meta->has_method('bling'), '... we did get the method when manually dealt with');
-ok(My::Test5->meta->has_method('bling'), '... we did get the method when manually dealt with');
-ok(My::Test6->meta->has_method('bling'), '... we did get the method when manually dealt with');
+ok(!My::Test3->meta->has_method('bling'), 'we didnt get any methods in the conflict');
+ok(My::Test4->meta->has_method('bling'), 'we did get the method when manually dealt with');
+ok(My::Test5->meta->has_method('bling'), 'we did get the method when manually dealt with');
+ok(My::Test6->meta->has_method('bling'), 'we did get the method when manually dealt with');
-ok(!My::Test3->does('Role::Bling'), '... our class does() the correct roles');
-ok(!My::Test3->does('Role::Bling::Bling'), '... our class does() the correct roles');
-ok(My::Test4->does('Role::Bling'), '... our class does() the correct roles');
-ok(My::Test4->does('Role::Bling::Bling'), '... our class does() the correct roles');
-ok(My::Test5->does('Role::Bling'), '... our class does() the correct roles');
-ok(My::Test5->does('Role::Bling::Bling'), '... our class does() the correct roles');
-ok(My::Test6->does('Role::Bling'), '... our class does() the correct roles');
-ok(My::Test6->does('Role::Bling::Bling'), '... our class does() the correct roles');
+ok(!My::Test3->does('Role::Bling'), 'our class does() the correct roles');
+ok(!My::Test3->does('Role::Bling::Bling'), 'our class does() the correct roles');
+ok(My::Test4->does('Role::Bling'), 'our class does() the correct roles');
+ok(My::Test4->does('Role::Bling::Bling'), 'our class does() the correct roles');
+ok(My::Test5->does('Role::Bling'), 'our class does() the correct roles');
+ok(My::Test5->does('Role::Bling::Bling'), 'our class does() the correct roles');
+ok(My::Test6->does('Role::Bling'), 'our class does() the correct roles');
+ok(My::Test6->does('Role::Bling::Bling'), 'our class does() the correct roles');
-is(My::Test4->bling, 'Role::Bling::bling', '... and we got the first method that was added');
-is(My::Test5->bling, 'Role::Bling::Bling::bling', '... and we got the first method that was added');
-is(My::Test6->bling, 'My::Test6::bling', '... and we got the local method');
+is(My::Test4->bling, 'Role::Bling::bling', 'and we got the first method that was added');
+is(My::Test5->bling, 'Role::Bling::Bling::bling', 'and we got the first method that was added');
+is(My::Test6->bling, 'My::Test6::bling', 'and we got the local method');
# check how this affects role compostion
sub bling { 'Role::Bling::Bling::Bling::bling' }
}
-ok(Role::Bling::Bling->meta->has_method('bling'), '... still got the bling method in Role::Bling::Bling');
-ok(Role::Bling::Bling->meta->does_role('Role::Bling::Bling'), '... our role correctly does() the other role');
-ok(Role::Bling::Bling::Bling->meta->has_method('bling'), '... dont have the bling method in Role::Bling::Bling::Bling');
+ok(Role::Bling::Bling->meta->has_method('bling'), 'still got the bling method in Role::Bling::Bling');
+ok(Role::Bling::Bling->meta->does_role('Role::Bling::Bling'), 'our role correctly does() the other role');
+ok(Role::Bling::Bling::Bling->meta->has_method('bling'), 'dont have the bling method in Role::Bling::Bling::Bling');
is(Role::Bling::Bling::Bling->meta->get_method('bling')->(),
'Role::Bling::Bling::Bling::bling',
- '... still got the bling method in Role::Bling::Bling::Bling');
+ 'still got the bling method in Role::Bling::Bling::Bling');
=pod
::throws_ok {
with 'Role::Boo', 'Role::Boo::Hoo';
} qr/We have encountered an attribute conflict/,
- '... role attrs conflict and method was required';
+ 'role attrs conflict and method was required';
package My::Test8;
use Moose;
::lives_ok {
with 'Role::Boo';
with 'Role::Boo::Hoo';
- } '... role attrs didnt conflict when manually combined';
+ } 'role attrs didnt conflict when manually combined';
package My::Test9;
use Moose;
::lives_ok {
with 'Role::Boo::Hoo';
with 'Role::Boo';
- } '... role attrs didnt conflict when manually combined';
+ } 'role attrs didnt conflict when manually combined';
package My::Test10;
use Moose;
::throws_ok {
with 'Role::Boo', 'Role::Boo::Hoo';
} qr/We have encountered an attribute conflict/,
- '... role attrs conflict and cannot be manually disambiguted';
+ 'role attrs conflict and cannot be manually disambiguted';
}
-ok(!My::Test7->meta->has_attribute('ghost'), '... we didnt get any attributes in the conflict');
-ok(My::Test8->meta->has_attribute('ghost'), '... we did get an attributes when manually composed');
-ok(My::Test9->meta->has_attribute('ghost'), '... we did get an attributes when manually composed');
-ok(My::Test10->meta->has_attribute('ghost'), '... we did still have an attribute ghost (conflict does not mess with class)');
+ok(!My::Test7->meta->has_attribute('ghost'), 'we didnt get any attributes in the conflict');
+ok(My::Test8->meta->has_attribute('ghost'), 'we did get an attributes when manually composed');
+ok(My::Test9->meta->has_attribute('ghost'), 'we did get an attributes when manually composed');
+ok(My::Test10->meta->has_attribute('ghost'), 'we did still have an attribute ghost (conflict does not mess with class)');
-ok(!My::Test7->does('Role::Boo'), '... our class does() the correct roles');
-ok(!My::Test7->does('Role::Boo::Hoo'), '... our class does() the correct roles');
-ok(My::Test8->does('Role::Boo'), '... our class does() the correct roles');
-ok(My::Test8->does('Role::Boo::Hoo'), '... our class does() the correct roles');
-ok(My::Test9->does('Role::Boo'), '... our class does() the correct roles');
-ok(My::Test9->does('Role::Boo::Hoo'), '... our class does() the correct roles');
-ok(!My::Test10->does('Role::Boo'), '... our class does() the correct roles');
-ok(!My::Test10->does('Role::Boo::Hoo'), '... our class does() the correct roles');
+ok(!My::Test7->does('Role::Boo'), 'our class does() the correct roles');
+ok(!My::Test7->does('Role::Boo::Hoo'), 'our class does() the correct roles');
+ok(My::Test8->does('Role::Boo'), 'our class does() the correct roles');
+ok(My::Test8->does('Role::Boo::Hoo'), 'our class does() the correct roles');
+ok(My::Test9->does('Role::Boo'), 'our class does() the correct roles');
+ok(My::Test9->does('Role::Boo::Hoo'), 'our class does() the correct roles');
+ok(!My::Test10->does('Role::Boo'), 'our class does() the correct roles');
+ok(!My::Test10->does('Role::Boo::Hoo'), 'our class does() the correct roles');
can_ok('My::Test8', 'ghost');
can_ok('My::Test9', 'ghost');
can_ok('My::Test10', 'ghost');
-is(My::Test8->new->ghost, 'Role::Boo::ghost', '... got the expected default attr value');
-is(My::Test9->new->ghost, 'Role::Boo::Hoo::ghost', '... got the expected default attr value');
-is(My::Test10->new->ghost, 'My::Test10::ghost', '... got the expected default attr value');
+is(My::Test8->new->ghost, 'Role::Boo::ghost', 'got the expected default attr value');
+is(My::Test9->new->ghost, 'Role::Boo::Hoo::ghost', 'got the expected default attr value');
+is(My::Test10->new->ghost, 'My::Test10::ghost', 'got the expected default attr value');
=pod
::lives_ok {
with 'Role::Truth';
- } '... composed the role with override okay';
+ } 'composed the role with override okay';
package My::Test12;
use Moose;
::lives_ok {
with 'Role::Plot';
- } '... composed the role with override okay';
+ } 'composed the role with override okay';
package My::Test13;
use Moose;
::dies_ok {
with 'Role::Plot';
- } '... cannot compose it because we have no superclass';
+ } 'cannot compose it because we have no superclass';
package My::Test14;
use Moose;
::throws_ok {
with 'Role::Plot', 'Role::Truth';
} qr/Two \'override\' methods of the same name encountered/,
- '... cannot compose it because we have no superclass';
+ 'cannot compose it because we have no superclass';
}
-ok(My::Test11->meta->has_method('twist'), '... the twist method has been added');
-ok(My::Test12->meta->has_method('twist'), '... the twist method has been added');
-ok(!My::Test13->meta->has_method('twist'), '... the twist method has not been added');
-ok(!My::Test14->meta->has_method('twist'), '... the twist method has not been added');
+ok(My::Test11->meta->has_method('twist'), 'the twist method has been added');
+ok(My::Test12->meta->has_method('twist'), 'the twist method has been added');
+ok(!My::Test13->meta->has_method('twist'), 'the twist method has not been added');
+ok(!My::Test14->meta->has_method('twist'), 'the twist method has not been added');
-ok(!My::Test11->does('Role::Plot'), '... our class does() the correct roles');
-ok(My::Test11->does('Role::Truth'), '... our class does() the correct roles');
-ok(!My::Test12->does('Role::Truth'), '... our class does() the correct roles');
-ok(My::Test12->does('Role::Plot'), '... our class does() the correct roles');
-ok(!My::Test13->does('Role::Plot'), '... our class does() the correct roles');
-ok(!My::Test14->does('Role::Truth'), '... our class does() the correct roles');
-ok(!My::Test14->does('Role::Plot'), '... our class does() the correct roles');
+ok(!My::Test11->does('Role::Plot'), 'our class does() the correct roles');
+ok(My::Test11->does('Role::Truth'), 'our class does() the correct roles');
+ok(!My::Test12->does('Role::Truth'), 'our class does() the correct roles');
+ok(My::Test12->does('Role::Plot'), 'our class does() the correct roles');
+ok(!My::Test13->does('Role::Plot'), 'our class does() the correct roles');
+ok(!My::Test14->does('Role::Truth'), 'our class does() the correct roles');
+ok(!My::Test14->does('Role::Plot'), 'our class does() the correct roles');
-is(My::Test11->twist(), 'My::Test::Base::twist -> Role::Truth::twist', '... got the right method return');
-is(My::Test12->twist(), 'My::Test::Base::twist -> Role::Plot::twist', '... got the right method return');
-ok(!My::Test13->can('twist'), '... no twist method here at all');
-is(My::Test14->twist(), 'My::Test::Base::twist', '... got the right method return (from superclass)');
+is(My::Test11->twist(), 'My::Test::Base::twist -> Role::Truth::twist', 'got the right method return');
+is(My::Test12->twist(), 'My::Test::Base::twist -> Role::Plot::twist', 'got the right method return');
+ok(!My::Test13->can('twist'), 'no twist method here at all');
+is(My::Test14->twist(), 'My::Test::Base::twist', 'got the right method return (from superclass)');
{
package Role::Reality;
::throws_ok {
with 'Role::Plot';
} qr/A local method of the same name as been found/,
- '... could not compose roles here, it dies';
+ 'could not compose roles here, it dies';
sub twist {
'Role::Reality::twist';
}
}
-ok(Role::Reality->meta->has_method('twist'), '... the twist method has not been added');
-#ok(!Role::Reality->meta->does_role('Role::Plot'), '... our role does() the correct roles');
+ok(Role::Reality->meta->has_method('twist'), 'the twist method has not been added');
+#ok(!Role::Reality->meta->does_role('Role::Plot'), 'our role does() the correct roles');
is(Role::Reality->meta->get_method('twist')->(),
'Role::Reality::twist',
- '... the twist method returns the right value');
+ 'the twist method returns the right value');
# Ovid's test case from rt.cpan.org #44
{
::lives_ok {
with 'Role::Method';
- } '... composed the method role into the method class';
+ } 'composed the method role into the method class';
sub ghost { 'My::Test15::ghost' }
::lives_ok {
with 'Role::Method';
- } '... composed the method role into the attribute class';
+ } 'composed the method role into the attribute class';
has 'ghost' => (is => 'ro', default => 'My::Test16::ghost');
::lives_ok {
with 'Role::Attribute';
- } '... composed the attribute role into the method class';
+ } 'composed the attribute role into the method class';
sub ghost { 'My::Test17::ghost' }
::lives_ok {
with 'Role::Attribute';
- } '... composed the attribute role into the attribute class';
+ } 'composed the attribute role into the attribute class';
has 'ghost' => (is => 'ro', default => 'My::Test18::ghost');
::lives_ok {
with 'Role::Method', 'Role::Method2';
- } '... composed method roles into class with method tiebreaker';
+ } 'composed method roles into class with method tiebreaker';
sub ghost { 'My::Test19::ghost' }
::lives_ok {
with 'Role::Method', 'Role::Method2';
- } '... composed method roles into class with attribute tiebreaker';
+ } 'composed method roles into class with attribute tiebreaker';
has 'ghost' => (is => 'ro', default => 'My::Test20::ghost');
::lives_ok {
with 'Role::Attribute', 'Role::Attribute2';
- } '... composed attribute roles into class with method tiebreaker';
+ } 'composed attribute roles into class with method tiebreaker';
sub ghost { 'My::Test21::ghost' }
::lives_ok {
with 'Role::Attribute', 'Role::Attribute2';
- } '... composed attribute roles into class with attribute tiebreaker';
+ } 'composed attribute roles into class with attribute tiebreaker';
has 'ghost' => (is => 'ro', default => 'My::Test22::ghost');
::lives_ok {
with 'Role::Method', 'Role::Attribute';
- } '... composed method and attribute role into class with method tiebreaker';
+ } 'composed method and attribute role into class with method tiebreaker';
sub ghost { 'My::Test23::ghost' }
::lives_ok {
with 'Role::Method', 'Role::Attribute';
- } '... composed method and attribute role into class with attribute tiebreaker';
+ } 'composed method and attribute role into class with attribute tiebreaker';
has 'ghost' => (is => 'ro', default => 'My::Test24::ghost');
::lives_ok {
with 'Role::Attribute', 'Role::Method';
- } '... composed attribute and method role into class with method tiebreaker';
+ } 'composed attribute and method role into class with method tiebreaker';
sub ghost { 'My::Test25::ghost' }
::lives_ok {
with 'Role::Attribute', 'Role::Method';
- } '... composed attribute and method role into class with attribute tiebreaker';
+ } 'composed attribute and method role into class with attribute tiebreaker';
has 'ghost' => (is => 'ro', default => 'My::Test26::ghost');
}
my $test15 = My::Test15->new;
isa_ok($test15, 'My::Test15');
-is($test15->ghost, 'My::Test15::ghost', '... we access the method from the class and ignore the role method');
+is($test15->ghost, 'My::Test15::ghost', 'we access the method from the class and ignore the role method');
my $test16 = My::Test16->new;
isa_ok($test16, 'My::Test16');
-is($test16->ghost, 'My::Test16::ghost', '... we access the attribute from the class and ignore the role method');
+is($test16->ghost, 'My::Test16::ghost', 'we access the attribute from the class and ignore the role method');
my $test17 = My::Test17->new;
isa_ok($test17, 'My::Test17');
-is($test17->ghost, 'My::Test17::ghost', '... we access the method from the class and ignore the role attribute');
+is($test17->ghost, 'My::Test17::ghost', 'we access the method from the class and ignore the role attribute');
my $test18 = My::Test18->new;
isa_ok($test18, 'My::Test18');
-is($test18->ghost, 'My::Test18::ghost', '... we access the attribute from the class and ignore the role attribute');
+is($test18->ghost, 'My::Test18::ghost', 'we access the attribute from the class and ignore the role attribute');
my $test19 = My::Test19->new;
isa_ok($test19, 'My::Test19');
-is($test19->ghost, 'My::Test19::ghost', '... we access the method from the class and ignore the role methods');
+is($test19->ghost, 'My::Test19::ghost', 'we access the method from the class and ignore the role methods');
my $test20 = My::Test20->new;
isa_ok($test20, 'My::Test20');
-is($test20->ghost, 'My::Test20::ghost', '... we access the attribute from the class and ignore the role methods');
+is($test20->ghost, 'My::Test20::ghost', 'we access the attribute from the class and ignore the role methods');
my $test21 = My::Test21->new;
isa_ok($test21, 'My::Test21');
-is($test21->ghost, 'My::Test21::ghost', '... we access the method from the class and ignore the role attributes');
+is($test21->ghost, 'My::Test21::ghost', 'we access the method from the class and ignore the role attributes');
my $test22 = My::Test22->new;
isa_ok($test22, 'My::Test22');
-is($test22->ghost, 'My::Test22::ghost', '... we access the attribute from the class and ignore the role attributes');
+is($test22->ghost, 'My::Test22::ghost', 'we access the attribute from the class and ignore the role attributes');
my $test23 = My::Test23->new;
isa_ok($test23, 'My::Test23');
-is($test23->ghost, 'My::Test23::ghost', '... we access the method from the class and ignore the role method and attribute');
+is($test23->ghost, 'My::Test23::ghost', 'we access the method from the class and ignore the role method and attribute');
my $test24 = My::Test24->new;
isa_ok($test24, 'My::Test24');
-is($test24->ghost, 'My::Test24::ghost', '... we access the attribute from the class and ignore the role method and attribute');
+is($test24->ghost, 'My::Test24::ghost', 'we access the attribute from the class and ignore the role method and attribute');
my $test25 = My::Test25->new;
isa_ok($test25, 'My::Test25');
-is($test25->ghost, 'My::Test25::ghost', '... we access the method from the class and ignore the role attribute and method');
+is($test25->ghost, 'My::Test25::ghost', 'we access the method from the class and ignore the role attribute and method');
my $test26 = My::Test26->new;
isa_ok($test26, 'My::Test26');
-is($test26->ghost, 'My::Test26::ghost', '... we access the attribute from the class and ignore the role attribute and method');
+is($test26->ghost, 'My::Test26::ghost', 'we access the attribute from the class and ignore the role attribute and method');
=cut
with 'Molecule';
}
-ok(Molecule::Organic->meta->excludes_role('Molecule::Inorganic'), '... Molecule::Organic exludes Molecule::Inorganic');
+ok(Molecule::Organic->meta->excludes_role('Molecule::Inorganic'), 'Molecule::Organic exludes Molecule::Inorganic');
is_deeply(
[ Molecule::Organic->meta->get_excluded_roles_list() ],
[ 'Molecule::Inorganic' ],
- '... Molecule::Organic exludes Molecule::Inorganic');
+ 'Molecule::Organic exludes Molecule::Inorganic');
=pod
::lives_ok {
with 'Molecule::Organic';
- } '... adding the role (w/ excluded roles) okay';
+ } 'adding the role (w/ excluded roles) okay';
package My::Test2;
use Moose;
::throws_ok {
with 'Molecule::Organic', 'Molecule::Inorganic';
} qr/Conflict detected: Role Molecule::Organic excludes role 'Molecule::Inorganic'/,
- '... adding the role w/ excluded role conflict dies okay';
+ 'adding the role w/ excluded role conflict dies okay';
package My::Test3;
use Moose;
::lives_ok {
with 'Molecule::Organic';
- } '... adding the role (w/ excluded roles) okay';
+ } 'adding the role (w/ excluded roles) okay';
::throws_ok {
with 'Molecule::Inorganic';
} qr/Conflict detected: My::Test3 excludes role 'Molecule::Inorganic'/,
- '... adding the role w/ excluded role conflict dies okay';
+ 'adding the role w/ excluded role conflict dies okay';
}
-ok(My::Test1->does('Molecule::Organic'), '... My::Test1 does Molecule::Organic');
-ok(My::Test1->does('Molecule'), '... My::Test1 does Molecule');
-ok(My::Test1->meta->excludes_role('Molecule::Inorganic'), '... My::Test1 excludes Molecule::Organic');
+ok(My::Test1->does('Molecule::Organic'), 'My::Test1 does Molecule::Organic');
+ok(My::Test1->does('Molecule'), 'My::Test1 does Molecule');
+ok(My::Test1->meta->excludes_role('Molecule::Inorganic'), 'My::Test1 excludes Molecule::Organic');
-ok(!My::Test2->does('Molecule::Organic'), '... ! My::Test2 does Molecule::Organic');
-ok(!My::Test2->does('Molecule::Inorganic'), '... ! My::Test2 does Molecule::Inorganic');
+ok(!My::Test2->does('Molecule::Organic'), '! My::Test2 does Molecule::Organic');
+ok(!My::Test2->does('Molecule::Inorganic'), '! My::Test2 does Molecule::Inorganic');
-ok(My::Test3->does('Molecule::Organic'), '... My::Test3 does Molecule::Organic');
-ok(My::Test3->does('Molecule'), '... My::Test1 does Molecule');
-ok(My::Test3->meta->excludes_role('Molecule::Inorganic'), '... My::Test3 excludes Molecule::Organic');
-ok(!My::Test3->does('Molecule::Inorganic'), '... ! My::Test3 does Molecule::Inorganic');
+ok(My::Test3->does('Molecule::Organic'), 'My::Test3 does Molecule::Organic');
+ok(My::Test3->does('Molecule'), 'My::Test1 does Molecule');
+ok(My::Test3->meta->excludes_role('Molecule::Inorganic'), 'My::Test3 excludes Molecule::Organic');
+ok(!My::Test3->does('Molecule::Inorganic'), '! My::Test3 does Molecule::Inorganic');
=pod
::throws_ok {
with 'Molecule::Inorganic';
} qr/Conflict detected: My::Test4 excludes role \'Molecule::Inorganic\'/,
- '... cannot add exculded role into class which extends Methane';
+ 'cannot add exculded role into class which extends Methane';
}
-ok(Methane->does('Molecule::Organic'), '... Methane does Molecule::Organic');
-ok(My::Test4->isa('Methane'), '... My::Test4 isa Methane');
-ok(My::Test4->does('Molecule::Organic'), '... My::Test4 does Molecule::Organic');
-ok(My::Test4->meta->does_role('Molecule::Organic'), '... My::Test4 meat does_role Molecule::Organic');
-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');
+ok(Methane->does('Molecule::Organic'), 'Methane does Molecule::Organic');
+ok(My::Test4->isa('Methane'), 'My::Test4 isa Methane');
+ok(My::Test4->does('Molecule::Organic'), 'My::Test4 does Molecule::Organic');
+ok(My::Test4->meta->does_role('Molecule::Organic'), 'My::Test4 meat does_role Molecule::Organic');
+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');
::lives_ok {
with 'Role::RequireFoo';
- } '... the required "foo" method will not exist yet (but we will live)';
+ } 'the required "foo" method will not exist yet (but we will live)';
override 'foo' => sub { 'Role::ProvideFoo::foo' };
}
is_deeply(
[ Role::ProvideFoo->meta->get_required_method_list ],
[ 'foo' ],
- '... foo method is still required for Role::ProvideFoo');
+ 'foo method is still required for Role::ProvideFoo');
=pod
::lives_ok {
with 'Role::RequireFoo';
- } '... the required "foo" method will be found in the superclass';
+ } 'the required "foo" method will be found in the superclass';
override 'foo' => sub { 'Class::ProvideFoo::foo' };
::lives_ok {
with 'Role::RequireFoo';
- } '... the required "foo" method exists, although it is overriden locally';
+ } 'the required "foo" method exists, although it is overriden locally';
}
::lives_ok {
with 'Role::RequireFoo';
- } '... the required "foo" method will be found in the superclass';
+ } 'the required "foo" method will be found in the superclass';
before 'foo' => sub { 'Class::ProvideFoo::foo:before' };
::lives_ok {
with 'Role::RequireFoo';
- } '... the required "foo" method exists, although it is a before modifier locally';
+ } 'the required "foo" method exists, although it is a before modifier locally';
package Class::ProvideFoo::Before3;
use Moose;
::lives_ok {
with 'Role::RequireFoo';
- } '... the required "foo" method exists locally, and it is modified locally';
+ } 'the required "foo" method exists locally, and it is modified locally';
package Class::ProvideFoo::Before4;
use Moose;
::isa_ok(__PACKAGE__->meta->get_method('foo'), 'Class::MOP::Method::Wrapped');
::is(__PACKAGE__->meta->get_method('foo')->get_original_method->package_name, __PACKAGE__,
- '... but the original method is from our package');
+ 'but the original method is from our package');
::lives_ok {
with 'Role::RequireFoo';
- } '... the required "foo" method exists in the symbol table (and we will live)';
+ } 'the required "foo" method exists in the symbol table (and we will live)';
}
::lives_ok {
with 'Role::RequireFoo';
- } '... the required "foo" method will be found in the superclass (but then overriden)';
+ } 'the required "foo" method will be found in the superclass (but then overriden)';
has 'foo' => (is => 'ro');
::lives_ok {
with 'Role::RequireFoo';
- } '... the required "foo" method exists, and is an accessor';
+ } 'the required "foo" method exists, and is an accessor';
}
# ...
::lives_ok {
with 'Foo::Role';
- } '... our role combined successfully';
+ } 'our role combined successfully';
}
# a method required in a role and implemented in a superclass, with a method
::lives_ok {
with 'Role::Derived1', 'Role::Derived2';
- } '... roles composed okay (no conflicts)';
+ } 'roles composed okay (no conflicts)';
}
-ok(Role::Base->meta->has_method('foo'), '... have the method foo as expected');
-ok(Role::Derived1->meta->has_method('foo'), '... have the method foo as expected');
-ok(Role::Derived2->meta->has_method('foo'), '... have the method foo as expected');
-ok(My::Test::Class1->meta->has_method('foo'), '... have the method foo as expected');
+ok(Role::Base->meta->has_method('foo'), 'have the method foo as expected');
+ok(Role::Derived1->meta->has_method('foo'), 'have the method foo as expected');
+ok(Role::Derived2->meta->has_method('foo'), 'have the method foo as expected');
+ok(My::Test::Class1->meta->has_method('foo'), 'have the method foo as expected');
-is(My::Test::Class1->foo, 'Role::Base::foo', '... got the right value from method');
+is(My::Test::Class1->foo, 'Role::Base::foo', 'got the right value from method');
=pod
::lives_ok {
with 'Role::Derived3', 'Role::Derived4';
- } '... roles composed okay (no conflicts)';
+ } 'roles composed okay (no conflicts)';
}
-ok(Role::Base2->meta->has_override_method_modifier('foo'), '... have the method foo as expected');
-ok(Role::Derived3->meta->has_override_method_modifier('foo'), '... have the method foo as expected');
-ok(Role::Derived4->meta->has_override_method_modifier('foo'), '... have the method foo as expected');
-ok(My::Test::Class2->meta->has_method('foo'), '... have the method foo as expected');
+ok(Role::Base2->meta->has_override_method_modifier('foo'), 'have the method foo as expected');
+ok(Role::Derived3->meta->has_override_method_modifier('foo'), 'have the method foo as expected');
+ok(Role::Derived4->meta->has_override_method_modifier('foo'), 'have the method foo as expected');
+ok(My::Test::Class2->meta->has_method('foo'), 'have the method foo as expected');
isa_ok(My::Test::Class2->meta->get_method('foo'), 'Moose::Meta::Method::Overridden');
-ok(My::Test::Class2::Base->meta->has_method('foo'), '... have the method foo as expected');
+ok(My::Test::Class2::Base->meta->has_method('foo'), 'have the method foo as expected');
isa_ok(My::Test::Class2::Base->meta->get_method('foo'), 'Class::MOP::Method');
-is(My::Test::Class2::Base->foo, 'My::Test::Class2::Base', '... got the right value from method');
-is(My::Test::Class2->foo, 'My::Test::Class2::Base -> Role::Base::foo', '... got the right value from method');
+is(My::Test::Class2::Base->foo, 'My::Test::Class2::Base', 'got the right value from method');
+is(My::Test::Class2->foo, 'My::Test::Class2::Base -> Role::Base::foo', 'got the right value from method');
=pod
::lives_ok {
with 'Role::Derived5', 'Role::Derived6';
- } '... roles composed okay (no conflicts)';
+ } 'roles composed okay (no conflicts)';
}
-ok(Role::Base3->meta->has_around_method_modifiers('foo'), '... have the method foo as expected');
-ok(Role::Derived5->meta->has_around_method_modifiers('foo'), '... have the method foo as expected');
-ok(Role::Derived6->meta->has_around_method_modifiers('foo'), '... have the method foo as expected');
-ok(My::Test::Class3->meta->has_method('foo'), '... have the method foo as expected');
+ok(Role::Base3->meta->has_around_method_modifiers('foo'), 'have the method foo as expected');
+ok(Role::Derived5->meta->has_around_method_modifiers('foo'), 'have the method foo as expected');
+ok(Role::Derived6->meta->has_around_method_modifiers('foo'), 'have the method foo as expected');
+ok(My::Test::Class3->meta->has_method('foo'), 'have the method foo as expected');
isa_ok(My::Test::Class3->meta->get_method('foo'), 'Class::MOP::Method::Wrapped');
-ok(My::Test::Class3::Base->meta->has_method('foo'), '... have the method foo as expected');
+ok(My::Test::Class3::Base->meta->has_method('foo'), 'have the method foo as expected');
isa_ok(My::Test::Class3::Base->meta->get_method('foo'), 'Class::MOP::Method');
-is(My::Test::Class3::Base->foo, 'My::Test::Class3::Base', '... got the right value from method');
-is(My::Test::Class3->foo, 'Role::Base::foo(My::Test::Class3::Base)', '... got the right value from method');
+is(My::Test::Class3::Base->foo, 'My::Test::Class3::Base', 'got the right value from method');
+is(My::Test::Class3->foo, 'Role::Base::foo(My::Test::Class3::Base)', 'got the right value from method');
=pod
::lives_ok {
with 'Role::Derived7', 'Role::Derived8';
- } '... roles composed okay (no conflicts)';
+ } 'roles composed okay (no conflicts)';
}
-ok(Role::Base4->meta->has_attribute('foo'), '... have the attribute foo as expected');
-ok(Role::Derived7->meta->has_attribute('foo'), '... have the attribute foo as expected');
-ok(Role::Derived8->meta->has_attribute('foo'), '... have the attribute foo as expected');
-ok(My::Test::Class4->meta->has_attribute('foo'), '... have the attribute foo as expected');
+ok(Role::Base4->meta->has_attribute('foo'), 'have the attribute foo as expected');
+ok(Role::Derived7->meta->has_attribute('foo'), 'have the attribute foo as expected');
+ok(Role::Derived8->meta->has_attribute('foo'), 'have the attribute foo as expected');
+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');
+is(My::Test::Class4->new->foo, 'Role::Base::foo', 'got the right value from method');
::lives_ok {
with "SubAA", "RootA";
- } '... role was composed as expected';
+ } 'role was composed as expected';
}
ok( SubAB->does("SubAA"), "does SubAA");
my $foo_rv;
lives_ok {
$foo_rv = $i->foo;
- } '... called foo successfully';
+ } 'called foo successfully';
is($foo_rv, "RootA::foo", "... got the right foo rv");
}
::lives_ok {
with "SubBA";
- } '... composed the role successfully';
+ } 'composed the role successfully';
}
ok( SubBB->does("SubBA"), "BB does SubBA" );
my $foo_rv;
lives_ok {
$foo_rv = $i->foo
- } '... called foo successfully';
+ } 'called foo successfully';
is( $foo_rv, "RootB::foo", "foo rv" );
is( $i->counter, 1, "after hook called" );
- lives_ok { $i->foo } '... called foo successfully (again)';
+ lives_ok { $i->foo } 'called foo successfully (again)';
is( $i->counter, 2, "after hook called (again)" );
- ok(SubBA->meta->has_method('foo'), '... this has the foo method');
+ ok(SubBA->meta->has_method('foo'), 'this has the foo method');
#my $subba_foo_rv;
#lives_ok {
# $subba_foo_rv = SubBA::foo();
- #} '... called the sub as a function correctly';
- #is($subba_foo_rv, 'RootB::foo', '... the SubBA->foo is still the RootB version');
+ #} 'called the sub as a function correctly';
+ #is($subba_foo_rv, 'RootB::foo', 'the SubBA->foo is still the RootB version');
}
{
::dies_ok {
override foo => sub { "overridden" };
- } '... cannot compose an override over a local method';
+ } 'cannot compose an override over a local method';
}
}
{
ok(!$obj->can( 'talk' ), "... the role is not composed yet");
- ok(!$obj->does('Bark'), '... we do not do any roles yet');
+ ok(!$obj->does('Bark'), 'we do not do any roles yet');
Bark->meta->apply($obj);
- ok($obj->does('Bark'), '... we now do the Bark role');
- ok(!My::Class->does('Bark'), '... the class does not do the Bark role');
+ ok($obj->does('Bark'), 'we now do the Bark role');
+ ok(!My::Class->does('Bark'), 'the class does not do the Bark role');
isa_ok($obj, 'My::Class');
- isnt(blessed($obj), 'My::Class', '... but it is no longer blessed into My::Class');
+ isnt(blessed($obj), 'My::Class', 'but it is no longer blessed into My::Class');
ok(!My::Class->can('talk'), "... the role is not composed at the class level");
ok($obj->can('talk'), "... the role is now composed at the object level");
- is($obj->talk, 'woof', '... got the right return value for the newly composed method');
+ is($obj->talk, 'woof', 'got the right return value for the newly composed method');
}
{
- ok(!$obj2->does('Bark'), '... we do not do any roles yet');
+ ok(!$obj2->does('Bark'), 'we do not do any roles yet');
Bark->meta->apply($obj2);
- ok($obj2->does('Bark'), '... we now do the Bark role');
- is(blessed($obj), blessed($obj2), '... they share the same anon-class/role thing');
+ ok($obj2->does('Bark'), 'we now do the Bark role');
+ is(blessed($obj), blessed($obj2), 'they share the same anon-class/role thing');
}
{
- is($obj->sleep, 'nite-nite', '... the original method responds as expected');
+ is($obj->sleep, 'nite-nite', 'the original method responds as expected');
- ok(!$obj->does('Sleeper'), '... we do not do the Sleeper role');
+ ok(!$obj->does('Sleeper'), 'we do not do the Sleeper role');
Sleeper->meta->apply($obj);
- ok($obj->does('Bark'), '... we still do the Bark role');
- ok($obj->does('Sleeper'), '... we now do the Sleeper role too');
+ ok($obj->does('Bark'), 'we still do the Bark role');
+ ok($obj->does('Sleeper'), 'we now do the Sleeper role too');
- ok(!My::Class->does('Sleeper'), '... the class does not do the Sleeper role');
+ ok(!My::Class->does('Sleeper'), 'the class does not do the Sleeper role');
- isnt(blessed($obj), blessed($obj2), '... they no longer share the same anon-class/role thing');
+ isnt(blessed($obj), blessed($obj2), 'they no longer share the same anon-class/role thing');
isa_ok($obj, 'My::Class');
- is(My::Class->sleep, 'nite-nite', '... the original method still responds as expected');
+ is(My::Class->sleep, 'nite-nite', 'the original method still responds as expected');
- is($obj->sleep, 'snore', '... got the right return value for the newly composed method');
- is($obj->talk, 'zzz', '... got the right return value for the newly composed method');
+ is($obj->sleep, 'snore', 'got the right return value for the newly composed method');
+ is($obj->talk, 'zzz', 'got the right return value for the newly composed method');
}
{
- ok(!$obj2->does('Sleeper'), '... we do not do any roles yet');
+ ok(!$obj2->does('Sleeper'), 'we do not do any roles yet');
Sleeper->meta->apply($obj2);
- ok($obj2->does('Sleeper'), '... we now do the Bark role');
- is(blessed($obj), blessed($obj2), '... they share the same anon-class/role thing again');
+ ok($obj2->does('Sleeper'), 'we now do the Bark role');
+ is(blessed($obj), blessed($obj2), 'they share the same anon-class/role thing again');
}
::throws_ok {
with 'Role::A::Conflict';
- } qr/Due to a method name conflict in roles 'Role::A' and 'Role::A::Conflict', the method 'bar' must be implemented or excluded by 'Class::A::Conflict'/, '... did not fufill the requirement of &bar method';
+ } qr/Due to a method name conflict in roles 'Role::A' and 'Role::A::Conflict', the method 'bar' must be implemented or excluded by 'Class::A::Conflict'/, 'did not fufill the requirement of &bar method';
package Class::A::Resolved;
use Moose;
::lives_ok {
with 'Role::A::Conflict';
- } '... did fufill the requirement of &bar method';
+ } 'did fufill the requirement of &bar method';
sub bar { 'Class::A::Resolved::bar' }
}
-ok(Role::A::Conflict->meta->requires_method('bar'), '... Role::A::Conflict created the bar requirement');
+ok(Role::A::Conflict->meta->requires_method('bar'), 'Role::A::Conflict created the bar requirement');
can_ok( Class::A::Resolved->new, qw(bar) );
is( Class::B->new->bar, "Role::D::bar", "... got the &bar method okay" );
is( Class::B->new->xxy, "Role::E::xxy", "... got the &xxy method okay" );
-ok(!Role::F->meta->requires_method('foo'), '... Role::F fufilled the &foo requirement');
+ok(!Role::F->meta->requires_method('foo'), 'Role::F fufilled the &foo requirement');
{
# check that a conflict can be resolved
}
-ok(!Role::D::And::E::Conflict->meta->requires_method('foo'), '... Role::D::And::E::Conflict fufilled the &foo requirement');
-ok(Role::D::And::E::Conflict->meta->requires_method('xxy'), '... Role::D::And::E::Conflict adds the &xxy requirement');
-ok(Role::D::And::E::Conflict->meta->requires_method('bar'), '... Role::D::And::E::Conflict adds the &bar requirement');
+ok(!Role::D::And::E::Conflict->meta->requires_method('foo'), 'Role::D::And::E::Conflict fufilled the &foo requirement');
+ok(Role::D::And::E::Conflict->meta->requires_method('xxy'), 'Role::D::And::E::Conflict adds the &xxy requirement');
+ok(Role::D::And::E::Conflict->meta->requires_method('bar'), 'Role::D::And::E::Conflict adds the &bar requirement');
{
# conflict propagation
is( Class::E->new->bar, "Role::H::bar", "... got the right &bar method" );
is( Class::E->new->xxy, "Role::J::xxy", "... got the right &xxy method" );
-ok(Role::I->meta->requires_method('foo'), '... Role::I still have the &foo requirement');
+ok(Role::I->meta->requires_method('foo'), 'Role::I still have the &foo requirement');
{
lives_ok {
}
ok(My::Class->meta->has_method($_), "we have a $_ method") for qw(foo baz);
-ok(!My::Class->meta->has_method('bar'), '... but we excluded bar');
+ok(!My::Class->meta->has_method('bar'), 'but we excluded bar');
{
package My::OtherRole;
ok(My::OtherRole->meta->has_method($_), "we have a $_ method") for qw(foo bar baz);
-ok(!My::OtherRole->meta->requires_method('foo'), '... and the &foo method is not required');
-ok(My::OtherRole->meta->requires_method('bar'), '... and the &bar method is required');
+ok(!My::OtherRole->meta->requires_method('foo'), 'and the &foo method is not required');
+ok(My::OtherRole->meta->requires_method('bar'), 'and the &bar method is required');
{
package Foo::Role;
with 'Foo::Role' => { -excludes => 'foo' },
'Bar::Role' => { -excludes => 'foo' },
'Baz::Role';
- } '... composed our roles correctly';
+ } 'composed our roles correctly';
package My::Foo::Class::Broken;
use Moose;
'Bar::Role' => { -excludes => 'foo' },
'Baz::Role';
} qr/Due to a method name conflict in roles 'Baz::Role' and 'Foo::Role', the method 'foo' must be implemented or excluded by 'My::Foo::Class::Broken'/,
- '... composed our roles correctly';
+ 'composed our roles correctly';
}
{
my $foo = My::Foo::Class->new;
isa_ok($foo, 'My::Foo::Class');
can_ok($foo, 'foo');
- is($foo->foo, 'Baz::Role::foo', '... got the right method');
+ is($foo->foo, 'Baz::Role::foo', 'got the right method');
}
{
with 'Foo::Role' => { -excludes => 'foo' },
'Bar::Role' => { -excludes => 'foo' },
'Baz::Role';
- } '... composed our roles correctly';
+ } 'composed our roles correctly';
}
ok(My::Foo::Role->meta->has_method('foo'), "we have a foo method");
-ok(!My::Foo::Role->meta->requires_method('foo'), '... and the &foo method is not required');
+ok(!My::Foo::Role->meta->requires_method('foo'), 'and the &foo method is not required');
{
package My::Foo::Role::Other;
with 'Foo::Role',
'Bar::Role' => { -excludes => 'foo' },
'Baz::Role';
- } '... composed our roles correctly';
+ } 'composed our roles correctly';
}
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');
+ok(My::Foo::Role::Other->meta->requires_method('foo'), 'and the &foo method is required');
::lives_ok {
with 'My::Role' => { -alias => { bar => 'role_bar' } };
- } '... this succeeds';
+ } 'this succeeds';
package My::Class::Failure;
use Moose;
::throws_ok {
with 'My::Role' => { -alias => { bar => 'role_bar' } };
- } qr/Cannot create a method alias if a local method of the same name exists/, '... this succeeds';
+ } qr/Cannot create a method alias if a local method of the same name exists/, 'this succeeds';
sub role_bar { 'FAIL' }
}
::lives_ok {
with 'My::Role' => { -alias => { bar => 'role_bar' } };
- } '... this succeeds';
+ } 'this succeeds';
sub bar { 'My::OtherRole::bar' }
::throws_ok {
with 'My::Role' => { -alias => { bar => 'role_bar' } };
- } qr/Cannot create a method alias if a local method of the same name exists/, '... cannot alias to a name that exists';
+ } qr/Cannot create a method alias if a local method of the same name exists/, 'cannot alias to a name that exists';
sub role_bar { 'FAIL' }
}
ok(My::OtherRole->meta->has_method($_), "we have a $_ method") for qw(foo baz role_bar);
-ok(My::OtherRole->meta->requires_method('bar'), '... and the &bar method is required');
-ok(!My::OtherRole->meta->requires_method('role_bar'), '... and the &role_bar method is not required');
+ok(My::OtherRole->meta->requires_method('bar'), 'and the &bar method is required');
+ok(!My::OtherRole->meta->requires_method('role_bar'), 'and the &role_bar method is not required');
{
package My::AliasingRole;
::lives_ok {
with 'My::Role' => { -alias => { bar => 'role_bar' } };
- } '... this succeeds';
+ } 'this succeeds';
}
ok(My::AliasingRole->meta->has_method($_), "we have a $_ method") for qw(foo baz role_bar);
-ok(!My::AliasingRole->meta->requires_method('bar'), '... and the &bar method is not required');
+ok(!My::AliasingRole->meta->requires_method('bar'), 'and the &bar method is not required');
{
package Foo::Role;
with 'Foo::Role' => { -alias => { 'foo' => 'foo_foo' }, -excludes => 'foo' },
'Bar::Role' => { -alias => { 'foo' => 'bar_foo' }, -excludes => 'foo' },
'Baz::Role';
- } '... composed our roles correctly';
+ } 'composed our roles correctly';
package My::Foo::Class::Broken;
use Moose;
'Bar::Role' => { -alias => { 'foo' => 'foo_foo' }, -excludes => 'foo' },
'Baz::Role';
} qr/Due to a method name conflict in roles 'Bar::Role' and 'Foo::Role', the method 'foo_foo' must be implemented or excluded by 'My::Foo::Class::Broken'/,
- '... composed our roles correctly';
+ 'composed our roles correctly';
}
{
my $foo = My::Foo::Class->new;
isa_ok($foo, 'My::Foo::Class');
can_ok($foo, $_) for qw/foo foo_foo bar_foo/;
- is($foo->foo, 'Baz::Role::foo', '... got the right method');
- is($foo->foo_foo, 'Foo::Role::foo', '... got the right method');
- is($foo->bar_foo, 'Bar::Role::foo', '... got the right method');
+ is($foo->foo, 'Baz::Role::foo', 'got the right method');
+ is($foo->foo_foo, 'Foo::Role::foo', 'got the right method');
+ is($foo->bar_foo, 'Bar::Role::foo', 'got the right method');
}
{
with 'Foo::Role' => { -alias => { 'foo' => 'foo_foo' }, -excludes => 'foo' },
'Bar::Role' => { -alias => { 'foo' => 'bar_foo' }, -excludes => 'foo' },
'Baz::Role';
- } '... composed our roles correctly';
+ } 'composed our roles correctly';
}
ok(My::Foo::Role->meta->has_method($_), "we have a $_ method") for qw/foo foo_foo bar_foo/;;
-ok(!My::Foo::Role->meta->requires_method('foo'), '... and the &foo method is not required');
+ok(!My::Foo::Role->meta->requires_method('foo'), 'and the &foo method is not required');
{
with 'Foo::Role' => { -alias => { 'foo' => 'foo_foo' }, -excludes => 'foo' },
'Bar::Role' => { -alias => { 'foo' => 'foo_foo' }, -excludes => 'foo' },
'Baz::Role';
- } '... composed our roles correctly';
+ } 'composed our roles correctly';
}
ok(!My::Foo::Role::Other->meta->has_method('foo_foo'), "we dont have a foo_foo method");
-ok(My::Foo::Role::Other->meta->requires_method('foo_foo'), '... and the &foo method is required');
+ok(My::Foo::Role::Other->meta->requires_method('foo_foo'), 'and the &foo method is required');
{
package My::Foo::AliasOnly;
::lives_ok {
with 'Foo::Role' => { -alias => { 'foo' => 'foo_foo' } },
- } '... composed our roles correctly';
+ } 'composed our roles correctly';
}
ok(My::Foo::AliasOnly->meta->has_method('foo'), 'we have a foo method');
'Bar' => { -excludes => [qw/foo baz gorch/] },
'Baz' => { -excludes => [qw/foo bar gorch/], -alias => { foo => 'baz_foo', bar => 'baz_bar' } },
'Gorch' => { -excludes => [qw/foo bar baz/] };
- } '... everything works out all right';
+ } 'everything works out all right';
}
my $c = My::Class->new;
isa_ok($c, 'My::Class');
-is($c->foo, 'Foo::foo', '... got the right method');
-is($c->bar, 'Bar::bar', '... got the right method');
-is($c->baz, 'Baz::baz', '... got the right method');
-is($c->gorch, 'Gorch::gorch', '... got the right method');
+is($c->foo, 'Foo::foo', 'got the right method');
+is($c->bar, 'Bar::bar', 'got the right method');
+is($c->baz, 'Baz::baz', 'got the right method');
+is($c->gorch, 'Gorch::gorch', 'got the right method');
-is($c->foo_gorch, 'Foo::gorch', '... got the right method');
-is($c->baz_foo, 'Baz::foo', '... got the right method');
-is($c->baz_bar, 'Baz::bar', '... got the right method');
+is($c->foo_gorch, 'Foo::gorch', 'got the right method');
+is($c->baz_foo, 'Baz::foo', 'got the right method');
+is($c->baz_bar, 'Baz::bar', 'got the right method');
ok(!$obj->can( 'talk' ), "... the role is not composed yet");
ok(!$obj->can( 'fur' ), 'ditto');
-ok(!$obj->does('Dog'), '... we do not do any roles yet');
+ok(!$obj->does('Dog'), 'we do not do any roles yet');
dies_ok {
$obj->dog($obj)
-} '... and setting the accessor fails (not a Dog yet)';
+} 'and setting the accessor fails (not a Dog yet)';
Dog->meta->apply($obj);
-ok($obj->does('Dog'), '... we now do the Bark role');
+ok($obj->does('Dog'), 'we now do the Bark role');
ok($obj->can('talk'), "... the role is now composed at the object level");
ok($obj->can('fur'), "it has fur");
-is($obj->talk, 'woof', '... got the right return value for the newly composed method');
+is($obj->talk, 'woof', 'got the right return value for the newly composed method');
lives_ok {
$obj->dog($obj)
-} '... and setting the accessor is okay';
+} 'and setting the accessor is okay';
is($obj->fur, "dirty", "role attr initialized");
dies_ok {
$foo->dog($bar)
-} '... and setting the accessor fails (not a Dog yet)';
+} 'and setting the accessor fails (not a Dog yet)';
Dog->meta->apply($bar);
ok($bar->can('talk'), "... the role is now composed at the object level");
-is($bar->talk, 'woof', '... got the right return value for the newly composed method');
+is($bar->talk, 'woof', 'got the right return value for the newly composed method');
lives_ok {
$foo->dog($bar)
-} '... and setting the accessor is okay';
+} 'and setting the accessor is okay';
::lives_ok {
has '+bar' => (default => sub { 100 });
- } '... extended the attribute successfully';
+ } 'extended the attribute successfully';
}
my $foo = Foo->new;
isa_ok($foo, 'Foo');
-is($foo->bar, 100, '... got the extended attribute');
+is($foo->bar, 100, 'got the extended attribute');
{
my $bar = Bar->new(foo => 42);
isa_ok($bar, 'Bar');
-is($bar->foo, 42, '... got the extended attribute');
+is($bar->foo, 42, 'got the extended attribute');
$bar->foo(100);
is($bar->foo, 100, "... can change the attribute's value to an Int");
my $baz = Baz->new(baz => 99);
isa_ok($baz, 'Baz');
-is($baz->baz, 99, '... got the extended attribute');
+is($baz->baz, 99, 'got the extended attribute');
$baz->baz('Foo');
is($baz->baz, 'Foo', "... can change the attribute's value to a ClassName");
my $quux = Quux->new(quux => 99);
isa_ok($quux, 'Quux');
-is($quux->quux, 99, '... got the extended attribute');
+is($quux->quux, 99, 'got the extended attribute');
$quux->quux(100);
is($quux->quux, 100, "... can change the attribute's value to an Int");
$quux->quux(["hi"]);
my $foo = Foo->new(bar => 'BAR');
isa_ok($foo, 'Foo');
- is($foo->bar, 'BAR', '... got the expect value');
- ok(!$foo->can('baz'), '... no baz method though');
+ is($foo->bar, 'BAR', 'got the expect value');
+ ok(!$foo->can('baz'), 'no baz method though');
lives_ok {
Bar->meta->apply($foo)
- } '... this works';
+ } 'this works';
- is($foo->bar, 'BAR', '... got the expect value');
- ok($foo->can('baz'), '... we have baz method now');
- is($foo->baz, 'BAZ', '... got the expect value');
+ is($foo->bar, 'BAR', 'got the expect value');
+ ok($foo->can('baz'), 'we have baz method now');
+ is($foo->baz, 'BAZ', 'got the expect value');
}
# with extra params ...
my $foo = Foo->new(bar => 'BAR');
isa_ok($foo, 'Foo');
- is($foo->bar, 'BAR', '... got the expect value');
- ok(!$foo->can('baz'), '... no baz method though');
+ is($foo->bar, 'BAR', 'got the expect value');
+ ok(!$foo->can('baz'), 'no baz method though');
lives_ok {
Bar->meta->apply($foo, (rebless_params => { baz => 'FOO-BAZ' }))
- } '... this works';
+ } 'this works';
- is($foo->bar, 'BAR', '... got the expect value');
- ok($foo->can('baz'), '... we have baz method now');
- is($foo->baz, 'FOO-BAZ', '... got the expect value');
+ is($foo->bar, 'BAR', 'got the expect value');
+ ok($foo->can('baz'), 'we have baz method now');
+ is($foo->baz, 'FOO-BAZ', 'got the expect value');
}
# with extra params ...
my $foo = Foo->new(bar => 'BAR');
isa_ok($foo, 'Foo');
- is($foo->bar, 'BAR', '... got the expect value');
- ok(!$foo->can('baz'), '... no baz method though');
+ is($foo->bar, 'BAR', 'got the expect value');
+ ok(!$foo->can('baz'), 'no baz method though');
lives_ok {
Bar->meta->apply($foo, (rebless_params => { bar => 'FOO-BAR', baz => 'FOO-BAZ' }))
- } '... this works';
+ } 'this works';
- is($foo->bar, 'FOO-BAR', '... got the expect value');
- ok($foo->can('baz'), '... we have baz method now');
- is($foo->baz, 'FOO-BAZ', '... got the expect value');
+ is($foo->bar, 'FOO-BAR', 'got the expect value');
+ ok($foo->can('baz'), 'we have baz method now');
+ is($foo->baz, 'FOO-BAZ', 'got the expect value');
}
);
isa_ok($c, 'Moose::Meta::Role::Composite');
- is($c->name, 'Role::Foo|Role::Bar|Role::Baz', '... got the composite role name');
+ is($c->name, 'Role::Foo|Role::Bar|Role::Baz', 'got the composite role name');
is_deeply($c->get_roles, [
Role::Foo->meta,
Role::Bar->meta,
Role::Baz->meta,
- ], '... got the right roles');
+ ], 'got the right roles');
- ok($c->does_role($_), '... our composite does the role ' . $_)
+ ok($c->does_role($_), 'our composite does the role ' . $_)
for qw(
Role::Foo
Role::Bar
lives_ok {
Moose::Meta::Role::Application::RoleSummation->new->apply($c);
- } '... this composed okay';
+ } 'this composed okay';
##... now nest 'em
{
);
isa_ok($c2, 'Moose::Meta::Role::Composite');
- is($c2->name, 'Role::Foo|Role::Bar|Role::Baz|Role::Gorch', '... got the composite role name');
+ is($c2->name, 'Role::Foo|Role::Bar|Role::Baz|Role::Gorch', 'got the composite role name');
is_deeply($c2->get_roles, [
$c,
Role::Gorch->meta,
- ], '... got the right roles');
+ ], 'got the right roles');
- ok($c2->does_role($_), '... our composite does the role ' . $_)
+ ok($c2->does_role($_), 'our composite does the role ' . $_)
for qw(
Role::Foo
Role::Bar
with 'Role::Foo';
}
-ok(Role::ExcludesFoo->meta->excludes_role('Role::Foo'), '... got the right exclusions');
-ok(Role::DoesExcludesFoo->meta->excludes_role('Role::Foo'), '... got the right exclusions');
+ok(Role::ExcludesFoo->meta->excludes_role('Role::Foo'), 'got the right exclusions');
+ok(Role::DoesExcludesFoo->meta->excludes_role('Role::Foo'), 'got the right exclusions');
# test simple exclusion
dies_ok {
]
)
);
-} '... this fails as expected';
+} 'this fails as expected';
# test no conflicts
{
);
isa_ok($c, 'Moose::Meta::Role::Composite');
- is($c->name, 'Role::Foo|Role::Bar', '... got the composite role name');
+ is($c->name, 'Role::Foo|Role::Bar', 'got the composite role name');
lives_ok {
Moose::Meta::Role::Application::RoleSummation->new->apply($c);
- } '... this lives as expected';
+ } 'this lives as expected';
}
# test no conflicts w/exclusion
);
isa_ok($c, 'Moose::Meta::Role::Composite');
- is($c->name, 'Role::Bar|Role::ExcludesFoo', '... got the composite role name');
+ is($c->name, 'Role::Bar|Role::ExcludesFoo', 'got the composite role name');
lives_ok {
Moose::Meta::Role::Application::RoleSummation->new->apply($c);
- } '... this lives as expected';
+ } 'this lives as expected';
- is_deeply([$c->get_excluded_roles_list], ['Role::Foo'], '... has excluded roles');
+ is_deeply([$c->get_excluded_roles_list], ['Role::Foo'], 'has excluded roles');
}
)
);
-} '... this fails as expected';
+} 'this fails as expected';
# test conflict with an "inherited" exclusion of an "inherited" role
dies_ok {
]
)
);
-} '... this fails as expected';
+} 'this fails as expected';
);
isa_ok($c, 'Moose::Meta::Role::Composite');
- is($c->name, 'Role::Foo|Role::Bar', '... got the composite role name');
+ is($c->name, 'Role::Foo|Role::Bar', 'got the composite role name');
lives_ok {
Moose::Meta::Role::Application::RoleSummation->new->apply($c);
- } '... this succeeds as expected';
+ } 'this succeeds as expected';
is_deeply(
[ sort $c->get_required_method_list ],
[ 'bar', 'foo' ],
- '... got the right list of required methods'
+ 'got the right list of required methods'
);
}
);
isa_ok($c, 'Moose::Meta::Role::Composite');
- is($c->name, 'Role::Foo|Role::ProvidesFoo', '... got the composite role name');
+ is($c->name, 'Role::Foo|Role::ProvidesFoo', 'got the composite role name');
lives_ok {
Moose::Meta::Role::Application::RoleSummation->new->apply($c);
- } '... this succeeds as expected';
+ } 'this succeeds as expected';
is_deeply(
[ sort $c->get_required_method_list ],
[],
- '... got the right list of required methods'
+ 'got the right list of required methods'
);
}
);
isa_ok($c, 'Moose::Meta::Role::Composite');
- is($c->name, 'Role::Foo|Role::ProvidesFoo|Role::Bar', '... got the composite role name');
+ is($c->name, 'Role::Foo|Role::ProvidesFoo|Role::Bar', 'got the composite role name');
lives_ok {
Moose::Meta::Role::Application::RoleSummation->new->apply($c);
- } '... this succeeds as expected';
+ } 'this succeeds as expected';
is_deeply(
[ sort $c->get_required_method_list ],
[ 'bar' ],
- '... got the right list of required methods'
+ 'got the right list of required methods'
);
}
);
isa_ok($c, 'Moose::Meta::Role::Composite');
- is($c->name, 'Role::Foo|Role::ProvidesFoo|Role::ProvidesBar|Role::Bar', '... got the composite role name');
+ is($c->name, 'Role::Foo|Role::ProvidesFoo|Role::ProvidesBar|Role::Bar', 'got the composite role name');
lives_ok {
Moose::Meta::Role::Application::RoleSummation->new->apply($c);
- } '... this succeeds as expected';
+ } 'this succeeds as expected';
is_deeply(
[ sort $c->get_required_method_list ],
[ ],
- '... got the right list of required methods'
+ 'got the right list of required methods'
);
}
);
isa_ok($c, 'Moose::Meta::Role::Composite');
- is($c->name, 'Role::Foo|Role::Bar', '... got the composite role name');
+ is($c->name, 'Role::Foo|Role::Bar', 'got the composite role name');
lives_ok {
Moose::Meta::Role::Application::RoleSummation->new->apply($c);
- } '... this succeeds as expected';
+ } 'this succeeds as expected';
is_deeply(
[ sort $c->get_attribute_list ],
[ 'bar', 'foo' ],
- '... got the right list of attributes'
+ 'got the right list of attributes'
);
}
]
)
);
-} '... this fails as expected';
+} 'this fails as expected';
# test complex conflict
dies_ok {
]
)
);
-} '... this fails as expected';
+} 'this fails as expected';
# test simple conflict
dies_ok {
]
)
);
-} '... this fails as expected';
+} 'this fails as expected';
);
isa_ok($c, 'Moose::Meta::Role::Composite');
- is($c->name, 'Role::Foo|Role::Bar', '... got the composite role name');
+ is($c->name, 'Role::Foo|Role::Bar', 'got the composite role name');
lives_ok {
Moose::Meta::Role::Application::RoleSummation->new->apply($c);
- } '... this succeeds as expected';
+ } 'this succeeds as expected';
is_deeply(
[ sort $c->get_method_list ],
[ 'bar', 'foo' ],
- '... got the right list of methods'
+ 'got the right list of methods'
);
}
);
isa_ok($c, 'Moose::Meta::Role::Composite');
- is($c->name, 'Role::Foo|Role::FooConflict', '... got the composite role name');
+ is($c->name, 'Role::Foo|Role::FooConflict', 'got the composite role name');
lives_ok {
Moose::Meta::Role::Application::RoleSummation->new->apply($c);
- } '... this succeeds as expected';
+ } 'this succeeds as expected';
is_deeply(
[ sort $c->get_method_list ],
[],
- '... got the right list of methods'
+ 'got the right list of methods'
);
is_deeply(
[ sort $c->get_required_method_list ],
[ 'foo' ],
- '... got the right list of required methods'
+ 'got the right list of required methods'
);
}
);
isa_ok($c, 'Moose::Meta::Role::Composite');
- is($c->name, 'Role::Foo|Role::Bar|Role::FooConflict|Role::BarConflict', '... got the composite role name');
+ is($c->name, 'Role::Foo|Role::Bar|Role::FooConflict|Role::BarConflict', 'got the composite role name');
lives_ok {
Moose::Meta::Role::Application::RoleSummation->new->apply($c);
- } '... this succeeds as expected';
+ } 'this succeeds as expected';
is_deeply(
[ sort $c->get_method_list ],
[],
- '... got the right list of methods'
+ 'got the right list of methods'
);
is_deeply(
[ sort $c->get_required_method_list ],
[ 'bar', 'foo' ],
- '... got the right list of required methods'
+ 'got the right list of required methods'
);
}
);
isa_ok($c, 'Moose::Meta::Role::Composite');
- is($c->name, 'Role::Foo|Role::AnotherFooConflict', '... got the composite role name');
+ is($c->name, 'Role::Foo|Role::AnotherFooConflict', 'got the composite role name');
lives_ok {
Moose::Meta::Role::Application::RoleSummation->new->apply($c);
- } '... this succeeds as expected';
+ } 'this succeeds as expected';
is_deeply(
[ sort $c->get_method_list ],
[ 'baz' ],
- '... got the right list of methods'
+ 'got the right list of methods'
);
is_deeply(
[ sort $c->get_required_method_list ],
[ 'foo' ],
- '... got the right list of required methods'
+ 'got the right list of required methods'
);
}
);
isa_ok($c, 'Moose::Meta::Role::Composite');
- is($c->name, 'Role::Foo|Role::Bar', '... got the composite role name');
+ is($c->name, 'Role::Foo|Role::Bar', 'got the composite role name');
lives_ok {
Moose::Meta::Role::Application::RoleSummation->new->apply($c);
- } '... this lives ok';
+ } 'this lives ok';
is_deeply(
[ sort $c->get_method_modifier_list('override') ],
[ 'bar', 'foo' ],
- '... got the right list of methods'
+ 'got the right list of methods'
);
}
]
)
);
-} '... this fails as expected';
+} 'this fails as expected';
# test simple overrides w/ conflicts
dies_ok {
]
)
);
-} '... this fails as expected';
+} 'this fails as expected';
# test simple overrides w/ conflicts
]
)
);
-} '... this fails as expected';
+} 'this fails as expected';
# test simple overrides w/ conflicts
]
)
);
-} '... this fails as expected';
+} 'this fails as expected';
);
isa_ok($c, 'Moose::Meta::Role::Composite');
- is($c->name, 'Role::Foo|Role::Bar', '... got the composite role name');
+ is($c->name, 'Role::Foo|Role::Bar', 'got the composite role name');
lives_ok {
Moose::Meta::Role::Application::RoleSummation->new->apply($c);
- } '... this succeeds as expected';
+ } 'this succeeds as expected';
is_deeply(
[ sort $c->get_method_modifier_list('before') ],
[ 'bar', 'foo' ],
- '... got the right list of methods'
+ 'got the right list of methods'
);
is_deeply(
[ sort $c->get_method_modifier_list('after') ],
[ 'bar', 'foo' ],
- '... got the right list of methods'
+ 'got the right list of methods'
);
is_deeply(
[ sort $c->get_method_modifier_list('around') ],
[ 'bar', 'baz', 'foo' ],
- '... got the right list of methods'
+ 'got the right list of methods'
);
}
is( $meth->original_method, Role::Bar->meta->get_method('foo'),
'ClassA->foo was cloned from Role::Bar->foo' );
is( $meth->original_method->original_method, Role::Foo->meta->get_method('foo'),
- '... which in turn was cloned from Role::Foo->foo' );
+ 'which in turn was cloned from Role::Foo->foo' );
is( $meth->fully_qualified_name, 'ClassB::foo',
'fq name is ClassA::foo' );
is( $meth->original_fully_qualified_name, 'Role::Foo::foo',
can_ok($x, $_) for qw[baz gorch];
- ok(!$x->can($_), '... cant call method ' . $_) for qw[foo bar];
+ ok(!$x->can($_), 'cant call method ' . $_) for qw[foo bar];
- is($x->baz, 'FOO', '... got the right value');
- is($x->gorch, 'BAR', '... got the right value');
+ is($x->baz, 'FOO', 'got the right value');
+ is($x->gorch, 'BAR', 'got the right value');
}
{
can_ok($x, $_) for qw[baz gorch];
- ok(!$x->can($_), '... cant call method ' . $_) for qw[foo bar];
+ ok(!$x->can($_), 'cant call method ' . $_) for qw[foo bar];
- is($x->baz, 'FOO', '... got the right value');
- is($x->gorch, 'BAR', '... got the right value');
+ is($x->baz, 'FOO', 'got the right value');
+ is($x->gorch, 'BAR', 'got the right value');
}
Moose::Util::TypeConstraints->export_type_constraints_as_functions();
-ok(Number(5), '... this is a Num');
-ok(!defined(Number('Foo')), '... this is not a Num');
+ok(Number(5), 'this is a Num');
+ok(!defined(Number('Foo')), 'this is not a Num');
{
my $number_tc = Moose::Util::TypeConstraints::find_type_constraint('Number');
- is("$number_tc", 'Number', '... type constraint stringifies to name');
+ is("$number_tc", 'Number', 'type constraint stringifies to name');
}
-ok(String('Foo'), '... this is a Str');
-ok(!defined(String(5)), '... this is not a Str');
+ok(String('Foo'), 'this is a Str');
+ok(!defined(String(5)), 'this is not a Str');
-ok(Natural(5), '... this is a Natural');
-is(Natural(-5), undef, '... this is not a Natural');
-is(Natural('Foo'), undef, '... this is not a Natural');
+ok(Natural(5), 'this is a Natural');
+is(Natural(-5), undef, 'this is not a Natural');
+is(Natural('Foo'), undef, 'this is not a Natural');
-ok(NaturalLessThanTen(5), '... this is a NaturalLessThanTen');
-is(NaturalLessThanTen(12), undef, '... this is not a NaturalLessThanTen');
-is(NaturalLessThanTen(-5), undef, '... this is not a NaturalLessThanTen');
-is(NaturalLessThanTen('Foo'), undef, '... this is not a NaturalLessThanTen');
+ok(NaturalLessThanTen(5), 'this is a NaturalLessThanTen');
+is(NaturalLessThanTen(12), undef, 'this is not a NaturalLessThanTen');
+is(NaturalLessThanTen(-5), undef, 'this is not a NaturalLessThanTen');
+is(NaturalLessThanTen('Foo'), undef, 'this is not a NaturalLessThanTen');
# anon sub-typing
my $negative = subtype Number => where { $_ < 0 };
-ok(defined $negative, '... got a value back from negative');
+ok(defined $negative, 'got a value back from negative');
isa_ok($negative, 'Moose::Meta::TypeConstraint');
-ok($negative->check(-5), '... this is a negative number');
-ok(!defined($negative->check(5)), '... this is not a negative number');
-is($negative->check('Foo'), undef, '... this is not a negative number');
+ok($negative->check(-5), 'this is a negative number');
+ok(!defined($negative->check(5)), 'this is not a negative number');
+is($negative->check('Foo'), undef, 'this is not a negative number');
-ok($negative->is_subtype_of('Number'), '... $negative is a subtype of Number');
-ok(!$negative->is_subtype_of('String'), '... $negative is not a subtype of String');
+ok($negative->is_subtype_of('Number'), '$negative is a subtype of Number');
+ok(!$negative->is_subtype_of('String'), '$negative is not a subtype of String');
my $negative2 = subtype Number => where { $_ < 0 } => message {"$_ is not a negative number"};
-ok(defined $negative2, '... got a value back from negative');
+ok(defined $negative2, 'got a value back from negative');
isa_ok($negative2, 'Moose::Meta::TypeConstraint');
-ok($negative2->check(-5), '... this is a negative number');
-ok(!defined($negative2->check(5)), '... this is not a negative number');
-is($negative2->check('Foo'), undef, '... this is not a negative number');
+ok($negative2->check(-5), 'this is a negative number');
+ok(!defined($negative2->check(5)), 'this is not a negative number');
+is($negative2->check('Foo'), undef, 'this is not a negative number');
-ok($negative2->is_subtype_of('Number'), '... $negative2 is a subtype of Number');
-ok(!$negative2->is_subtype_of('String'), '... $negative is not a subtype of String');
+ok($negative2->is_subtype_of('Number'), '$negative2 is a subtype of Number');
+ok(!$negative2->is_subtype_of('String'), '$negative is not a subtype of String');
-ok($negative2->has_message, '... it has a message');
+ok($negative2->has_message, 'it has a message');
is($negative2->validate(2),
'2 is not a negative number',
- '... validated unsuccessfully (got error)');
+ 'validated unsuccessfully (got error)');
# check some meta-details
my $natural_less_than_ten = find_type_constraint('NaturalLessThanTen');
isa_ok($natural_less_than_ten, 'Moose::Meta::TypeConstraint');
-ok($natural_less_than_ten->is_subtype_of('Natural'), '... NaturalLessThanTen is subtype of Natural');
-ok($natural_less_than_ten->is_subtype_of('Number'), '... NaturalLessThanTen is subtype of Number');
-ok(!$natural_less_than_ten->is_subtype_of('String'), '... NaturalLessThanTen is not subtype of String');
+ok($natural_less_than_ten->is_subtype_of('Natural'), 'NaturalLessThanTen is subtype of Natural');
+ok($natural_less_than_ten->is_subtype_of('Number'), 'NaturalLessThanTen is subtype of Number');
+ok(!$natural_less_than_ten->is_subtype_of('String'), 'NaturalLessThanTen is not subtype of String');
-ok($natural_less_than_ten->has_message, '... it has a message');
+ok($natural_less_than_ten->has_message, 'it has a message');
-ok(!defined($natural_less_than_ten->validate(5)), '... validated successfully (no error)');
+ok(!defined($natural_less_than_ten->validate(5)), 'validated successfully (no error)');
is($natural_less_than_ten->validate(15),
"The number '15' is not less than 10",
- '... validated unsuccessfully (got error)');
+ 'validated unsuccessfully (got error)');
my $natural = find_type_constraint('Natural');
isa_ok($natural, 'Moose::Meta::TypeConstraint');
-ok($natural->is_subtype_of('Number'), '... Natural is a subtype of Number');
-ok(!$natural->is_subtype_of('String'), '... Natural is not a subtype of String');
+ok($natural->is_subtype_of('Number'), 'Natural is a subtype of Number');
+ok(!$natural->is_subtype_of('String'), 'Natural is not a subtype of String');
-ok(!$natural->has_message, '... it does not have a message');
+ok(!$natural->has_message, 'it does not have a message');
-ok(!defined($natural->validate(5)), '... validated successfully (no error)');
+ok(!defined($natural->validate(5)), 'validated successfully (no error)');
is($natural->validate(-5),
"Validation failed for 'Natural' failed with value -5",
- '... validated unsuccessfully (got error)');
+ 'validated unsuccessfully (got error)');
my $string = find_type_constraint('String');
isa_ok($string, 'Moose::Meta::TypeConstraint');
-ok($string->has_message, '... it does have a message');
+ok($string->has_message, 'it does have a message');
-ok(!defined($string->validate("Five")), '... validated successfully (no error)');
+ok(!defined($string->validate("Five")), 'validated successfully (no error)');
is($string->validate(5),
"This is not a string (5)",
-'... validated unsuccessfully (got error)');
+'validated unsuccessfully (got error)');
lives_ok { Moose::Meta::Attribute->new('bob', isa => 'Spong') }
'meta-attr construction ok even when type constraint utils loaded first';
{
my $type = type( 'Number2', sub { Scalar::Util::looks_like_number($_) } );
- ok( $type->check(5), '... this is a Num' );
- ok( ! $type->check('Foo'), '... this is not a Num' );
+ ok( $type->check(5), 'this is a Num' );
+ ok( ! $type->check('Foo'), 'this is not a Num' );
}
{
# anon subtype
my $subtype = subtype( 'Number2', sub { $_ > 0 } );
- ok( $subtype->check(5), '... this is a Natural');
- ok( ! $subtype->check(-5), '... this is not a Natural');
- ok( ! $subtype->check('Foo'), '... this is not a Natural');
+ ok( $subtype->check(5), 'this is a Natural');
+ ok( ! $subtype->check(-5), 'this is not a Natural');
+ ok( ! $subtype->check('Foo'), 'this is not a Natural');
}
{
my $subtype = subtype( 'Natural2', 'Number2', sub { $_ > 0 } );
- ok( $subtype->check(5), '... this is a Natural');
- ok( ! $subtype->check(-5), '... this is not a Natural');
- ok( ! $subtype->check('Foo'), '... this is not a Natural');
+ ok( $subtype->check(5), 'this is a Natural');
+ ok( ! $subtype->check(-5), 'this is not a Natural');
+ ok( ! $subtype->check('Foo'), 'this is not a Natural');
}
{
my $subtype = subtype( 'Natural3', 'Number2' );
- ok( $subtype->check(5), '... this is a Natural');
- ok( $subtype->check(-5), '... this is a Natural');
- ok( ! $subtype->check('Foo'), '... this is not a Natural');
+ ok( $subtype->check(5), 'this is a Natural');
+ ok( $subtype->check(-5), 'this is a Natural');
+ ok( ! $subtype->check('Foo'), 'this is not a Natural');
}
eval {
type MyRef => where { ref($_) };
};
- ::ok( !$@, '... successfully exported &type to Foo package' );
+ ::ok( !$@, 'successfully exported &type to Foo package' );
eval {
subtype MyArrayRef => as MyRef => where { ref($_) eq 'ARRAY' };
};
- ::ok( !$@, '... successfully exported &subtype to Foo package' );
+ ::ok( !$@, 'successfully exported &subtype to Foo package' );
Moose::Util::TypeConstraints->export_type_constraints_as_functions();
- ::ok( MyRef( {} ), '... Ref worked correctly' );
- ::ok( MyArrayRef( [] ), '... ArrayRef worked correctly' );
+ ::ok( MyRef( {} ), 'Ref worked correctly' );
+ ::ok( MyArrayRef( [] ), 'ArrayRef worked correctly' );
}
Moose::Util::TypeConstraints->export_type_constraints_as_functions();
-ok(defined Any(0), '... Any accepts anything');
-ok(defined Any(100), '... Any accepts anything');
-ok(defined Any(''), '... Any accepts anything');
-ok(defined Any('Foo'), '... Any accepts anything');
-ok(defined Any([]), '... Any accepts anything');
-ok(defined Any({}), '... Any accepts anything');
-ok(defined Any(sub {}), '... Any accepts anything');
-ok(defined Any($SCALAR_REF), '... Any accepts anything');
-ok(defined Any($GLOB_REF), '... Any accepts anything');
-ok(defined Any($fh), '... Any accepts anything');
-ok(defined Any(qr/../), '... Any accepts anything');
-ok(defined Any(bless {}, 'Foo'), '... Any accepts anything');
-ok(defined Any(undef), '... Any accepts anything');
-
-ok(defined Item(0), '... Item is the base type, so accepts anything');
-ok(defined Item(100), '... Item is the base type, so accepts anything');
-ok(defined Item(''), '... Item is the base type, so accepts anything');
-ok(defined Item('Foo'), '... Item is the base type, so accepts anything');
-ok(defined Item([]), '... Item is the base type, so accepts anything');
-ok(defined Item({}), '... Item is the base type, so accepts anything');
-ok(defined Item(sub {}), '... Item is the base type, so accepts anything');
-ok(defined Item($SCALAR_REF), '... Item is the base type, so accepts anything');
-ok(defined Item($GLOB_REF), '... Item is the base type, so accepts anything');
-ok(defined Item($fh), '... Item is the base type, so accepts anything');
-ok(defined Item(qr/../), '... Item is the base type, so accepts anything');
-ok(defined Item(bless {}, 'Foo'), '... Item is the base type, so accepts anything');
-ok(defined Item(undef), '... Item is the base type, so accepts anything');
-
-ok(defined Defined(0), '... Defined accepts anything which is defined');
-ok(defined Defined(100), '... Defined accepts anything which is defined');
-ok(defined Defined(''), '... Defined accepts anything which is defined');
-ok(defined Defined('Foo'), '... Defined accepts anything which is defined');
-ok(defined Defined([]), '... Defined accepts anything which is defined');
-ok(defined Defined({}), '... Defined accepts anything which is defined');
-ok(defined Defined(sub {}), '... Defined accepts anything which is defined');
-ok(defined Defined($SCALAR_REF), '... Defined accepts anything which is defined');
-ok(defined Defined($GLOB_REF), '... Defined accepts anything which is defined');
-ok(defined Defined($fh), '... Defined accepts anything which is defined');
-ok(defined Defined(qr/../), '... Defined accepts anything which is defined');
-ok(defined Defined(bless {}, 'Foo'), '... Defined accepts anything which is defined');
-ok(!defined Defined(undef), '... Defined accepts anything which is defined');
-
-ok(!defined Undef(0), '... Undef accepts anything which is not defined');
-ok(!defined Undef(100), '... Undef accepts anything which is not defined');
-ok(!defined Undef(''), '... Undef accepts anything which is not defined');
-ok(!defined Undef('Foo'), '... Undef accepts anything which is not defined');
-ok(!defined Undef([]), '... Undef accepts anything which is not defined');
-ok(!defined Undef({}), '... Undef accepts anything which is not defined');
-ok(!defined Undef(sub {}), '... Undef accepts anything which is not defined');
-ok(!defined Undef($SCALAR_REF), '... Undef accepts anything which is not defined');
-ok(!defined Undef($GLOB_REF), '... Undef accepts anything which is not defined');
-ok(!defined Undef($fh), '... Undef accepts anything which is not defined');
-ok(!defined Undef(qr/../), '... Undef accepts anything which is not defined');
-ok(!defined Undef(bless {}, 'Foo'), '... Undef accepts anything which is not defined');
-ok(defined Undef(undef), '... Undef accepts anything which is not defined');
-
-ok(defined Bool(0), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
-ok(defined Bool(1), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
-ok(!defined Bool(100), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
-ok(defined Bool(''), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
-ok(!defined Bool('Foo'), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
-ok(!defined Bool([]), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
-ok(!defined Bool({}), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
-ok(!defined Bool(sub {}), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
-ok(!defined Bool($SCALAR_REF), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
-ok(!defined Bool($GLOB_REF), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
-ok(!defined Bool($fh), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
-ok(!defined Bool(qr/../), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
-ok(!defined Bool(bless {}, 'Foo'), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
-ok(defined Bool(undef), '... Bool rejects anything which is not a 1 or 0 or "" or undef');
-
-ok(defined Value(0), '... Value accepts anything which is not a Ref');
-ok(defined Value(100), '... Value accepts anything which is not a Ref');
-ok(defined Value(''), '... Value accepts anything which is not a Ref');
-ok(defined Value('Foo'), '... Value accepts anything which is not a Ref');
-ok(!defined Value([]), '... Value rejects anything which is not a Value');
-ok(!defined Value({}), '... Value rejects anything which is not a Value');
-ok(!defined Value(sub {}), '... Value rejects anything which is not a Value');
-ok(!defined Value($SCALAR_REF), '... Value rejects anything which is not a Value');
-ok(!defined Value($GLOB_REF), '... Value rejects anything which is not a Value');
-ok(!defined Value($fh), '... Value rejects anything which is not a Value');
-ok(!defined Value(qr/../), '... Value rejects anything which is not a Value');
-ok(!defined Value(bless {}, 'Foo'), '... Value rejects anything which is not a Value');
-ok(!defined Value(undef), '... Value rejects anything which is not a Value');
-
-ok(!defined Ref(0), '... Ref accepts anything which is not a Value');
-ok(!defined Ref(100), '... Ref accepts anything which is not a Value');
-ok(!defined Ref(''), '... Ref accepts anything which is not a Value');
-ok(!defined Ref('Foo'), '... Ref accepts anything which is not a Value');
-ok(defined Ref([]), '... Ref rejects anything which is not a Ref');
-ok(defined Ref({}), '... Ref rejects anything which is not a Ref');
-ok(defined Ref(sub {}), '... Ref rejects anything which is not a Ref');
-ok(defined Ref($SCALAR_REF), '... Ref rejects anything which is not a Ref');
-ok(defined Ref($GLOB_REF), '... Ref rejects anything which is not a Ref');
-ok(defined Ref($fh), '... Ref rejects anything which is not a Ref');
-ok(defined Ref(qr/../), '... Ref rejects anything which is not a Ref');
-ok(defined Ref(bless {}, 'Foo'), '... Ref rejects anything which is not a Ref');
-ok(!defined Ref(undef), '... Ref rejects anything which is not a Ref');
-
-ok(defined Int(0), '... Int accepts anything which is an Int');
-ok(defined Int(100), '... Int accepts anything which is an Int');
-ok(!defined Int(0.5), '... Int accepts anything which is not a Int');
-ok(!defined Int(100.01), '... Int accepts anything which is not a Int');
-ok(!defined Int(''), '... Int rejects anything which is not a Int');
-ok(!defined Int('Foo'), '... Int rejects anything which is not a Int');
-ok(!defined Int([]), '... Int rejects anything which is not a Int');
-ok(!defined Int({}), '... Int rejects anything which is not a Int');
-ok(!defined Int(sub {}), '... Int rejects anything which is not a Int');
-ok(!defined Int($SCALAR_REF), '... Int rejects anything which is not a Int');
-ok(!defined Int($GLOB_REF), '... Int rejects anything which is not a Int');
-ok(!defined Int($fh), '... Int rejects anything which is not a Int');
-ok(!defined Int(qr/../), '... Int rejects anything which is not a Int');
-ok(!defined Int(bless {}, 'Foo'), '... Int rejects anything which is not a Int');
-ok(!defined Int(undef), '... Int rejects anything which is not a Int');
-
-ok(defined Num(0), '... Num accepts anything which is an Num');
-ok(defined Num(100), '... Num accepts anything which is an Num');
-ok(defined Num(0.5), '... Num accepts anything which is an Num');
-ok(defined Num(100.01), '... Num accepts anything which is an Num');
-ok(!defined Num(''), '... Num rejects anything which is not a Num');
-ok(!defined Num('Foo'), '... Num rejects anything which is not a Num');
-ok(!defined Num([]), '... Num rejects anything which is not a Num');
-ok(!defined Num({}), '... Num rejects anything which is not a Num');
-ok(!defined Num(sub {}), '... Num rejects anything which is not a Num');
-ok(!defined Num($SCALAR_REF), '... Num rejects anything which is not a Num');
-ok(!defined Num($GLOB_REF), '... Num rejects anything which is not a Num');
-ok(!defined Num($fh), '... Num rejects anything which is not a Num');
-ok(!defined Num(qr/../), '... Num rejects anything which is not a Num');
-ok(!defined Num(bless {}, 'Foo'), '... Num rejects anything which is not a Num');
-ok(!defined Num(undef), '... Num rejects anything which is not a Num');
-
-ok(defined Str(0), '... Str accepts anything which is a Str');
-ok(defined Str(100), '... Str accepts anything which is a Str');
-ok(defined Str(''), '... Str accepts anything which is a Str');
-ok(defined Str('Foo'), '... Str accepts anything which is a Str');
-ok(!defined Str([]), '... Str rejects anything which is not a Str');
-ok(!defined Str({}), '... Str rejects anything which is not a Str');
-ok(!defined Str(sub {}), '... Str rejects anything which is not a Str');
-ok(!defined Str($SCALAR_REF), '... Str rejects anything which is not a Str');
-ok(!defined Str($fh), '... Str rejects anything which is not a Str');
-ok(!defined Str($GLOB_REF), '... Str rejects anything which is not a Str');
-ok(!defined Str(qr/../), '... Str rejects anything which is not a Str');
-ok(!defined Str(bless {}, 'Foo'), '... Str rejects anything which is not a Str');
-ok(!defined Str(undef), '... Str rejects anything which is not a Str');
-
-ok(!defined ScalarRef(0), '... ScalarRef rejects anything which is not a ScalarRef');
-ok(!defined ScalarRef(100), '... ScalarRef rejects anything which is not a ScalarRef');
-ok(!defined ScalarRef(''), '... ScalarRef rejects anything which is not a ScalarRef');
-ok(!defined ScalarRef('Foo'), '... ScalarRef rejects anything which is not a ScalarRef');
-ok(!defined ScalarRef([]), '... ScalarRef rejects anything which is not a ScalarRef');
-ok(!defined ScalarRef({}), '... ScalarRef rejects anything which is not a ScalarRef');
-ok(!defined ScalarRef(sub {}), '... ScalarRef rejects anything which is not a ScalarRef');
-ok(defined ScalarRef($SCALAR_REF), '... ScalarRef accepts anything which is a ScalarRef');
-ok(!defined ScalarRef($GLOB_REF), '... ScalarRef rejects anything which is not a ScalarRef');
-ok(!defined ScalarRef($fh), '... ScalarRef rejects anything which is not a ScalarRef');
-ok(!defined ScalarRef(qr/../), '... ScalarRef rejects anything which is not a ScalarRef');
-ok(!defined ScalarRef(bless {}, 'Foo'), '... ScalarRef rejects anything which is not a ScalarRef');
-ok(!defined ScalarRef(undef), '... ScalarRef rejects anything which is not a ScalarRef');
-
-ok(!defined ArrayRef(0), '... ArrayRef rejects anything which is not a ArrayRef');
-ok(!defined ArrayRef(100), '... ArrayRef rejects anything which is not a ArrayRef');
-ok(!defined ArrayRef(''), '... ArrayRef rejects anything which is not a ArrayRef');
-ok(!defined ArrayRef('Foo'), '... ArrayRef rejects anything which is not a ArrayRef');
-ok(defined ArrayRef([]), '... ArrayRef accepts anything which is a ArrayRef');
-ok(!defined ArrayRef({}), '... ArrayRef rejects anything which is not a ArrayRef');
-ok(!defined ArrayRef(sub {}), '... ArrayRef rejects anything which is not a ArrayRef');
-ok(!defined ArrayRef($SCALAR_REF), '... ArrayRef rejects anything which is not a ArrayRef');
-ok(!defined ArrayRef($GLOB_REF), '... ArrayRef rejects anything which is not a ArrayRef');
-ok(!defined ArrayRef($fh), '... ArrayRef rejects anything which is not a ArrayRef');
-ok(!defined ArrayRef(qr/../), '... ArrayRef rejects anything which is not a ArrayRef');
-ok(!defined ArrayRef(bless {}, 'Foo'), '... ArrayRef rejects anything which is not a ArrayRef');
-ok(!defined ArrayRef(undef), '... ArrayRef rejects anything which is not a ArrayRef');
-
-ok(!defined HashRef(0), '... HashRef rejects anything which is not a HashRef');
-ok(!defined HashRef(100), '... HashRef rejects anything which is not a HashRef');
-ok(!defined HashRef(''), '... HashRef rejects anything which is not a HashRef');
-ok(!defined HashRef('Foo'), '... HashRef rejects anything which is not a HashRef');
-ok(!defined HashRef([]), '... HashRef rejects anything which is not a HashRef');
-ok(defined HashRef({}), '... HashRef accepts anything which is a HashRef');
-ok(!defined HashRef(sub {}), '... HashRef rejects anything which is not a HashRef');
-ok(!defined HashRef($SCALAR_REF), '... HashRef rejects anything which is not a HashRef');
-ok(!defined HashRef($GLOB_REF), '... HashRef rejects anything which is not a HashRef');
-ok(!defined HashRef($fh), '... HashRef rejects anything which is not a HashRef');
-ok(!defined HashRef(qr/../), '... HashRef rejects anything which is not a HashRef');
-ok(!defined HashRef(bless {}, 'Foo'), '... HashRef rejects anything which is not a HashRef');
-ok(!defined HashRef(undef), '... HashRef rejects anything which is not a HashRef');
-
-ok(!defined CodeRef(0), '... CodeRef rejects anything which is not a CodeRef');
-ok(!defined CodeRef(100), '... CodeRef rejects anything which is not a CodeRef');
-ok(!defined CodeRef(''), '... CodeRef rejects anything which is not a CodeRef');
-ok(!defined CodeRef('Foo'), '... CodeRef rejects anything which is not a CodeRef');
-ok(!defined CodeRef([]), '... CodeRef rejects anything which is not a CodeRef');
-ok(!defined CodeRef({}), '... CodeRef rejects anything which is not a CodeRef');
-ok(defined CodeRef(sub {}), '... CodeRef accepts anything which is a CodeRef');
-ok(!defined CodeRef($SCALAR_REF), '... CodeRef rejects anything which is not a CodeRef');
-ok(!defined CodeRef($GLOB_REF), '... CodeRef rejects anything which is not a CodeRef');
-ok(!defined CodeRef($fh), '... CodeRef rejects anything which is not a CodeRef');
-ok(!defined CodeRef(qr/../), '... CodeRef rejects anything which is not a CodeRef');
-ok(!defined CodeRef(bless {}, 'Foo'), '... CodeRef rejects anything which is not a CodeRef');
-ok(!defined CodeRef(undef), '... CodeRef rejects anything which is not a CodeRef');
-
-ok(!defined RegexpRef(0), '... RegexpRef rejects anything which is not a RegexpRef');
-ok(!defined RegexpRef(100), '... RegexpRef rejects anything which is not a RegexpRef');
-ok(!defined RegexpRef(''), '... RegexpRef rejects anything which is not a RegexpRef');
-ok(!defined RegexpRef('Foo'), '... RegexpRef rejects anything which is not a RegexpRef');
-ok(!defined RegexpRef([]), '... RegexpRef rejects anything which is not a RegexpRef');
-ok(!defined RegexpRef({}), '... RegexpRef rejects anything which is not a RegexpRef');
-ok(!defined RegexpRef(sub {}), '... RegexpRef rejects anything which is not a RegexpRef');
-ok(!defined RegexpRef($SCALAR_REF), '... RegexpRef rejects anything which is not a RegexpRef');
-ok(!defined RegexpRef($GLOB_REF), '... RegexpRef rejects anything which is not a RegexpRef');
-ok(!defined RegexpRef($fh), '... RegexpRef rejects anything which is not a RegexpRef');
-ok(defined RegexpRef(qr/../), '... RegexpRef accepts anything which is a RegexpRef');
-ok(!defined RegexpRef(bless {}, 'Foo'), '... RegexpRef rejects anything which is not a RegexpRef');
-ok(!defined RegexpRef(undef), '... RegexpRef rejects anything which is not a RegexpRef');
-
-ok(!defined GlobRef(0), '... GlobRef rejects anything which is not a GlobRef');
-ok(!defined GlobRef(100), '... GlobRef rejects anything which is not a GlobRef');
-ok(!defined GlobRef(''), '... GlobRef rejects anything which is not a GlobRef');
-ok(!defined GlobRef('Foo'), '... GlobRef rejects anything which is not a GlobRef');
-ok(!defined GlobRef([]), '... GlobRef rejects anything which is not a GlobRef');
-ok(!defined GlobRef({}), '... GlobRef rejects anything which is not a GlobRef');
-ok(!defined GlobRef(sub {}), '... GlobRef rejects anything which is not a GlobRef');
-ok(!defined GlobRef($SCALAR_REF), '... GlobRef rejects anything which is not a GlobRef');
-ok(defined GlobRef($GLOB_REF), '... GlobRef accepts anything which is a GlobRef');
-ok(defined GlobRef($fh), '... GlobRef accepts anything which is a GlobRef');
-ok(!defined GlobRef($fh_obj), '... GlobRef rejects anything which is not a GlobRef');
-ok(!defined GlobRef(qr/../), '... GlobRef rejects anything which is not a GlobRef');
-ok(!defined GlobRef(bless {}, 'Foo'), '... GlobRef rejects anything which is not a GlobRef');
-ok(!defined GlobRef(undef), '... GlobRef rejects anything which is not a GlobRef');
-
-ok(!defined FileHandle(0), '... FileHandle rejects anything which is not a FileHandle');
-ok(!defined FileHandle(100), '... FileHandle rejects anything which is not a FileHandle');
-ok(!defined FileHandle(''), '... FileHandle rejects anything which is not a FileHandle');
-ok(!defined FileHandle('Foo'), '... FileHandle rejects anything which is not a FileHandle');
-ok(!defined FileHandle([]), '... FileHandle rejects anything which is not a FileHandle');
-ok(!defined FileHandle({}), '... FileHandle rejects anything which is not a FileHandle');
-ok(!defined FileHandle(sub {}), '... FileHandle rejects anything which is not a FileHandle');
-ok(!defined FileHandle($SCALAR_REF), '... FileHandle rejects anything which is not a FileHandle');
-ok(!defined FileHandle($GLOB_REF), '... FileHandle rejects anything which is not a FileHandle');
-ok(defined FileHandle($fh), '... FileHandle accepts anything which is a FileHandle');
-ok(defined FileHandle($fh_obj), '... FileHandle accepts anything which is a FileHandle');
-ok(!defined FileHandle(qr/../), '... FileHandle rejects anything which is not a FileHandle');
-ok(!defined FileHandle(bless {}, 'Foo'), '... FileHandle rejects anything which is not a FileHandle');
-ok(!defined FileHandle(undef), '... FileHandle rejects anything which is not a FileHandle');
-
-ok(!defined Object(0), '... Object rejects anything which is not blessed');
-ok(!defined Object(100), '... Object rejects anything which is not blessed');
-ok(!defined Object(''), '... Object rejects anything which is not blessed');
-ok(!defined Object('Foo'), '... Object rejects anything which is not blessed');
-ok(!defined Object([]), '... Object rejects anything which is not blessed');
-ok(!defined Object({}), '... Object rejects anything which is not blessed');
-ok(!defined Object(sub {}), '... Object rejects anything which is not blessed');
-ok(!defined Object($SCALAR_REF), '... Object rejects anything which is not blessed');
-ok(!defined Object($GLOB_REF), '... Object rejects anything which is not blessed');
-ok(!defined Object($fh), '... Object rejects anything which is not blessed');
-ok(!defined Object(qr/../), '... Object rejects anything which is not blessed');
-ok(defined Object(bless {}, 'Foo'), '... Object accepts anything which is blessed');
-ok(!defined Object(undef), '... Object accepts anything which is blessed');
-
-ok(!defined ClassName(0), '... ClassName rejects anything which is not a ClassName');
-ok(!defined ClassName(100), '... ClassName rejects anything which is not a ClassName');
-ok(!defined ClassName(''), '... ClassName rejects anything which is not a ClassName');
-ok(!defined ClassName('Baz'), '... ClassName rejects anything which is not a ClassName');
+ok(defined Any(0), 'Any accepts anything');
+ok(defined Any(100), 'Any accepts anything');
+ok(defined Any(''), 'Any accepts anything');
+ok(defined Any('Foo'), 'Any accepts anything');
+ok(defined Any([]), 'Any accepts anything');
+ok(defined Any({}), 'Any accepts anything');
+ok(defined Any(sub {}), 'Any accepts anything');
+ok(defined Any($SCALAR_REF), 'Any accepts anything');
+ok(defined Any($GLOB_REF), 'Any accepts anything');
+ok(defined Any($fh), 'Any accepts anything');
+ok(defined Any(qr/../), 'Any accepts anything');
+ok(defined Any(bless {}, 'Foo'), 'Any accepts anything');
+ok(defined Any(undef), 'Any accepts anything');
+
+ok(defined Item(0), 'Item is the base type, so accepts anything');
+ok(defined Item(100), 'Item is the base type, so accepts anything');
+ok(defined Item(''), 'Item is the base type, so accepts anything');
+ok(defined Item('Foo'), 'Item is the base type, so accepts anything');
+ok(defined Item([]), 'Item is the base type, so accepts anything');
+ok(defined Item({}), 'Item is the base type, so accepts anything');
+ok(defined Item(sub {}), 'Item is the base type, so accepts anything');
+ok(defined Item($SCALAR_REF), 'Item is the base type, so accepts anything');
+ok(defined Item($GLOB_REF), 'Item is the base type, so accepts anything');
+ok(defined Item($fh), 'Item is the base type, so accepts anything');
+ok(defined Item(qr/../), 'Item is the base type, so accepts anything');
+ok(defined Item(bless {}, 'Foo'), 'Item is the base type, so accepts anything');
+ok(defined Item(undef), 'Item is the base type, so accepts anything');
+
+ok(defined Defined(0), 'Defined accepts anything which is defined');
+ok(defined Defined(100), 'Defined accepts anything which is defined');
+ok(defined Defined(''), 'Defined accepts anything which is defined');
+ok(defined Defined('Foo'), 'Defined accepts anything which is defined');
+ok(defined Defined([]), 'Defined accepts anything which is defined');
+ok(defined Defined({}), 'Defined accepts anything which is defined');
+ok(defined Defined(sub {}), 'Defined accepts anything which is defined');
+ok(defined Defined($SCALAR_REF), 'Defined accepts anything which is defined');
+ok(defined Defined($GLOB_REF), 'Defined accepts anything which is defined');
+ok(defined Defined($fh), 'Defined accepts anything which is defined');
+ok(defined Defined(qr/../), 'Defined accepts anything which is defined');
+ok(defined Defined(bless {}, 'Foo'), 'Defined accepts anything which is defined');
+ok(!defined Defined(undef), 'Defined accepts anything which is defined');
+
+ok(!defined Undef(0), 'Undef accepts anything which is not defined');
+ok(!defined Undef(100), 'Undef accepts anything which is not defined');
+ok(!defined Undef(''), 'Undef accepts anything which is not defined');
+ok(!defined Undef('Foo'), 'Undef accepts anything which is not defined');
+ok(!defined Undef([]), 'Undef accepts anything which is not defined');
+ok(!defined Undef({}), 'Undef accepts anything which is not defined');
+ok(!defined Undef(sub {}), 'Undef accepts anything which is not defined');
+ok(!defined Undef($SCALAR_REF), 'Undef accepts anything which is not defined');
+ok(!defined Undef($GLOB_REF), 'Undef accepts anything which is not defined');
+ok(!defined Undef($fh), 'Undef accepts anything which is not defined');
+ok(!defined Undef(qr/../), 'Undef accepts anything which is not defined');
+ok(!defined Undef(bless {}, 'Foo'), 'Undef accepts anything which is not defined');
+ok(defined Undef(undef), 'Undef accepts anything which is not defined');
+
+ok(defined Bool(0), 'Bool rejects anything which is not a 1 or 0 or "" or undef');
+ok(defined Bool(1), 'Bool rejects anything which is not a 1 or 0 or "" or undef');
+ok(!defined Bool(100), 'Bool rejects anything which is not a 1 or 0 or "" or undef');
+ok(defined Bool(''), 'Bool rejects anything which is not a 1 or 0 or "" or undef');
+ok(!defined Bool('Foo'), 'Bool rejects anything which is not a 1 or 0 or "" or undef');
+ok(!defined Bool([]), 'Bool rejects anything which is not a 1 or 0 or "" or undef');
+ok(!defined Bool({}), 'Bool rejects anything which is not a 1 or 0 or "" or undef');
+ok(!defined Bool(sub {}), 'Bool rejects anything which is not a 1 or 0 or "" or undef');
+ok(!defined Bool($SCALAR_REF), 'Bool rejects anything which is not a 1 or 0 or "" or undef');
+ok(!defined Bool($GLOB_REF), 'Bool rejects anything which is not a 1 or 0 or "" or undef');
+ok(!defined Bool($fh), 'Bool rejects anything which is not a 1 or 0 or "" or undef');
+ok(!defined Bool(qr/../), 'Bool rejects anything which is not a 1 or 0 or "" or undef');
+ok(!defined Bool(bless {}, 'Foo'), 'Bool rejects anything which is not a 1 or 0 or "" or undef');
+ok(defined Bool(undef), 'Bool rejects anything which is not a 1 or 0 or "" or undef');
+
+ok(defined Value(0), 'Value accepts anything which is not a Ref');
+ok(defined Value(100), 'Value accepts anything which is not a Ref');
+ok(defined Value(''), 'Value accepts anything which is not a Ref');
+ok(defined Value('Foo'), 'Value accepts anything which is not a Ref');
+ok(!defined Value([]), 'Value rejects anything which is not a Value');
+ok(!defined Value({}), 'Value rejects anything which is not a Value');
+ok(!defined Value(sub {}), 'Value rejects anything which is not a Value');
+ok(!defined Value($SCALAR_REF), 'Value rejects anything which is not a Value');
+ok(!defined Value($GLOB_REF), 'Value rejects anything which is not a Value');
+ok(!defined Value($fh), 'Value rejects anything which is not a Value');
+ok(!defined Value(qr/../), 'Value rejects anything which is not a Value');
+ok(!defined Value(bless {}, 'Foo'), 'Value rejects anything which is not a Value');
+ok(!defined Value(undef), 'Value rejects anything which is not a Value');
+
+ok(!defined Ref(0), 'Ref accepts anything which is not a Value');
+ok(!defined Ref(100), 'Ref accepts anything which is not a Value');
+ok(!defined Ref(''), 'Ref accepts anything which is not a Value');
+ok(!defined Ref('Foo'), 'Ref accepts anything which is not a Value');
+ok(defined Ref([]), 'Ref rejects anything which is not a Ref');
+ok(defined Ref({}), 'Ref rejects anything which is not a Ref');
+ok(defined Ref(sub {}), 'Ref rejects anything which is not a Ref');
+ok(defined Ref($SCALAR_REF), 'Ref rejects anything which is not a Ref');
+ok(defined Ref($GLOB_REF), 'Ref rejects anything which is not a Ref');
+ok(defined Ref($fh), 'Ref rejects anything which is not a Ref');
+ok(defined Ref(qr/../), 'Ref rejects anything which is not a Ref');
+ok(defined Ref(bless {}, 'Foo'), 'Ref rejects anything which is not a Ref');
+ok(!defined Ref(undef), 'Ref rejects anything which is not a Ref');
+
+ok(defined Int(0), 'Int accepts anything which is an Int');
+ok(defined Int(100), 'Int accepts anything which is an Int');
+ok(!defined Int(0.5), 'Int accepts anything which is not a Int');
+ok(!defined Int(100.01), 'Int accepts anything which is not a Int');
+ok(!defined Int(''), 'Int rejects anything which is not a Int');
+ok(!defined Int('Foo'), 'Int rejects anything which is not a Int');
+ok(!defined Int([]), 'Int rejects anything which is not a Int');
+ok(!defined Int({}), 'Int rejects anything which is not a Int');
+ok(!defined Int(sub {}), 'Int rejects anything which is not a Int');
+ok(!defined Int($SCALAR_REF), 'Int rejects anything which is not a Int');
+ok(!defined Int($GLOB_REF), 'Int rejects anything which is not a Int');
+ok(!defined Int($fh), 'Int rejects anything which is not a Int');
+ok(!defined Int(qr/../), 'Int rejects anything which is not a Int');
+ok(!defined Int(bless {}, 'Foo'), 'Int rejects anything which is not a Int');
+ok(!defined Int(undef), 'Int rejects anything which is not a Int');
+
+ok(defined Num(0), 'Num accepts anything which is an Num');
+ok(defined Num(100), 'Num accepts anything which is an Num');
+ok(defined Num(0.5), 'Num accepts anything which is an Num');
+ok(defined Num(100.01), 'Num accepts anything which is an Num');
+ok(!defined Num(''), 'Num rejects anything which is not a Num');
+ok(!defined Num('Foo'), 'Num rejects anything which is not a Num');
+ok(!defined Num([]), 'Num rejects anything which is not a Num');
+ok(!defined Num({}), 'Num rejects anything which is not a Num');
+ok(!defined Num(sub {}), 'Num rejects anything which is not a Num');
+ok(!defined Num($SCALAR_REF), 'Num rejects anything which is not a Num');
+ok(!defined Num($GLOB_REF), 'Num rejects anything which is not a Num');
+ok(!defined Num($fh), 'Num rejects anything which is not a Num');
+ok(!defined Num(qr/../), 'Num rejects anything which is not a Num');
+ok(!defined Num(bless {}, 'Foo'), 'Num rejects anything which is not a Num');
+ok(!defined Num(undef), 'Num rejects anything which is not a Num');
+
+ok(defined Str(0), 'Str accepts anything which is a Str');
+ok(defined Str(100), 'Str accepts anything which is a Str');
+ok(defined Str(''), 'Str accepts anything which is a Str');
+ok(defined Str('Foo'), 'Str accepts anything which is a Str');
+ok(!defined Str([]), 'Str rejects anything which is not a Str');
+ok(!defined Str({}), 'Str rejects anything which is not a Str');
+ok(!defined Str(sub {}), 'Str rejects anything which is not a Str');
+ok(!defined Str($SCALAR_REF), 'Str rejects anything which is not a Str');
+ok(!defined Str($fh), 'Str rejects anything which is not a Str');
+ok(!defined Str($GLOB_REF), 'Str rejects anything which is not a Str');
+ok(!defined Str(qr/../), 'Str rejects anything which is not a Str');
+ok(!defined Str(bless {}, 'Foo'), 'Str rejects anything which is not a Str');
+ok(!defined Str(undef), 'Str rejects anything which is not a Str');
+
+ok(!defined ScalarRef(0), 'ScalarRef rejects anything which is not a ScalarRef');
+ok(!defined ScalarRef(100), 'ScalarRef rejects anything which is not a ScalarRef');
+ok(!defined ScalarRef(''), 'ScalarRef rejects anything which is not a ScalarRef');
+ok(!defined ScalarRef('Foo'), 'ScalarRef rejects anything which is not a ScalarRef');
+ok(!defined ScalarRef([]), 'ScalarRef rejects anything which is not a ScalarRef');
+ok(!defined ScalarRef({}), 'ScalarRef rejects anything which is not a ScalarRef');
+ok(!defined ScalarRef(sub {}), 'ScalarRef rejects anything which is not a ScalarRef');
+ok(defined ScalarRef($SCALAR_REF), 'ScalarRef accepts anything which is a ScalarRef');
+ok(!defined ScalarRef($GLOB_REF), 'ScalarRef rejects anything which is not a ScalarRef');
+ok(!defined ScalarRef($fh), 'ScalarRef rejects anything which is not a ScalarRef');
+ok(!defined ScalarRef(qr/../), 'ScalarRef rejects anything which is not a ScalarRef');
+ok(!defined ScalarRef(bless {}, 'Foo'), 'ScalarRef rejects anything which is not a ScalarRef');
+ok(!defined ScalarRef(undef), 'ScalarRef rejects anything which is not a ScalarRef');
+
+ok(!defined ArrayRef(0), 'ArrayRef rejects anything which is not a ArrayRef');
+ok(!defined ArrayRef(100), 'ArrayRef rejects anything which is not a ArrayRef');
+ok(!defined ArrayRef(''), 'ArrayRef rejects anything which is not a ArrayRef');
+ok(!defined ArrayRef('Foo'), 'ArrayRef rejects anything which is not a ArrayRef');
+ok(defined ArrayRef([]), 'ArrayRef accepts anything which is a ArrayRef');
+ok(!defined ArrayRef({}), 'ArrayRef rejects anything which is not a ArrayRef');
+ok(!defined ArrayRef(sub {}), 'ArrayRef rejects anything which is not a ArrayRef');
+ok(!defined ArrayRef($SCALAR_REF), 'ArrayRef rejects anything which is not a ArrayRef');
+ok(!defined ArrayRef($GLOB_REF), 'ArrayRef rejects anything which is not a ArrayRef');
+ok(!defined ArrayRef($fh), 'ArrayRef rejects anything which is not a ArrayRef');
+ok(!defined ArrayRef(qr/../), 'ArrayRef rejects anything which is not a ArrayRef');
+ok(!defined ArrayRef(bless {}, 'Foo'), 'ArrayRef rejects anything which is not a ArrayRef');
+ok(!defined ArrayRef(undef), 'ArrayRef rejects anything which is not a ArrayRef');
+
+ok(!defined HashRef(0), 'HashRef rejects anything which is not a HashRef');
+ok(!defined HashRef(100), 'HashRef rejects anything which is not a HashRef');
+ok(!defined HashRef(''), 'HashRef rejects anything which is not a HashRef');
+ok(!defined HashRef('Foo'), 'HashRef rejects anything which is not a HashRef');
+ok(!defined HashRef([]), 'HashRef rejects anything which is not a HashRef');
+ok(defined HashRef({}), 'HashRef accepts anything which is a HashRef');
+ok(!defined HashRef(sub {}), 'HashRef rejects anything which is not a HashRef');
+ok(!defined HashRef($SCALAR_REF), 'HashRef rejects anything which is not a HashRef');
+ok(!defined HashRef($GLOB_REF), 'HashRef rejects anything which is not a HashRef');
+ok(!defined HashRef($fh), 'HashRef rejects anything which is not a HashRef');
+ok(!defined HashRef(qr/../), 'HashRef rejects anything which is not a HashRef');
+ok(!defined HashRef(bless {}, 'Foo'), 'HashRef rejects anything which is not a HashRef');
+ok(!defined HashRef(undef), 'HashRef rejects anything which is not a HashRef');
+
+ok(!defined CodeRef(0), 'CodeRef rejects anything which is not a CodeRef');
+ok(!defined CodeRef(100), 'CodeRef rejects anything which is not a CodeRef');
+ok(!defined CodeRef(''), 'CodeRef rejects anything which is not a CodeRef');
+ok(!defined CodeRef('Foo'), 'CodeRef rejects anything which is not a CodeRef');
+ok(!defined CodeRef([]), 'CodeRef rejects anything which is not a CodeRef');
+ok(!defined CodeRef({}), 'CodeRef rejects anything which is not a CodeRef');
+ok(defined CodeRef(sub {}), 'CodeRef accepts anything which is a CodeRef');
+ok(!defined CodeRef($SCALAR_REF), 'CodeRef rejects anything which is not a CodeRef');
+ok(!defined CodeRef($GLOB_REF), 'CodeRef rejects anything which is not a CodeRef');
+ok(!defined CodeRef($fh), 'CodeRef rejects anything which is not a CodeRef');
+ok(!defined CodeRef(qr/../), 'CodeRef rejects anything which is not a CodeRef');
+ok(!defined CodeRef(bless {}, 'Foo'), 'CodeRef rejects anything which is not a CodeRef');
+ok(!defined CodeRef(undef), 'CodeRef rejects anything which is not a CodeRef');
+
+ok(!defined RegexpRef(0), 'RegexpRef rejects anything which is not a RegexpRef');
+ok(!defined RegexpRef(100), 'RegexpRef rejects anything which is not a RegexpRef');
+ok(!defined RegexpRef(''), 'RegexpRef rejects anything which is not a RegexpRef');
+ok(!defined RegexpRef('Foo'), 'RegexpRef rejects anything which is not a RegexpRef');
+ok(!defined RegexpRef([]), 'RegexpRef rejects anything which is not a RegexpRef');
+ok(!defined RegexpRef({}), 'RegexpRef rejects anything which is not a RegexpRef');
+ok(!defined RegexpRef(sub {}), 'RegexpRef rejects anything which is not a RegexpRef');
+ok(!defined RegexpRef($SCALAR_REF), 'RegexpRef rejects anything which is not a RegexpRef');
+ok(!defined RegexpRef($GLOB_REF), 'RegexpRef rejects anything which is not a RegexpRef');
+ok(!defined RegexpRef($fh), 'RegexpRef rejects anything which is not a RegexpRef');
+ok(defined RegexpRef(qr/../), 'RegexpRef accepts anything which is a RegexpRef');
+ok(!defined RegexpRef(bless {}, 'Foo'), 'RegexpRef rejects anything which is not a RegexpRef');
+ok(!defined RegexpRef(undef), 'RegexpRef rejects anything which is not a RegexpRef');
+
+ok(!defined GlobRef(0), 'GlobRef rejects anything which is not a GlobRef');
+ok(!defined GlobRef(100), 'GlobRef rejects anything which is not a GlobRef');
+ok(!defined GlobRef(''), 'GlobRef rejects anything which is not a GlobRef');
+ok(!defined GlobRef('Foo'), 'GlobRef rejects anything which is not a GlobRef');
+ok(!defined GlobRef([]), 'GlobRef rejects anything which is not a GlobRef');
+ok(!defined GlobRef({}), 'GlobRef rejects anything which is not a GlobRef');
+ok(!defined GlobRef(sub {}), 'GlobRef rejects anything which is not a GlobRef');
+ok(!defined GlobRef($SCALAR_REF), 'GlobRef rejects anything which is not a GlobRef');
+ok(defined GlobRef($GLOB_REF), 'GlobRef accepts anything which is a GlobRef');
+ok(defined GlobRef($fh), 'GlobRef accepts anything which is a GlobRef');
+ok(!defined GlobRef($fh_obj), 'GlobRef rejects anything which is not a GlobRef');
+ok(!defined GlobRef(qr/../), 'GlobRef rejects anything which is not a GlobRef');
+ok(!defined GlobRef(bless {}, 'Foo'), 'GlobRef rejects anything which is not a GlobRef');
+ok(!defined GlobRef(undef), 'GlobRef rejects anything which is not a GlobRef');
+
+ok(!defined FileHandle(0), 'FileHandle rejects anything which is not a FileHandle');
+ok(!defined FileHandle(100), 'FileHandle rejects anything which is not a FileHandle');
+ok(!defined FileHandle(''), 'FileHandle rejects anything which is not a FileHandle');
+ok(!defined FileHandle('Foo'), 'FileHandle rejects anything which is not a FileHandle');
+ok(!defined FileHandle([]), 'FileHandle rejects anything which is not a FileHandle');
+ok(!defined FileHandle({}), 'FileHandle rejects anything which is not a FileHandle');
+ok(!defined FileHandle(sub {}), 'FileHandle rejects anything which is not a FileHandle');
+ok(!defined FileHandle($SCALAR_REF), 'FileHandle rejects anything which is not a FileHandle');
+ok(!defined FileHandle($GLOB_REF), 'FileHandle rejects anything which is not a FileHandle');
+ok(defined FileHandle($fh), 'FileHandle accepts anything which is a FileHandle');
+ok(defined FileHandle($fh_obj), 'FileHandle accepts anything which is a FileHandle');
+ok(!defined FileHandle(qr/../), 'FileHandle rejects anything which is not a FileHandle');
+ok(!defined FileHandle(bless {}, 'Foo'), 'FileHandle rejects anything which is not a FileHandle');
+ok(!defined FileHandle(undef), 'FileHandle rejects anything which is not a FileHandle');
+
+ok(!defined Object(0), 'Object rejects anything which is not blessed');
+ok(!defined Object(100), 'Object rejects anything which is not blessed');
+ok(!defined Object(''), 'Object rejects anything which is not blessed');
+ok(!defined Object('Foo'), 'Object rejects anything which is not blessed');
+ok(!defined Object([]), 'Object rejects anything which is not blessed');
+ok(!defined Object({}), 'Object rejects anything which is not blessed');
+ok(!defined Object(sub {}), 'Object rejects anything which is not blessed');
+ok(!defined Object($SCALAR_REF), 'Object rejects anything which is not blessed');
+ok(!defined Object($GLOB_REF), 'Object rejects anything which is not blessed');
+ok(!defined Object($fh), 'Object rejects anything which is not blessed');
+ok(!defined Object(qr/../), 'Object rejects anything which is not blessed');
+ok(defined Object(bless {}, 'Foo'), 'Object accepts anything which is blessed');
+ok(!defined Object(undef), 'Object accepts anything which is blessed');
+
+ok(!defined ClassName(0), 'ClassName rejects anything which is not a ClassName');
+ok(!defined ClassName(100), 'ClassName rejects anything which is not a ClassName');
+ok(!defined ClassName(''), 'ClassName rejects anything which is not a ClassName');
+ok(!defined ClassName('Baz'), 'ClassName rejects anything which is not a ClassName');
{
package Quux::Wibble; # this makes Quux symbol table exist
sub foo {}
}
-ok(!defined ClassName('Quux'), '... ClassName rejects anything which is not a ClassName');
-ok(!defined ClassName([]), '... ClassName rejects anything which is not a ClassName');
-ok(!defined ClassName({}), '... ClassName rejects anything which is not a ClassName');
-ok(!defined ClassName(sub {}), '... ClassName rejects anything which is not a ClassName');
-ok(!defined ClassName($SCALAR_REF), '... ClassName rejects anything which is not a ClassName');
-ok(!defined ClassName($fh), '... ClassName rejects anything which is not a ClassName');
-ok(!defined ClassName($GLOB_REF), '... ClassName rejects anything which is not a ClassName');
-ok(!defined ClassName(qr/../), '... ClassName rejects anything which is not a ClassName');
-ok(!defined ClassName(bless {}, 'Foo'), '... ClassName rejects anything which is not a ClassName');
-ok(!defined ClassName(undef), '... ClassName rejects anything which is not a ClassName');
-ok(defined ClassName('UNIVERSAL'), '... ClassName accepts anything which is a ClassName');
-ok(defined ClassName('Quux::Wibble'), '... ClassName accepts anything which is a ClassName');
-ok(defined ClassName('Moose::Meta::TypeConstraint'), '... ClassName accepts anything which is a ClassName');
-
-ok(!defined RoleName(0), '... RoleName rejects anything which is not a RoleName');
-ok(!defined RoleName(100), '... RoleName rejects anything which is not a RoleName');
-ok(!defined RoleName(''), '... RoleName rejects anything which is not a RoleName');
-ok(!defined RoleName('Baz'), '... RoleName rejects anything which is not a RoleName');
+ok(!defined ClassName('Quux'), 'ClassName rejects anything which is not a ClassName');
+ok(!defined ClassName([]), 'ClassName rejects anything which is not a ClassName');
+ok(!defined ClassName({}), 'ClassName rejects anything which is not a ClassName');
+ok(!defined ClassName(sub {}), 'ClassName rejects anything which is not a ClassName');
+ok(!defined ClassName($SCALAR_REF), 'ClassName rejects anything which is not a ClassName');
+ok(!defined ClassName($fh), 'ClassName rejects anything which is not a ClassName');
+ok(!defined ClassName($GLOB_REF), 'ClassName rejects anything which is not a ClassName');
+ok(!defined ClassName(qr/../), 'ClassName rejects anything which is not a ClassName');
+ok(!defined ClassName(bless {}, 'Foo'), 'ClassName rejects anything which is not a ClassName');
+ok(!defined ClassName(undef), 'ClassName rejects anything which is not a ClassName');
+ok(defined ClassName('UNIVERSAL'), 'ClassName accepts anything which is a ClassName');
+ok(defined ClassName('Quux::Wibble'), 'ClassName accepts anything which is a ClassName');
+ok(defined ClassName('Moose::Meta::TypeConstraint'), 'ClassName accepts anything which is a ClassName');
+
+ok(!defined RoleName(0), 'RoleName rejects anything which is not a RoleName');
+ok(!defined RoleName(100), 'RoleName rejects anything which is not a RoleName');
+ok(!defined RoleName(''), 'RoleName rejects anything which is not a RoleName');
+ok(!defined RoleName('Baz'), 'RoleName rejects anything which is not a RoleName');
{
package Quux::Wibble::Role; # this makes Quux symbol table exist
sub foo {}
}
-ok(!defined RoleName('Quux'), '... RoleName rejects anything which is not a RoleName');
-ok(!defined RoleName([]), '... Rolename rejects anything which is not a RoleName');
-ok(!defined RoleName({}), '... Rolename rejects anything which is not a RoleName');
-ok(!defined RoleName(sub {}), '... Rolename rejects anything which is not a RoleName');
-ok(!defined RoleName($SCALAR_REF), '... Rolename rejects anything which is not a RoleName');
-ok(!defined RoleName($fh), '... Rolename rejects anything which is not a RoleName');
-ok(!defined RoleName($GLOB_REF), '... Rolename rejects anything which is not a RoleName');
-ok(!defined RoleName(qr/../), '... Rolename rejects anything which is not a RoleName');
-ok(!defined RoleName(bless {}, 'Foo'), '... Rolename rejects anything which is not a RoleName');
-ok(!defined RoleName(undef), '... Rolename rejects anything which is not a RoleName');
-ok(!defined RoleName('UNIVERSAL'), '... Rolename rejects anything which is not a RoleName');
-ok(!defined RoleName('Quux::Wibble'), '... Rolename rejects anything which is not a RoleName');
-ok(!defined RoleName('Moose::Meta::TypeConstraint'), '... RoleName accepts anything which is a RoleName');
-ok(defined RoleName('Quux::Wibble::Role'), '... RoleName accepts anything which is a RoleName');
+ok(!defined RoleName('Quux'), 'RoleName rejects anything which is not a RoleName');
+ok(!defined RoleName([]), 'Rolename rejects anything which is not a RoleName');
+ok(!defined RoleName({}), 'Rolename rejects anything which is not a RoleName');
+ok(!defined RoleName(sub {}), 'Rolename rejects anything which is not a RoleName');
+ok(!defined RoleName($SCALAR_REF), 'Rolename rejects anything which is not a RoleName');
+ok(!defined RoleName($fh), 'Rolename rejects anything which is not a RoleName');
+ok(!defined RoleName($GLOB_REF), 'Rolename rejects anything which is not a RoleName');
+ok(!defined RoleName(qr/../), 'Rolename rejects anything which is not a RoleName');
+ok(!defined RoleName(bless {}, 'Foo'), 'Rolename rejects anything which is not a RoleName');
+ok(!defined RoleName(undef), 'Rolename rejects anything which is not a RoleName');
+ok(!defined RoleName('UNIVERSAL'), 'Rolename rejects anything which is not a RoleName');
+ok(!defined RoleName('Quux::Wibble'), 'Rolename rejects anything which is not a RoleName');
+ok(!defined RoleName('Moose::Meta::TypeConstraint'), 'RoleName accepts anything which is a RoleName');
+ok(defined RoleName('Quux::Wibble::Role'), 'RoleName accepts anything which is a RoleName');
close($fh) || die "Could not close the filehandle $0 for test";
)) {
is(find_type_constraint($type_name)->name,
$type_name,
- '... got the right name for ' . $type_name);
+ 'got the right name for ' . $type_name);
}
# TODO:
my $header = HTTPHeader->new();
isa_ok($header, 'HTTPHeader');
-ok(Header($header), '... this passed the type test');
-ok(!Header([]), '... this did not pass the type test');
-ok(!Header({}), '... this did not pass the type test');
+ok(Header($header), 'this passed the type test');
+ok(!Header([]), 'this did not pass the type test');
+ok(!Header({}), 'this did not pass the type test');
my $anon_type = subtype Object => where { $_->isa('HTTPHeader') };
is_deeply(
$coerced->array(),
[ 1, 2, 3 ],
- '... got the right array');
- is($coerced->hash(), undef, '... nothing assigned to the hash');
+ 'got the right array');
+ is($coerced->hash(), undef, 'nothing assigned to the hash');
}
{
is_deeply(
$coerced->hash(),
{ one => 1, two => 2, three => 3 },
- '... got the right hash');
- is($coerced->array(), undef, '... nothing assigned to the array');
+ 'got the right hash');
+ is($coerced->array(), undef, 'nothing assigned to the array');
}
{
my $scalar_ref = \(my $var);
my $coerced = $coercion->coerce($scalar_ref);
- is($coerced, $scalar_ref, '... got back what we put in');
+ is($coerced, $scalar_ref, 'got back what we put in');
}
{
my $coerced = $coercion->coerce("Foo");
- is($coerced, "Foo", '... got back what we put in');
+ is($coerced, "Foo", 'got back what we put in');
}
}
$SIG{__WARN__} = sub { 0 };
eval { require Foo; };
-ok(!$@, '... loaded Foo successfully') || diag $@;
+ok(!$@, 'loaded Foo successfully') || diag $@;
delete $INC{'Foo.pm'};
eval { require Foo; };
-ok(!$@, '... re-loaded Foo successfully') || diag $@;
+ok(!$@, 're-loaded Foo successfully') || diag $@;
eval { require Bar; };
-ok(!$@, '... loaded Bar successfully') || diag $@;
+ok(!$@, 'loaded Bar successfully') || diag $@;
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 $@;
\ No newline at end of file
lives_ok {
$engine->header([ 1, 2, 3 ]);
- } '... type was coerced without incident';
+ } 'type was coerced without incident';
isa_ok($engine->header, 'HTTPHeader');
is_deeply(
$engine->header->array,
[ 1, 2, 3 ],
- '... got the right array value of the header');
- ok(!defined($engine->header->hash), '... no hash value set');
+ 'got the right array value of the header');
+ ok(!defined($engine->header->hash), 'no hash value set');
# try with hash
lives_ok {
$engine->header({ one => 1, two => 2, three => 3 });
- } '... type was coerced without incident';
+ } 'type was coerced without incident';
isa_ok($engine->header, 'HTTPHeader');
is_deeply(
$engine->header->hash,
{ one => 1, two => 2, three => 3 },
- '... got the right hash value of the header');
- ok(!defined($engine->header->array), '... no array value set');
+ 'got the right hash value of the header');
+ ok(!defined($engine->header->array), 'no array value set');
dies_ok {
$engine->header("Foo");
- } '... dies with the wrong type, even after coercion';
+ } 'dies with the wrong type, even after coercion';
lives_ok {
$engine->header(HTTPHeader->new);
- } '... lives with the right type, even after coercion';
+ } 'lives with the right type, even after coercion';
}
{
is_deeply(
$engine->header->array,
[ 1, 2, 3 ],
- '... got the right array value of the header');
- ok(!defined($engine->header->hash), '... no hash value set');
+ 'got the right array value of the header');
+ ok(!defined($engine->header->hash), 'no hash value set');
}
{
is_deeply(
$engine->header->hash,
{ one => 1, two => 2, three => 3 },
- '... got the right hash value of the header');
- ok(!defined($engine->header->array), '... no array value set');
+ 'got the right hash value of the header');
+ ok(!defined($engine->header->array), 'no array value set');
}
{
isa_ok($engine->header, 'HTTPHeader');
- ok(!defined($engine->header->hash), '... no hash value set');
- ok(!defined($engine->header->array), '... no array value set');
+ ok(!defined($engine->header->hash), 'no hash value set');
+ ok(!defined($engine->header->array), 'no array value set');
}
dies_ok {
Engine->new(header => 'Foo');
-} '... dies correctly with bad params';
+} 'dies correctly with bad params';
dies_ok {
Engine->new(header => \(my $var));
-} '... dies correctly with bad params';
+} 'dies correctly with bad params';
my $Undef = find_type_constraint('Undef');
isa_ok($Undef, 'Moose::Meta::TypeConstraint');
-ok(!$Str->check(undef), '... Str cannot accept an Undef value');
-ok($Str->check('String'), '... Str can accept an String value');
-ok(!$Undef->check('String'), '... Undef cannot accept an Str value');
-ok($Undef->check(undef), '... Undef can accept an Undef value');
+ok(!$Str->check(undef), 'Str cannot accept an Undef value');
+ok($Str->check('String'), 'Str can accept an String value');
+ok(!$Undef->check('String'), 'Undef cannot accept an Str value');
+ok($Undef->check(undef), 'Undef can accept an Undef value');
my $Str_or_Undef = Moose::Meta::TypeConstraint::Union->new(type_constraints => [$Str, $Undef]);
isa_ok($Str_or_Undef, 'Moose::Meta::TypeConstraint::Union');
-ok($Str_or_Undef->check(undef), '... (Str | Undef) can accept an Undef value');
-ok($Str_or_Undef->check('String'), '... (Str | Undef) can accept a String value');
+ok($Str_or_Undef->check(undef), '(Str | Undef) can accept an Undef value');
+ok($Str_or_Undef->check('String'), '(Str | Undef) can accept a String value');
ok($Str_or_Undef->is_a_type_of($Str), "subtype of Str");
ok($Str_or_Undef->is_a_type_of($Undef), "subtype of Undef");
my $HashRef = find_type_constraint('HashRef');
isa_ok($HashRef, 'Moose::Meta::TypeConstraint');
-ok($ArrayRef->check([]), '... ArrayRef can accept an [] value');
-ok(!$ArrayRef->check({}), '... ArrayRef cannot accept an {} value');
-ok($HashRef->check({}), '... HashRef can accept an {} value');
-ok(!$HashRef->check([]), '... HashRef cannot accept an [] value');
+ok($ArrayRef->check([]), 'ArrayRef can accept an [] value');
+ok(!$ArrayRef->check({}), 'ArrayRef cannot accept an {} value');
+ok($HashRef->check({}), 'HashRef can accept an {} value');
+ok(!$HashRef->check([]), 'HashRef cannot accept an [] value');
my $HashOrArray = Moose::Meta::TypeConstraint::Union->new(type_constraints => [$ArrayRef, $HashRef]);
isa_ok($HashOrArray, 'Moose::Meta::TypeConstraint::Union');
-ok($HashOrArray->check([]), '... (ArrayRef | HashRef) can accept []');
-ok($HashOrArray->check({}), '... (ArrayRef | HashRef) can accept {}');
+ok($HashOrArray->check([]), '(ArrayRef | HashRef) can accept []');
+ok($HashOrArray->check({}), '(ArrayRef | HashRef) can accept {}');
-ok(!$HashOrArray->check(\(my $var1)), '... (ArrayRef | HashRef) cannot accept scalar refs');
-ok(!$HashOrArray->check(sub {}), '... (ArrayRef | HashRef) cannot accept code refs');
-ok(!$HashOrArray->check(50), '... (ArrayRef | HashRef) cannot accept Numbers');
+ok(!$HashOrArray->check(\(my $var1)), '(ArrayRef | HashRef) cannot accept scalar refs');
+ok(!$HashOrArray->check(sub {}), '(ArrayRef | HashRef) cannot accept code refs');
+ok(!$HashOrArray->check(50), '(ArrayRef | HashRef) cannot accept Numbers');
diag $HashOrArray->validate([]);
-ok(!defined($HashOrArray->validate([])), '... (ArrayRef | HashRef) can accept []');
-ok(!defined($HashOrArray->validate({})), '... (ArrayRef | HashRef) can accept {}');
+ok(!defined($HashOrArray->validate([])), '(ArrayRef | HashRef) can accept []');
+ok(!defined($HashOrArray->validate({})), '(ArrayRef | HashRef) can accept {}');
like($HashOrArray->validate(\(my $var2)),
qr/Validation failed for \'ArrayRef\' failed with value SCALAR\(0x.+?\) and Validation failed for \'HashRef\' failed with value SCALAR\(0x.+?\) in \(ArrayRef\|HashRef\)/,
-'... (ArrayRef | HashRef) cannot accept scalar refs');
+'(ArrayRef | HashRef) cannot accept scalar refs');
like($HashOrArray->validate(sub {}),
qr/Validation failed for \'ArrayRef\' failed with value CODE\(0x.+?\) and Validation failed for \'HashRef\' failed with value CODE\(0x.+?\) in \(ArrayRef\|HashRef\)/,
-'... (ArrayRef | HashRef) cannot accept code refs');
+'(ArrayRef | HashRef) cannot accept code refs');
is($HashOrArray->validate(50),
'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');
+'(ArrayRef | HashRef) cannot accept Numbers');
isa_ok($email->raw_body, 'IO::String');
- is($email->as_string, undef, '... got correct empty string');
+ is($email->as_string, undef, 'got correct empty string');
}
{
- my $email = Email::Moose->new(raw_body => '... this is my body ...');
+ my $email = Email::Moose->new(raw_body => 'this is my body ...');
isa_ok($email, 'Email::Moose');
isa_ok($email->raw_body, 'IO::String');
- is($email->as_string, '... this is my body ...', '... got correct string');
+ is($email->as_string, 'this is my body ...', 'got correct string');
lives_ok {
- $email->raw_body('... this is the next body ...');
- } '... this will coerce correctly';
+ $email->raw_body('this is the next body ...');
+ } 'this will coerce correctly';
isa_ok($email->raw_body, 'IO::String');
- is($email->as_string, '... this is the next body ...', '... got correct string');
+ is($email->as_string, 'this is the next body ...', 'got correct string');
}
{
- my $str = '... this is my body (ref) ...';
+ my $str = 'this is my body (ref) ...';
my $email = Email::Moose->new(raw_body => \$str);
isa_ok($email, 'Email::Moose');
isa_ok($email->raw_body, 'IO::String');
- is($email->as_string, $str, '... got correct string');
+ is($email->as_string, $str, 'got correct string');
- my $str2 = '... this is the next body (ref) ...';
+ my $str2 = 'this is the next body (ref) ...';
lives_ok {
$email->raw_body(\$str2);
- } '... this will coerce correctly';
+ } 'this will coerce correctly';
isa_ok($email->raw_body, 'IO::String');
- is($email->as_string, $str2, '... got correct string');
+ is($email->as_string, $str2, 'got correct string');
}
{
- my $io_str = IO::String->new('... this is my body (IO::String) ...');
+ my $io_str = IO::String->new('this is my body (IO::String) ...');
my $email = Email::Moose->new(raw_body => $io_str);
isa_ok($email, 'Email::Moose');
isa_ok($email->raw_body, 'IO::String');
- is($email->raw_body, $io_str, '... and it is the one we expected');
+ is($email->raw_body, $io_str, 'and it is the one we expected');
- is($email->as_string, '... this is my body (IO::String) ...', '... got correct string');
+ is($email->as_string, 'this is my body (IO::String) ...', 'got correct string');
- my $io_str2 = IO::String->new('... this is the next body (IO::String) ...');
+ my $io_str2 = IO::String->new('this is the next body (IO::String) ...');
lives_ok {
$email->raw_body($io_str2);
- } '... this will coerce correctly';
+ } 'this will coerce correctly';
isa_ok($email->raw_body, 'IO::String');
- is($email->raw_body, $io_str2, '... and it is the one we expected');
+ is($email->raw_body, $io_str2, 'and it is the one we expected');
- is($email->as_string, '... this is the next body (IO::String) ...', '... got correct string');
+ is($email->as_string, 'this is the next body (IO::String) ...', 'got correct string');
}
{
isa_ok($email, 'Email::Moose');
isa_ok($email->raw_body, 'IO::File');
- is($email->raw_body, $fh, '... and it is the one we expected');
+ is($email->raw_body, $fh, 'and it is the one we expected');
}
lives_ok {
subtype 'Numb3rs' => as 'Num';
-} '... create bare subtype fine';
+} 'create bare subtype fine';
my $numb3rs = find_type_constraint('Numb3rs');
isa_ok($numb3rs, 'Moose::Meta::TypeConstraint');
isa_ok($array_of_ints, 'Moose::Meta::TypeConstraint::Parameterized');
isa_ok($array_of_ints, 'Moose::Meta::TypeConstraint');
-ok($array_of_ints->check([ 1, 2, 3, 4 ]), '... [ 1, 2, 3, 4 ] passed successfully');
-ok(!$array_of_ints->check([qw/foo bar baz/]), '... [qw/foo bar baz/] failed successfully');
-ok(!$array_of_ints->check([ 1, 2, 3, qw/foo bar/]), '... [ 1, 2, 3, qw/foo bar/] failed successfully');
+ok($array_of_ints->check([ 1, 2, 3, 4 ]), '[ 1, 2, 3, 4 ] passed successfully');
+ok(!$array_of_ints->check([qw/foo bar baz/]), '[qw/foo bar baz/] failed successfully');
+ok(!$array_of_ints->check([ 1, 2, 3, qw/foo bar/]), '[ 1, 2, 3, qw/foo bar/] failed successfully');
-ok(!$array_of_ints->check(1), '... 1 failed successfully');
-ok(!$array_of_ints->check({}), '... {} failed successfully');
-ok(!$array_of_ints->check(sub { () }), '... sub { () } failed successfully');
+ok(!$array_of_ints->check(1), '1 failed successfully');
+ok(!$array_of_ints->check({}), '{} failed successfully');
+ok(!$array_of_ints->check(sub { () }), 'sub { () } failed successfully');
# Hash of Ints
isa_ok($hash_of_ints, 'Moose::Meta::TypeConstraint::Parameterized');
isa_ok($hash_of_ints, 'Moose::Meta::TypeConstraint');
-ok($hash_of_ints->check({ one => 1, two => 2, three => 3 }), '... { one => 1, two => 2, three => 3 } passed successfully');
-ok(!$hash_of_ints->check({ 1 => 'one', 2 => 'two', 3 => 'three' }), '... { 1 => one, 2 => two, 3 => three } failed successfully');
-ok(!$hash_of_ints->check({ 1 => 'one', 2 => 'two', three => 3 }), '... { 1 => one, 2 => two, three => 3 } failed successfully');
+ok($hash_of_ints->check({ one => 1, two => 2, three => 3 }), '{ one => 1, two => 2, three => 3 } passed successfully');
+ok(!$hash_of_ints->check({ 1 => 'one', 2 => 'two', 3 => 'three' }), '{ 1 => one, 2 => two, 3 => three } failed successfully');
+ok(!$hash_of_ints->check({ 1 => 'one', 2 => 'two', three => 3 }), '{ 1 => one, 2 => two, three => 3 } failed successfully');
-ok(!$hash_of_ints->check(1), '... 1 failed successfully');
-ok(!$hash_of_ints->check([]), '... [] failed successfully');
-ok(!$hash_of_ints->check(sub { () }), '... sub { () } failed successfully');
+ok(!$hash_of_ints->check(1), '1 failed successfully');
+ok(!$hash_of_ints->check([]), '[] failed successfully');
+ok(!$hash_of_ints->check(sub { () }), 'sub { () } failed successfully');
# Array of Array of Ints
ok($array_of_array_of_ints->check(
[[ 1, 2, 3 ], [ 4, 5, 6 ]]
-), '... [[ 1, 2, 3 ], [ 4, 5, 6 ]] passed successfully');
+), '[[ 1, 2, 3 ], [ 4, 5, 6 ]] passed successfully');
ok(!$array_of_array_of_ints->check(
[[ 1, 2, 3 ], [ qw/foo bar/ ]]
-), '... [[ 1, 2, 3 ], [ qw/foo bar/ ]] failed successfully');
+), '[[ 1, 2, 3 ], [ qw/foo bar/ ]] failed successfully');
{
my $anon_type = Moose::Util::TypeConstraints::find_or_parse_type_constraint('ArrayRef[Foo]');
$r->add_type_constraint($array_of_ints);
-is(find_type_constraint('ArrayRef[Int]'), $array_of_ints, '... found the type we just added');
+is(find_type_constraint('ArrayRef[Int]'), $array_of_ints, 'found the type we just added');
# Hash of Ints
$r->add_type_constraint($hash_of_ints);
-is(find_type_constraint('HashRef[Int]'), $hash_of_ints, '... found the type we just added');
+is(find_type_constraint('HashRef[Int]'), $hash_of_ints, 'found the type we just added');
## now attempt a coercion
my $foo = Foo->new(bar => { one => 1, two => 2, three => 3 });
isa_ok($foo, 'Foo');
-is_deeply([ sort @{$foo->bar} ], [ 1, 2, 3 ], '... our coercion worked!');
+is_deeply([ sort @{$foo->bar} ], [ 1, 2, 3 ], 'our coercion worked!');
my $array_of_ints_or_strings = Moose::Util::TypeConstraints::create_parameterized_type_constraint('ArrayRef[Int|Str]');
isa_ok($array_of_ints_or_strings, 'Moose::Meta::TypeConstraint::Parameterized');
-ok($array_of_ints_or_strings->check([ 1, 'two', 3 ]), '... this passed the type check');
-ok($array_of_ints_or_strings->check([ 1, 2, 3 ]), '... this passed the type check');
-ok($array_of_ints_or_strings->check([ 'one', 'two', 'three' ]), '... this passed the type check');
+ok($array_of_ints_or_strings->check([ 1, 'two', 3 ]), 'this passed the type check');
+ok($array_of_ints_or_strings->check([ 1, 2, 3 ]), 'this passed the type check');
+ok($array_of_ints_or_strings->check([ 'one', 'two', 'three' ]), 'this passed the type check');
-ok(!$array_of_ints_or_strings->check([ 1, [], 'three' ]), '... this didnt pass the type check');
+ok(!$array_of_ints_or_strings->check([ 1, [], 'three' ]), 'this didnt pass the type check');
$r->add_type_constraint($array_of_ints_or_strings);
my $array_of_ints_or_hash_ref = Moose::Util::TypeConstraints::create_parameterized_type_constraint('ArrayRef[Int | HashRef]');
isa_ok($array_of_ints_or_hash_ref, 'Moose::Meta::TypeConstraint::Parameterized');
-ok($array_of_ints_or_hash_ref->check([ 1, {}, 3 ]), '... this passed the type check');
-ok($array_of_ints_or_hash_ref->check([ 1, 2, 3 ]), '... this passed the type check');
-ok($array_of_ints_or_hash_ref->check([ {}, {}, {} ]), '... this passed the type check');
+ok($array_of_ints_or_hash_ref->check([ 1, {}, 3 ]), 'this passed the type check');
+ok($array_of_ints_or_hash_ref->check([ 1, 2, 3 ]), 'this passed the type check');
+ok($array_of_ints_or_hash_ref->check([ {}, {}, {} ]), 'this passed the type check');
-ok(!$array_of_ints_or_hash_ref->check([ {}, [], 3 ]), '... this didnt pass the type check');
+ok(!$array_of_ints_or_hash_ref->check([ {}, [], 3 ]), 'this didnt pass the type check');
$r->add_type_constraint($array_of_ints_or_hash_ref);
my $pure_insanity = Moose::Util::TypeConstraints::create_type_constraint_union('ArrayRef[Int|Str] | ArrayRef[Int | HashRef]');
isa_ok($pure_insanity, 'Moose::Meta::TypeConstraint::Union');
-ok($pure_insanity->check([ 1, {}, 3 ]), '... this passed the type check');
-ok($pure_insanity->check([ 1, 'Str', 3 ]), '... this passed the type check');
+ok($pure_insanity->check([ 1, {}, 3 ]), 'this passed the type check');
+ok($pure_insanity->check([ 1, 'Str', 3 ]), 'this passed the type check');
-ok(!$pure_insanity->check([ 1, {}, 'foo' ]), '... this didnt pass the type check');
-ok(!$pure_insanity->check([ [], {}, 1 ]), '... this didnt pass the type check');
+ok(!$pure_insanity->check([ 1, {}, 'foo' ]), 'this didnt pass the type check');
+ok(!$pure_insanity->check([ [], {}, 1 ]), 'this didnt pass the type check');
## Nested Containers ...
isa_ok($array_of_ints, 'Moose::Meta::TypeConstraint::Parameterized');
isa_ok($array_of_ints, 'Moose::Meta::TypeConstraint');
-ok($array_of_ints->check([ 1, 2, 3, 4 ]), '... [ 1, 2, 3, 4 ] passed successfully');
-ok(!$array_of_ints->check([qw/foo bar baz/]), '... [qw/foo bar baz/] failed successfully');
-ok(!$array_of_ints->check([ 1, 2, 3, qw/foo bar/]), '... [ 1, 2, 3, qw/foo bar/] failed successfully');
+ok($array_of_ints->check([ 1, 2, 3, 4 ]), '[ 1, 2, 3, 4 ] passed successfully');
+ok(!$array_of_ints->check([qw/foo bar baz/]), '[qw/foo bar baz/] failed successfully');
+ok(!$array_of_ints->check([ 1, 2, 3, qw/foo bar/]), '[ 1, 2, 3, qw/foo bar/] failed successfully');
-ok(!$array_of_ints->check(1), '... 1 failed successfully');
-ok(!$array_of_ints->check({}), '... {} failed successfully');
-ok(!$array_of_ints->check(sub { () }), '... sub { () } failed successfully');
+ok(!$array_of_ints->check(1), '1 failed successfully');
+ok(!$array_of_ints->check({}), '{} failed successfully');
+ok(!$array_of_ints->check(sub { () }), 'sub { () } failed successfully');
# Array of Array of Ints
ok($array_of_array_of_ints->check(
[[ 1, 2, 3 ], [ 4, 5, 6 ]]
-), '... [[ 1, 2, 3 ], [ 4, 5, 6 ]] passed successfully');
+), '[[ 1, 2, 3 ], [ 4, 5, 6 ]] passed successfully');
ok(!$array_of_array_of_ints->check(
[[ 1, 2, 3 ], [ qw/foo bar/ ]]
-), '... [[ 1, 2, 3 ], [ qw/foo bar/ ]] failed successfully');
+), '[[ 1, 2, 3 ], [ qw/foo bar/ ]] failed successfully');
# Array of Array of Array of Ints
ok($array_of_array_of_array_of_ints->check(
[[[ 1, 2, 3 ], [ 4, 5, 6 ]], [[ 7, 8, 9 ]]]
-), '... [[[ 1, 2, 3 ], [ 4, 5, 6 ]], [[ 7, 8, 9 ]]] passed successfully');
+), '[[[ 1, 2, 3 ], [ 4, 5, 6 ]], [[ 7, 8, 9 ]]] passed successfully');
ok(!$array_of_array_of_array_of_ints->check(
[[[ 1, 2, 3 ]], [[ qw/foo bar/ ]]]
-), '... [[[ 1, 2, 3 ]], [[ qw/foo bar/ ]]] failed successfully');
+), '[[[ 1, 2, 3 ]], [[ qw/foo bar/ ]]] failed successfully');
## check the containers
ok(Moose::Util::TypeConstraints::_detect_parameterized_type_constraint($_),
- '... this correctly detected a container (' . $_ . ')')
+ 'this correctly detected a container (' . $_ . ')')
for (
'ArrayRef[Foo]',
'ArrayRef[Foo | Int]',
);
ok(!Moose::Util::TypeConstraints::_detect_parameterized_type_constraint($_),
- '... this correctly detected a non-container (' . $_ . ')')
+ 'this correctly detected a non-container (' . $_ . ')')
for (
'ArrayRef[]',
'ArrayRef[Foo]Bar',
is_deeply(
[ Moose::Util::TypeConstraints::_parse_parameterized_type_constraint($_) ],
$split_tests{$_},
- '... this correctly split the container (' . $_ . ')'
+ 'this correctly split the container (' . $_ . ')'
) for keys %split_tests;
}
## now for the unions
ok(Moose::Util::TypeConstraints::_detect_type_constraint_union($_),
- '... this correctly detected union (' . $_ . ')')
+ 'this correctly detected union (' . $_ . ')')
for (
'Int | Str',
'Int|Str',
);
ok(!Moose::Util::TypeConstraints::_detect_type_constraint_union($_),
- '... this correctly detected a non-union (' . $_ . ')')
+ 'this correctly detected a non-union (' . $_ . ')')
for (
'Int',
'ArrayRef[Foo | Int]',
is_deeply(
[ Moose::Util::TypeConstraints::_parse_type_constraint_union($_) ],
$split_tests{$_},
- '... this correctly split the union (' . $_ . ')'
+ 'this correctly split the union (' . $_ . ')'
) for keys %split_tests;
}
my $anon_enum = enum \@valid_languages;
isa_ok($anon_enum, 'Moose::Meta::TypeConstraint');
-is($anon_enum->name, '__ANON__', '... got the right name');
-is($anon_enum->parent->name, 'Str', '... got the right parent name');
+is($anon_enum->name, '__ANON__', 'got the right name');
+is($anon_enum->parent->name, 'Str', 'got the right parent name');
ok($anon_enum->check($_), "'$_' is a language") for @valid_languages;
lives_ok {
subtype 'MySpecialHash' => as 'HashRef[Int]';
-} '... created the subtype special okay';
+} 'created the subtype special okay';
{
my $t = find_type_constraint('MySpecialHash');
isa_ok($t, 'Moose::Meta::TypeConstraint');
- is($t->name, 'MySpecialHash', '... name is correct');
+ is($t->name, 'MySpecialHash', 'name is correct');
my $p = $t->parent;
isa_ok($p, 'Moose::Meta::TypeConstraint::Parameterized');
isa_ok($p, 'Moose::Meta::TypeConstraint');
- is($p->name, 'HashRef[Int]', '... parent name is correct');
+ is($p->name, 'HashRef[Int]', 'parent name is correct');
- ok($t->check({ one => 1, two => 2 }), '... validated {one=>1, two=>2} correctly');
- ok(!$t->check({ one => "ONE", two => "TWO" }), '... validated it correctly');
+ ok($t->check({ one => 1, two => 2 }), 'validated {one=>1, two=>2} correctly');
+ ok(!$t->check({ one => "ONE", two => "TWO" }), 'validated it correctly');
ok( $t->equals($t), "equals to self" );
ok( !$t->equals( $t->parent ), "not equal to parent" );
# all values are less then 10
(scalar grep { $_ < 10 } values %{$_}) ? 1 : undef
};
-} '... created the subtype special okay';
+} 'created the subtype special okay';
{
my $t = find_type_constraint('MySpecialHashExtended');
isa_ok($t, 'Moose::Meta::TypeConstraint');
- is($t->name, 'MySpecialHashExtended', '... name is correct');
+ is($t->name, 'MySpecialHashExtended', 'name is correct');
my $p = $t->parent;
isa_ok($p, 'Moose::Meta::TypeConstraint::Parameterized');
isa_ok($p, 'Moose::Meta::TypeConstraint');
- is($p->name, 'HashRef[Int]', '... parent name is correct');
+ is($p->name, 'HashRef[Int]', 'parent name is correct');
- ok($t->check({ one => 1, two => 2 }), '... validated it correctly');
- ok(!$t->check({ zero => 10, one => 11, two => 12 }), '... validated { zero => 10, one => 11, two => 12 } correctly');
- ok(!$t->check({ one => "ONE", two => "TWO" }), '... validated it correctly');
+ ok($t->check({ one => 1, two => 2 }), 'validated it correctly');
+ ok(!$t->check({ zero => 10, one => 11, two => 12 }), 'validated { zero => 10, one => 11, two => 12 } correctly');
+ ok(!$t->check({ one => "ONE", two => "TWO" }), 'validated it correctly');
}
lives_ok {
lives_ok {
subtype 'MyCollections' => as 'ArrayRef | HashRef';
-} '... created the subtype special okay';
+} 'created the subtype special okay';
{
my $t = find_type_constraint('MyCollections');
isa_ok($t, 'Moose::Meta::TypeConstraint');
- is($t->name, 'MyCollections', '... name is correct');
+ is($t->name, 'MyCollections', 'name is correct');
my $p = $t->parent;
isa_ok($p, 'Moose::Meta::TypeConstraint::Union');
isa_ok($p, 'Moose::Meta::TypeConstraint');
- is($p->name, 'ArrayRef|HashRef', '... parent name is correct');
+ is($p->name, 'ArrayRef|HashRef', 'parent name is correct');
- ok($t->check([]), '... validated it correctly');
- ok($t->check({}), '... validated it correctly');
- ok(!$t->check(1), '... validated it correctly');
+ ok($t->check([]), 'validated it correctly');
+ ok($t->check({}), 'validated it correctly');
+ ok(!$t->check(1), 'validated it correctly');
}
lives_ok {
}
1;
};
-} '... created the subtype special okay';
+} 'created the subtype special okay';
{
my $t = find_type_constraint('MyCollectionsExtended');
isa_ok($t, 'Moose::Meta::TypeConstraint');
- is($t->name, 'MyCollectionsExtended', '... name is correct');
+ is($t->name, 'MyCollectionsExtended', 'name is correct');
my $p = $t->parent;
isa_ok($p, 'Moose::Meta::TypeConstraint::Union');
isa_ok($p, 'Moose::Meta::TypeConstraint');
- is($p->name, 'ArrayRef|HashRef', '... parent name is correct');
+ is($p->name, 'ArrayRef|HashRef', 'parent name is correct');
- ok(!$t->check([]), '... validated it correctly');
- ok($t->check([1, 2]), '... validated it correctly');
+ ok(!$t->check([]), 'validated it correctly');
+ ok($t->check([1, 2]), 'validated it correctly');
- ok(!$t->check({}), '... validated it correctly');
- ok($t->check({ one => 1, two => 2 }), '... validated it correctly');
+ ok(!$t->check({}), 'validated it correctly');
+ ok($t->check({ one => 1, two => 2 }), 'validated it correctly');
- ok(!$t->check(1), '... validated it correctly');
+ ok(!$t->check(1), 'validated it correctly');
}
# no keys match non-alpha
(grep { /[^a-zA-Z]/ } keys %$_) == 0
};
-} '... created the subtype special okay';
+} 'created the subtype special okay';
lives_ok {
subtype 'Trihash' => as 'AlphaKeyHash'
=> where {
keys(%$_) == 3
};
-} '... created the subtype special okay';
+} 'created the subtype special okay';
lives_ok {
subtype 'Noncon' => as 'Item';
-} '... created the subtype special okay';
+} 'created the subtype special okay';
{
my $t = find_type_constraint('AlphaKeyHash');
isa_ok($t, 'Moose::Meta::TypeConstraint');
- is($t->name, 'AlphaKeyHash', '... name is correct');
+ is($t->name, 'AlphaKeyHash', 'name is correct');
my $p = $t->parent;
isa_ok($p, 'Moose::Meta::TypeConstraint');
- is($p->name, 'HashRef', '... parent name is correct');
+ is($p->name, 'HashRef', 'parent name is correct');
- ok($t->check({ one => 1, two => 2 }), '... validated it correctly');
- ok(!$t->check({ one1 => 1, two2 => 2 }), '... validated it correctly');
+ ok($t->check({ one => 1, two => 2 }), 'validated it correctly');
+ ok(!$t->check({ one1 => 1, two2 => 2 }), 'validated it correctly');
ok( $t->equals($t), "equals to self" );
ok( !$t->equals($t->parent), "not equal to parent" );
my $hoi = Moose::Util::TypeConstraints::find_or_parse_type_constraint('AlphaKeyHash[Int]');
-ok($hoi->check({ one => 1, two => 2 }), '... validated it correctly');
-ok(!$hoi->check({ one1 => 1, two2 => 2 }), '... validated it correctly');
-ok(!$hoi->check({ one => 'uno', two => 'dos' }), '... validated it correctly');
-ok(!$hoi->check({ one1 => 'un', two2 => 'deux' }), '... validated it correctly');
+ok($hoi->check({ one => 1, two => 2 }), 'validated it correctly');
+ok(!$hoi->check({ one1 => 1, two2 => 2 }), 'validated it correctly');
+ok(!$hoi->check({ one => 'uno', two => 'dos' }), 'validated it correctly');
+ok(!$hoi->check({ one1 => 'un', two2 => 'deux' }), 'validated it correctly');
ok( $hoi->equals($hoi), "equals to self" );
ok( !$hoi->equals($hoi->parent), "equals to self" );
my $th = Moose::Util::TypeConstraints::find_or_parse_type_constraint('Trihash[Bool]');
-ok(!$th->check({ one => 1, two => 1 }), '... validated it correctly');
-ok($th->check({ one => 1, two => 0, three => 1 }), '... validated it correctly');
-ok(!$th->check({ one => 1, two => 2, three => 1 }), '... validated it correctly');
-ok(!$th->check({foo1 => 1, bar2 => 0, baz3 => 1}), '... validated it correctly');
+ok(!$th->check({ one => 1, two => 1 }), 'validated it correctly');
+ok($th->check({ one => 1, two => 0, three => 1 }), 'validated it correctly');
+ok(!$th->check({ one => 1, two => 2, three => 1 }), 'validated it correctly');
+ok(!$th->check({foo1 => 1, bar2 => 0, baz3 => 1}), 'validated it correctly');
dies_ok {
Moose::Meta::TypeConstraint::Parameterized->new(
coerce 'ArrayRef'
=> from 'MyList'
=> via { [ $_->items ] }
-} '... created the coercion okay';
+} 'created the coercion okay';
my $mylist = Moose::Util::TypeConstraints::find_or_parse_type_constraint('MyList[Int]');
-ok($mylist->check(MyList->new(10, 20, 30)), '... validated it correctly (pass)');
-ok(!$mylist->check(MyList->new(10, "two")), '... validated it correctly (fail)');
-ok(!$mylist->check([10]), '... validated it correctly (fail)');
+ok($mylist->check(MyList->new(10, 20, 30)), 'validated it correctly (pass)');
+ok(!$mylist->check(MyList->new(10, "two")), 'validated it correctly (fail)');
+ok(!$mylist->check([10]), 'validated it correctly (fail)');
subtype 'EvenList' => as 'MyList' => where { $_->items % 2 == 0 };
coerce 'ArrayRef'
=> from 'EvenList'
=> via { [ $_->items ] }
-} '... created the coercion okay';
+} 'created the coercion okay';
my $evenlist = Moose::Util::TypeConstraints::find_or_parse_type_constraint('EvenList[Int]');
-ok(!$evenlist->check(MyList->new(10, 20, 30)), '... validated it correctly (fail)');
-ok($evenlist->check(MyList->new(10, 20, 30, 40)), '... validated it correctly (pass)');
-ok(!$evenlist->check(MyList->new(10, "two")), '... validated it correctly (fail)');
-ok(!$evenlist->check([10, 20]), '... validated it correctly (fail)');
+ok(!$evenlist->check(MyList->new(10, 20, 30)), 'validated it correctly (fail)');
+ok($evenlist->check(MyList->new(10, 20, 30, 40)), 'validated it correctly (pass)');
+ok(!$evenlist->check(MyList->new(10, "two")), 'validated it correctly (fail)');
+ok(!$evenlist->check([10, 20]), 'validated it correctly (fail)');
ok( !$type->equals( Moose::Meta::TypeConstraint::Parameterized->new( name => "__ANON__", parent => find_type_constraint("Maybe"), type_parameter => find_type_constraint("Str") ) ), "not equal to clone with diff param" );
ok( !$type->equals( Moose::Util::TypeConstraints::find_or_parse_type_constraint('Maybe[Str]') ), "not equal to declarative version of diff param" );
-ok($type->check(10), '... checked type correctly (pass)');
-ok($type->check(undef), '... checked type correctly (pass)');
-ok(!$type->check('Hello World'), '... checked type correctly (fail)');
-ok(!$type->check([]), '... checked type correctly (fail)');
+ok($type->check(10), 'checked type correctly (pass)');
+ok($type->check(undef), 'checked type correctly (pass)');
+ok(!$type->check('Hello World'), 'checked type correctly (fail)');
+ok(!$type->check([]), 'checked type correctly (fail)');
{
package Bar;
lives_ok {
Foo->new(arr => [], bar => Bar->new);
-} '... Bar->new isa Bar';
+} 'Bar->new isa Bar';
dies_ok {
Foo->new(arr => [], bar => undef);
-} '... undef isnta Bar';
+} 'undef isnta Bar';
lives_ok {
Foo->new(arr => [], maybe_bar => Bar->new);
-} '... Bar->new isa maybe(Bar)';
+} 'Bar->new isa maybe(Bar)';
lives_ok {
Foo->new(arr => [], maybe_bar => undef);
-} '... undef isa maybe(Bar)';
+} 'undef isa maybe(Bar)';
dies_ok {
Foo->new(arr => [], maybe_bar => 1);
-} '... 1 isnta maybe(Bar)';
+} '1 isnta maybe(Bar)';
lives_ok {
Foo->new(arr => []);
-} '... it worked!';
+} 'it worked!';
lives_ok {
Foo->new(arr => undef);
-} '... it worked!';
+} 'it worked!';
dies_ok {
Foo->new(arr => 100);
-} '... failed the type check';
+} 'failed the type check';
dies_ok {
Foo->new(arr => 'hello world');
-} '... failed the type check';
+} 'failed the type check';
{
}
lives_ok { my $goat = Animal->new( leg_count => 4 ) }
-'... no errors thrown, value is good';
+'no errors thrown, value is good';
lives_ok { my $spider = Animal->new( leg_count => 8 ) }
-'... no errors thrown, value is good';
+'no errors thrown, value is good';
throws_ok { my $fern = Animal->new( leg_count => 0 ) }
qr/This number \(0\) is not less than ten!/,
my $chimera;
lives_ok { $chimera = Animal->new( leg_count => 4 ) }
-'... no errors thrown, value is good';
+'no errors thrown, value is good';
throws_ok { $chimera->leg_count(0) }
qr/This number \(0\) is not less than ten!/,
'gave custom subtype error message on set to 16';
my $gimp = eval { Animal->new() };
-is( $@, '', '... no errors thrown, value is good' );
+is( $@, '', 'no errors thrown, value is good' );
throws_ok { $gimp->leg_count }
qr/This number \(0\) is not less than ten!/,
#
Moose::Util::TypeConstraints->export_type_constraints_as_functions;
-ok( Undef(undef), '... undef is a Undef');
-ok(!Defined(undef), '... undef is NOT a Defined');
-ok(!Int(undef), '... undef is NOT a Int');
-ok(!Number(undef), '... undef is NOT a Number');
-ok(!Str(undef), '... undef is NOT a Str');
-ok(!String(undef), '... undef is NOT a String');
-
-ok(!Undef(5), '... 5 is a NOT a Undef');
-ok(Defined(5), '... 5 is a Defined');
-ok(Int(5), '... 5 is a Int');
-ok(Number(5), '... 5 is a Number');
-ok(Str(5), '... 5 is a Str');
-ok(!String(5), '... 5 is NOT a String');
-
-ok(!Undef(0.5), '... 0.5 is a NOT a Undef');
-ok(Defined(0.5), '... 0.5 is a Defined');
-ok(!Int(0.5), '... 0.5 is NOT a Int');
-ok(Number(0.5), '... 0.5 is a Number');
-ok(Str(0.5), '... 0.5 is a Str');
-ok(!String(0.5), '... 0.5 is NOT a String');
-
-ok(!Undef('Foo'), '... "Foo" is NOT a Undef');
-ok(Defined('Foo'), '... "Foo" is a Defined');
-ok(!Int('Foo'), '... "Foo" is NOT a Int');
-ok(!Number('Foo'), '... "Foo" is NOT a Number');
-ok(Str('Foo'), '... "Foo" is a Str');
-ok(String('Foo'), '... "Foo" is a String');
+ok( Undef(undef), 'undef is a Undef');
+ok(!Defined(undef), 'undef is NOT a Defined');
+ok(!Int(undef), 'undef is NOT a Int');
+ok(!Number(undef), 'undef is NOT a Number');
+ok(!Str(undef), 'undef is NOT a Str');
+ok(!String(undef), 'undef is NOT a String');
+
+ok(!Undef(5), '5 is a NOT a Undef');
+ok(Defined(5), '5 is a Defined');
+ok(Int(5), '5 is a Int');
+ok(Number(5), '5 is a Number');
+ok(Str(5), '5 is a Str');
+ok(!String(5), '5 is NOT a String');
+
+ok(!Undef(0.5), '0.5 is a NOT a Undef');
+ok(Defined(0.5), '0.5 is a Defined');
+ok(!Int(0.5), '0.5 is NOT a Int');
+ok(Number(0.5), '0.5 is a Number');
+ok(Str(0.5), '0.5 is a Str');
+ok(!String(0.5), '0.5 is NOT a String');
+
+ok(!Undef('Foo'), '"Foo" is NOT a Undef');
+ok(Defined('Foo'), '"Foo" is a Defined');
+ok(!Int('Foo'), '"Foo" is NOT a Int');
+ok(!Number('Foo'), '"Foo" is NOT a Number');
+ok(Str('Foo'), '"Foo" is a Str');
+ok(String('Foo'), '"Foo" is a String');
my $foo = Foo->new;
-lives_ok { $foo->vUndef(undef) } '... undef is a Foo->Undef';
-dies_ok { $foo->vDefined(undef) } '... undef is NOT a Foo->Defined';
-dies_ok { $foo->vInt(undef) } '... undef is NOT a Foo->Int';
-dies_ok { $foo->vNumber(undef) } '... undef is NOT a Foo->Number';
-dies_ok { $foo->vStr(undef) } '... undef is NOT a Foo->Str';
-dies_ok { $foo->vString(undef) } '... undef is NOT a Foo->String';
-
-dies_ok { $foo->vUndef(5) } '... 5 is NOT a Foo->Undef';
-lives_ok { $foo->vDefined(5) } '... 5 is a Foo->Defined';
-lives_ok { $foo->vInt(5) } '... 5 is a Foo->Int';
-lives_ok { $foo->vNumber(5) } '... 5 is a Foo->Number';
-lives_ok { $foo->vStr(5) } '... 5 is a Foo->Str';
-dies_ok { $foo->vString(5) } '... 5 is NOT a Foo->String';
-
-dies_ok { $foo->vUndef(0.5) } '... 0.5 is NOT a Foo->Undef';
-lives_ok { $foo->vDefined(0.5) } '... 0.5 is a Foo->Defined';
-dies_ok { $foo->vInt(0.5) } '... 0.5 is NOT a Foo->Int';
-lives_ok { $foo->vNumber(0.5) } '... 0.5 is a Foo->Number';
-lives_ok { $foo->vStr(0.5) } '... 0.5 is a Foo->Str';
-dies_ok { $foo->vString(0.5) } '... 0.5 is NOT a Foo->String';
-
-dies_ok { $foo->vUndef('Foo') } '... "Foo" is NOT a Foo->Undef';
-lives_ok { $foo->vDefined('Foo') } '... "Foo" is a Foo->Defined';
-dies_ok { $foo->vInt('Foo') } '... "Foo" is NOT a Foo->Int';
-dies_ok { $foo->vNumber('Foo') } '... "Foo" is NOT a Foo->Number';
-lives_ok { $foo->vStr('Foo') } '... "Foo" is a Foo->Str';
-lives_ok { $foo->vString('Foo') } '... "Foo" is a Foo->String';
+lives_ok { $foo->vUndef(undef) } 'undef is a Foo->Undef';
+dies_ok { $foo->vDefined(undef) } 'undef is NOT a Foo->Defined';
+dies_ok { $foo->vInt(undef) } 'undef is NOT a Foo->Int';
+dies_ok { $foo->vNumber(undef) } 'undef is NOT a Foo->Number';
+dies_ok { $foo->vStr(undef) } 'undef is NOT a Foo->Str';
+dies_ok { $foo->vString(undef) } 'undef is NOT a Foo->String';
+
+dies_ok { $foo->vUndef(5) } '5 is NOT a Foo->Undef';
+lives_ok { $foo->vDefined(5) } '5 is a Foo->Defined';
+lives_ok { $foo->vInt(5) } '5 is a Foo->Int';
+lives_ok { $foo->vNumber(5) } '5 is a Foo->Number';
+lives_ok { $foo->vStr(5) } '5 is a Foo->Str';
+dies_ok { $foo->vString(5) } '5 is NOT a Foo->String';
+
+dies_ok { $foo->vUndef(0.5) } '0.5 is NOT a Foo->Undef';
+lives_ok { $foo->vDefined(0.5) } '0.5 is a Foo->Defined';
+dies_ok { $foo->vInt(0.5) } '0.5 is NOT a Foo->Int';
+lives_ok { $foo->vNumber(0.5) } '0.5 is a Foo->Number';
+lives_ok { $foo->vStr(0.5) } '0.5 is a Foo->Str';
+dies_ok { $foo->vString(0.5) } '0.5 is NOT a Foo->String';
+
+dies_ok { $foo->vUndef('Foo') } '"Foo" is NOT a Foo->Undef';
+lives_ok { $foo->vDefined('Foo') } '"Foo" is a Foo->Defined';
+dies_ok { $foo->vInt('Foo') } '"Foo" is NOT a Foo->Int';
+dies_ok { $foo->vNumber('Foo') } '"Foo" is NOT a Foo->Number';
+lives_ok { $foo->vStr('Foo') } '"Foo" is a Foo->Str';
+lives_ok { $foo->vString('Foo') } '"Foo" is a Foo->String';
# the lazy tests
-lives_ok { $foo->v_lazy_Undef() } '... undef is a Foo->Undef';
-dies_ok { $foo->v_lazy_Defined() } '... undef is NOT a Foo->Defined';
-dies_ok { $foo->v_lazy_Int() } '... undef is NOT a Foo->Int';
-dies_ok { $foo->v_lazy_Number() } '... undef is NOT a Foo->Number';
-dies_ok { $foo->v_lazy_Str() } '... undef is NOT a Foo->Str';
-dies_ok { $foo->v_lazy_String() } '... undef is NOT a Foo->String';
+lives_ok { $foo->v_lazy_Undef() } 'undef is a Foo->Undef';
+dies_ok { $foo->v_lazy_Defined() } 'undef is NOT a Foo->Defined';
+dies_ok { $foo->v_lazy_Int() } 'undef is NOT a Foo->Int';
+dies_ok { $foo->v_lazy_Number() } 'undef is NOT a Foo->Number';
+dies_ok { $foo->v_lazy_Str() } 'undef is NOT a Foo->Str';
+dies_ok { $foo->v_lazy_String() } 'undef is NOT a Foo->String';
ArrayRef => sub { [ @{ rev( tail( $_ ) ) }, head( $_ ) ] };
}
-is( len( [] ), 0, '... got the right length');
-is( len( [ 1 ] ), 1, '... got the right length');
-is( len( [ 1 .. 5 ] ), 5, '... got the right length');
-is( len( [ 1 .. 50 ] ), 50, '... got the right length');
+is( len( [] ), 0, 'got the right length');
+is( len( [ 1 ] ), 1, 'got the right length');
+is( len( [ 1 .. 5 ] ), 5, 'got the right length');
+is( len( [ 1 .. 50 ] ), 50, 'got the right length');
is_deeply(
rev( [ 1 .. 5 ] ),
[ reverse 1 .. 5 ],
- '... got the right reversed value'
+ 'got the right reversed value'
);
# break down a Maybe Type ...
}
-is( break_it_down( 'FOO' ), 'FOO', '... got the right value');
-is( break_it_down( [] ), 'default', '... got the right value');
-is( break_it_down( undef ), 'undef', '... got the right value');
-is( break_it_down(), 'undef', '... got the right value');
+is( break_it_down( 'FOO' ), 'FOO', 'got the right value');
+is( break_it_down( [] ), 'default', 'got the right value');
+is( break_it_down( undef ), 'undef', 'got the right value');
+is( break_it_down(), 'undef', 'got the right value');
# checking against enum types
sub { die "bad color $_" };
}
-is( is_acceptable_color( 'blue' ), 'RGB', '... got the right value');
-is( is_acceptable_color( 'green' ), 'RGB', '... got the right value');
-is( is_acceptable_color( 'red' ), 'RGB', '... got the right value');
-is( is_acceptable_color( 'cyan' ), 'CMYK', '... got the right value');
-is( is_acceptable_color( 'magenta' ), 'CMYK', '... got the right value');
-is( is_acceptable_color( 'yellow' ), 'CMYK', '... got the right value');
-is( is_acceptable_color( 'black' ), 'CMYK', '... got the right value');
+is( is_acceptable_color( 'blue' ), 'RGB', 'got the right value');
+is( is_acceptable_color( 'green' ), 'RGB', 'got the right value');
+is( is_acceptable_color( 'red' ), 'RGB', 'got the right value');
+is( is_acceptable_color( 'cyan' ), 'CMYK', 'got the right value');
+is( is_acceptable_color( 'magenta' ), 'CMYK', 'got the right value');
+is( is_acceptable_color( 'yellow' ), 'CMYK', 'got the right value');
+is( is_acceptable_color( 'black' ), 'CMYK', 'got the right value');
dies_ok {
is_acceptable_color( 'orange' )
-} '... got the exception';
+} 'got the exception';
## using it in an OO context
}
my $l = LinkedList->new;
-is($l->pprint, '[]', '... got the right pprint');
+is($l->pprint, '[]', 'got the right pprint');
$l->next;
-is($l->pprint, '[[]]', '... got the right pprint');
+is($l->pprint, '[[]]', 'got the right pprint');
$l->next->next;
-is($l->pprint, '[[[]]]', '... got the right pprint');
+is($l->pprint, '[[[]]]', 'got the right pprint');
$l->next->next->next;
-is($l->pprint, '[[[[]]]]', '... got the right pprint');
+is($l->pprint, '[[[[]]]]', 'got the right pprint');
# basic data dumper
}
),
'{ five => *ppprint, four => qr/(?-xism:.*?)/, one => [ 1, 2, "three", 4, "five", \"six" ], six => Foo(), three => sub { ... }, two => undef }',
- '... got the right pretty printed values'
+ 'got the right pretty printed values'
);
# simple JSON serializer
is(
to_json( { one => 1, two => 2 } ),
'{ "one" : 1, "two" : 2 }',
- '... got our valid JSON'
+ 'got our valid JSON'
);
is(
three => "Hello World"
} ),
'{ "one" : [ 1, 2, 3, 4 ], "three" : "Hello World", "two" : null }',
- '... got our valid JSON'
+ 'got our valid JSON'
);
throws_ok {
not_enough_matches( [] )
-} qr/No cases matched for /, '... not enough matches';
+} qr/No cases matched for /, 'not enough matches';
my $c = My::Class->new;
isa_ok($c, 'My::Class');
-ok($c->meta->has_attribute('bling_bling'), '... got the attribute');
+ok($c->meta->has_attribute('bling_bling'), 'got the attribute');
isa_ok($c->meta->get_attribute('bling_bling'), 'My::Custom::Meta::Attr');
use warnings;
use metaclass 'Bar::Meta';
eval 'use Moose;';
- ::ok($@, '... could not load moose without correct metaclass');
+ ::ok($@, 'could not load moose without correct metaclass');
::like($@,
qr/^Bar already has a metaclass, but it does not inherit Moose::Meta::Class/,
- '... got the right error too');
+ 'got the right error too');
}
is_deeply(
[ $anon->superclasses ],
[ 'Moose::Object' ],
- '... got the default superclasses');
+ 'got the default superclasses');
{
package My::Meta::Attribute::DefaultReadOnly;
isa_ok($attr, 'Moose::Meta::Attribute');
isa_ok($attr, 'Class::MOP::Attribute');
- ok($attr->has_reader, '... the attribute has a reader (as expected)');
- ok(!$attr->has_writer, '... the attribute does not have a writer (as expected)');
- ok(!$attr->has_accessor, '... the attribute does not have an accessor (as expected)');
+ ok($attr->has_reader, 'the attribute has a reader (as expected)');
+ ok(!$attr->has_writer, 'the attribute does not have a writer (as expected)');
+ ok(!$attr->has_accessor, 'the attribute does not have an accessor (as expected)');
}
{
isa_ok($attr, 'Moose::Meta::Attribute');
isa_ok($attr, 'Class::MOP::Attribute');
- ok(!$attr->has_reader, '... the attribute does not have a reader (as expected)');
- ok(!$attr->has_writer, '... the attribute does not have a writer (as expected)');
- ok($attr->has_accessor, '... the attribute does have an accessor (as expected)');
+ ok(!$attr->has_reader, 'the attribute does not have a reader (as expected)');
+ ok(!$attr->has_writer, 'the attribute does not have a writer (as expected)');
+ ok($attr->has_accessor, 'the attribute does have an accessor (as expected)');
}
isa_ok($obj, 'MyFramework::Base');
isa_ok($obj, 'Moose::Object');
-is($obj->foo, 10, '... got the right value');
+is($obj->foo, 10, 'got the right value');
my $meta = Moose::init_meta('Foo');
-ok( Foo->isa('Moose::Object'), '... Foo isa Moose::Object');
+ok( Foo->isa('Moose::Object'), 'Foo isa Moose::Object');
isa_ok( $meta, 'Moose::Meta::Class' );
isa_ok( Foo->meta, 'Moose::Meta::Class' );
-is($meta, Foo->meta, '... our metas are the same');
+is($meta, Foo->meta, 'our metas are the same');
dies_ok( sub { Moose::Util::TypeConstraints->import( -traits => 'My::SimpleTrait' ) },
'cannot provide -traits to an exporting module that does not init_meta' );
like( $@, qr/does not have an init_meta/,
- '... and error provides a useful explanation' );
+ 'and error provides a useful explanation' );
}
{
ok( My::Class->meta()->meta()->does_role('Role::Foo'),
'apply Role::Foo to My::Class->meta()' );
is( My::Class->meta()->foo(), 10,
- '... and call foo() on that meta object' );
+ 'and call foo() on that meta object' );
}
{
ok( My::Class->meta()->attribute_metaclass()->meta()->does_role('Role::Foo'),
q{apply Role::Foo to My::Class->meta()'s attribute metaclass} );
ok( My::Class->meta()->meta()->does_role('Role::Foo'),
- '... My::Class->meta() still does Role::Foo' );
+ 'My::Class->meta() still does Role::Foo' );
My::Class->meta()->add_attribute( 'size', is => 'ro' );
is( My::Class->meta()->get_attribute('size')->foo(), 10,
- '... call foo() on an attribute metaclass object' );
+ 'call foo() on an attribute metaclass object' );
}
{
ok( My::Class->meta()->method_metaclass()->meta()->does_role('Role::Foo'),
q{apply Role::Foo to My::Class->meta()'s method metaclass} );
ok( My::Class->meta()->meta()->does_role('Role::Foo'),
- '... My::Class->meta() still does Role::Foo' );
+ 'My::Class->meta() still does Role::Foo' );
ok( My::Class->meta()->attribute_metaclass()->meta()->does_role('Role::Foo'),
q{... My::Class->meta()'s attribute metaclass still does Role::Foo} );
My::Class->meta()->add_method( 'bar' => sub { 'bar' } );
is( My::Class->meta()->get_method('bar')->foo(), 10,
- '... call foo() on a method metaclass object' );
+ 'call foo() on a method metaclass object' );
}
{
ok( My::Class->meta()->wrapped_method_metaclass()->meta()->does_role('Role::Foo'),
q{apply Role::Foo to My::Class->meta()'s wrapped method metaclass} );
ok( My::Class->meta()->method_metaclass()->meta()->does_role('Role::Foo'),
- '... My::Class->meta() still does Role::Foo' );
+ 'My::Class->meta() still does Role::Foo' );
ok( My::Class->meta()->meta()->does_role('Role::Foo'),
- '... My::Class->meta() still does Role::Foo' );
+ 'My::Class->meta() still does Role::Foo' );
ok( My::Class->meta()->attribute_metaclass()->meta()->does_role('Role::Foo'),
q{... My::Class->meta()'s attribute metaclass still does Role::Foo} );
My::Class->meta()->add_after_method_modifier( 'bar' => sub { 'bar' } );
is( My::Class->meta()->get_method('bar')->foo(), 10,
- '... call foo() on a wrapped method metaclass object' );
+ 'call foo() on a wrapped method metaclass object' );
}
{
ok( My::Class->meta()->instance_metaclass()->meta()->does_role('Role::Foo'),
q{apply Role::Foo to My::Class->meta()'s instance metaclass} );
ok( My::Class->meta()->meta()->does_role('Role::Foo'),
- '... My::Class->meta() still does Role::Foo' );
+ 'My::Class->meta() still does Role::Foo' );
ok( My::Class->meta()->attribute_metaclass()->meta()->does_role('Role::Foo'),
q{... My::Class->meta()'s attribute metaclass still does Role::Foo} );
ok( My::Class->meta()->method_metaclass()->meta()->does_role('Role::Foo'),
q{... My::Class->meta()'s method metaclass still does Role::Foo} );
is( My::Class->meta()->get_meta_instance()->foo(), 10,
- '... call foo() on an instance metaclass object' );
+ 'call foo() on an instance metaclass object' );
}
{
ok( My::Class->meta()->constructor_class()->meta()->does_role('Role::Foo'),
q{apply Role::Foo to My::Class->meta()'s constructor class} );
ok( My::Class->meta()->meta()->does_role('Role::Foo'),
- '... My::Class->meta() still does Role::Foo' );
+ 'My::Class->meta() still does Role::Foo' );
ok( My::Class->meta()->attribute_metaclass()->meta()->does_role('Role::Foo'),
q{... My::Class->meta()'s attribute metaclass still does Role::Foo} );
ok( My::Class->meta()->method_metaclass()->meta()->does_role('Role::Foo'),
# Actually instantiating the constructor class is too freaking hard!
ok( My::Class->meta()->constructor_class()->can('foo'),
- '... constructor class has a foo method' );
+ 'constructor class has a foo method' );
}
{
ok( My::Class->meta()->destructor_class()->meta()->does_role('Role::Foo'),
q{apply Role::Foo to My::Class->meta()'s destructor class} );
ok( My::Class->meta()->meta()->does_role('Role::Foo'),
- '... My::Class->meta() still does Role::Foo' );
+ 'My::Class->meta() still does Role::Foo' );
ok( My::Class->meta()->attribute_metaclass()->meta()->does_role('Role::Foo'),
q{... My::Class->meta()'s attribute metaclass still does Role::Foo} );
ok( My::Class->meta()->method_metaclass()->meta()->does_role('Role::Foo'),
# same problem as the constructor class
ok( My::Class->meta()->destructor_class()->can('foo'),
- '... destructor class has a foo method' );
+ 'destructor class has a foo method' );
}
{
ok( My::Class->meta()->does_role('Role::Foo'),
'apply Role::Foo to My::Class base class' );
is( My::Class->new()->foo(), 10,
- '... call foo() on a My::Class object' );
+ 'call foo() on a My::Class object' );
}
{
ok( My::Class2->meta()->meta()->does_role('Role::Foo'),
'apply Role::Foo to My::Class2->meta()' );
is( My::Class2->meta()->foo(), 10,
- '... and call foo() on that meta object' );
+ 'and call foo() on that meta object' );
ok( My::Class2->meta()->attribute_metaclass()->meta()->does_role('Role::Foo'),
q{apply Role::Foo to My::Class2->meta()'s attribute metaclass} );
My::Class2->meta()->add_attribute( 'size', is => 'ro' );
is( My::Class2->meta()->get_attribute('size')->foo(), 10,
- '... call foo() on an attribute metaclass object' );
+ 'call foo() on an attribute metaclass object' );
ok( My::Class2->meta()->method_metaclass()->meta()->does_role('Role::Foo'),
q{apply Role::Foo to My::Class2->meta()'s method metaclass} );
My::Class2->meta()->add_method( 'bar' => sub { 'bar' } );
is( My::Class2->meta()->get_method('bar')->foo(), 10,
- '... call foo() on a method metaclass object' );
+ 'call foo() on a method metaclass object' );
ok( My::Class2->meta()->instance_metaclass()->meta()->does_role('Role::Foo'),
q{apply Role::Foo to My::Class2->meta()'s instance metaclass} );
is( My::Class2->meta()->get_meta_instance()->foo(), 10,
- '... call foo() on an instance metaclass object' );
+ 'call foo() on an instance metaclass object' );
ok( My::Class2->meta()->constructor_class()->meta()->does_role('Role::Foo'),
q{apply Role::Foo to My::Class2->meta()'s constructor class} );
ok( My::Class2->meta()->constructor_class()->can('foo'),
- '... constructor class has a foo method' );
+ 'constructor class has a foo method' );
ok( My::Class2->meta()->destructor_class()->meta()->does_role('Role::Foo'),
q{apply Role::Foo to My::Class2->meta()'s destructor class} );
ok( My::Class2->meta()->destructor_class()->can('foo'),
- '... destructor class has a foo method' );
+ 'destructor class has a foo method' );
}
ok( My::Class3->meta()->meta()->does_role('Role::Foo'),
'apply Role::Foo to My::Class3->meta()' );
is( My::Class3->meta()->foo(), 10,
- '... and call foo() on that meta object' );
+ 'and call foo() on that meta object' );
ok( ( grep { $_ eq 'My::Meta::Class' } My::Class3->meta()->meta()->superclasses() ),
'apply_metaclass_roles() does not interfere with metaclass set via Moose->init_meta()' );
}
ok( My::Class4->meta()->meta()->does_role('Role::Bar'),
'apply Role::Bar to My::Class4->meta()' );
ok( My::Class4->meta()->meta()->does_role('Role::Foo'),
- '... and My::Class4->meta() still does Role::Foo' );
+ 'and My::Class4->meta() still does Role::Foo' );
}
{
ok( My::Class2->meta()->attribute_metaclass()->meta()->does_role('Role::Foo'),
q{apply Role::Foo to My::Class2->meta()'s attribute metaclass} );
has_superclass( My::Class2->meta()->attribute_metaclass(), 'My::Meta::Attribute',
- '... and this does not interfere with attribute metaclass set via metaclass.pm' );
+ 'and this does not interfere with attribute metaclass set via metaclass.pm' );
ok( My::Class2->meta()->method_metaclass()->meta()->does_role('Role::Foo'),
q{apply Role::Foo to My::Class2->meta()'s method metaclass} );
has_superclass( My::Class2->meta()->method_metaclass(), 'My::Meta::Method',
- '... and this does not interfere with method metaclass set via metaclass.pm' );
+ 'and this does not interfere with method metaclass set via metaclass.pm' );
ok( My::Class2->meta()->instance_metaclass()->meta()->does_role('Role::Foo'),
q{apply Role::Foo to My::Class2->meta()'s instance metaclass} );
has_superclass( My::Class2->meta()->instance_metaclass(), 'My::Meta::Instance',
- '... and this does not interfere with instance metaclass set via metaclass.pm' );
+ 'and this does not interfere with instance metaclass set via metaclass.pm' );
}
# like isa_ok but works with a class name, not just refs
do {
use_ok($_);
- is($_->meta->name, $_, '... initialized the meta correctly');
+ is($_->meta->name, $_, 'initialized the meta correctly');
lives_ok {
Module::Refresh->new->refresh_module($_ . '.pm')
- } '... successfully refreshed ' . $_;
+ } 'successfully refreshed ' . $_;
} foreach @modules;
=pod
}
use_ok('TestBaz');
-is(TestBaz->meta->name, 'TestBaz', '... initialized the meta correctly');
-ok(TestBaz->meta->has_attribute('foo'), '... it has the foo attribute as well');
-ok(!TestBaz->isa('Foo'), '... TestBaz is not a Foo');
+is(TestBaz->meta->name, 'TestBaz', 'initialized the meta correctly');
+ok(TestBaz->meta->has_attribute('foo'), 'it has the foo attribute as well');
+ok(!TestBaz->isa('Foo'), 'TestBaz is not a Foo');
{
open FILE, ">", $test_module_file
lives_ok {
Module::Refresh->new->refresh_module($test_module_file)
-} '... successfully refreshed ' . $test_module_file;
+} 'successfully refreshed ' . $test_module_file;
-is(TestBaz->meta->name, 'TestBaz', '... initialized the meta correctly');
-ok(TestBaz->meta->has_attribute('foo'), '... it has the foo attribute as well');
-ok(TestBaz->isa('Foo'), '... TestBaz is a Foo');
+is(TestBaz->meta->name, 'TestBaz', 'initialized the meta correctly');
+ok(TestBaz->meta->has_attribute('foo'), 'it has the foo attribute as well');
+ok(TestBaz->isa('Foo'), 'TestBaz is a Foo');
unlink $test_module_file;
my $bar = Bar->new;
isa_ok($bar, 'Bar');
isa_ok($bar, 'Foo');
-ok(!$bar->isa('Moose::Object'), '... Bar is not Moose::Object subclass');
+ok(!$bar->isa('Moose::Object'), 'Bar is not Moose::Object subclass');
my $baz = Baz->new;
isa_ok($baz, 'Baz');
isa_ok( $foo_moose, 'Elk' );
is( $foo_moose->no_moose, 'Elk',
- '... got the right value from the Elk method' );
+ 'got the right value from the Elk method' );
is( $foo_moose->moose, 'Foo',
- '... got the right value from the Foo::Moose method' );
+ 'got the right value from the Foo::Moose method' );
lives_ok {
Old::Bucket::Nose->meta->make_immutable( debug => 0 );
use Moose;
::lives_ok{ with 'Stuffed::Role';
- } '... this should work correctly';
+ } 'this should work correctly';
::lives_ok{ with 'Bulkie::Role';
- } '... this should work correctly';
+ } 'this should work correctly';
}
lives_ok {
$page->meta->remove_attribute('counter');
}
-'... removed the counter attribute okay';
+'removed the counter attribute okay';
ok( !$page->meta->has_attribute('counter'),
- '... no longer has the attribute' );
+ 'no longer has the attribute' );
ok( !$page->can($_), "... our class no longer has the $_ method" ) for qw[
counter
set_counter
];
-is( $page->counter, 0, '... got the default value' );
+is( $page->counter, 0, 'got the default value' );
$page->inc_counter;
-is( $page->counter, 1, '... got the incremented value' );
+is( $page->counter, 1, 'got the incremented value' );
$page->inc_counter;
-is( $page->counter, 2, '... got the incremented value (again)' );
+is( $page->counter, 2, 'got the incremented value (again)' );
$page->dec_counter;
-is( $page->counter, 1, '... got the decremented value' );
+is( $page->counter, 1, 'got the decremented value' );
$page->reset_counter;
-is( $page->counter, 0, '... got the original value' );
+is( $page->counter, 0, 'got the original value' );
$page->set_counter(5);
-is( $page->counter, 5, '... set the value' );
+is( $page->counter, 5, 'set the value' );
$page->inc_counter(2);
-is( $page->counter, 7, '... increment by arg' );
+is( $page->counter, 7, 'increment by arg' );
$page->dec_counter(5);
-is( $page->counter, 2, '... decrement by arg' );
+is( $page->counter, 2, 'decrement by arg' );
# check the meta ..
does_ok( $counter, 'Moose::Meta::Attribute::Native::Trait::Counter' );
is( $counter->type_constraint->name, 'Int',
- '... got the expected type constraint' );
+ 'got the expected type constraint' );
is_deeply(
$counter->handles,
reset_counter => 'reset',
set_counter => 'set'
},
- '... got the right handles methods'
+ 'got the right handles methods'
);
option_accessor
];
-is_deeply( $stuff->options, [ 10, 12 ], '... got options' );
+is_deeply( $stuff->options, [ 10, 12 ], 'got options' );
-ok( !$stuff->has_no_options, '... we have options' );
-is( $stuff->num_options, 2, '... got 2 options' );
+ok( !$stuff->has_no_options, 'we have options' );
+is( $stuff->num_options, 2, 'got 2 options' );
-is( $stuff->remove_last_option, 12, '... removed the last option' );
-is( $stuff->remove_first_option, 10, '... removed the last option' );
+is( $stuff->remove_last_option, 12, 'removed the last option' );
+is( $stuff->remove_first_option, 10, 'removed the last option' );
-is_deeply( $stuff->options, [], '... no options anymore' );
+is_deeply( $stuff->options, [], 'no options anymore' );
-ok( $stuff->has_no_options, '... no options' );
-is( $stuff->num_options, 0, '... got no options' );
+ok( $stuff->has_no_options, 'no options' );
+is( $stuff->num_options, 0, 'got no options' );
lives_ok {
$stuff->add_options( 1, 2, 3 );
}
-'... set the option okay';
+'set the option okay';
-is_deeply( $stuff->options, [ 1, 2, 3 ], '... got options now' );
+is_deeply( $stuff->options, [ 1, 2, 3 ], 'got options now' );
-ok( !$stuff->has_no_options, '... has options' );
-is( $stuff->num_options, 3, '... got 3 options' );
+ok( !$stuff->has_no_options, 'has options' );
+is( $stuff->num_options, 3, 'got 3 options' );
-is( $stuff->get_option_at(0), 1, '... get option at index 0' );
-is( $stuff->get_option_at(1), 2, '... get option at index 1' );
-is( $stuff->get_option_at(2), 3, '... get option at index 2' );
+is( $stuff->get_option_at(0), 1, 'get option at index 0' );
+is( $stuff->get_option_at(1), 2, 'get option at index 1' );
+is( $stuff->get_option_at(2), 3, 'get option at index 2' );
lives_ok {
$stuff->set_option_at( 1, 100 );
}
-'... set the option okay';
+'set the option okay';
-is( $stuff->get_option_at(1), 100, '... get option at index 1' );
+is( $stuff->get_option_at(1), 100, 'get option at index 1' );
lives_ok {
$stuff->add_options( 10, 15 );
}
-'... set the option okay';
+'set the option okay';
is_deeply( $stuff->options, [ 1, 100, 3, 10, 15 ],
- '... got more options now' );
+ 'got more options now' );
-is( $stuff->num_options, 5, '... got 5 options' );
+is( $stuff->num_options, 5, 'got 5 options' );
-is( $stuff->remove_last_option, 15, '... removed the last option' );
+is( $stuff->remove_last_option, 15, 'removed the last option' );
-is( $stuff->num_options, 4, '... got 4 options' );
-is_deeply( $stuff->options, [ 1, 100, 3, 10 ], '... got diff options now' );
+is( $stuff->num_options, 4, 'got 4 options' );
+is_deeply( $stuff->options, [ 1, 100, 3, 10 ], 'got diff options now' );
lives_ok {
$stuff->insert_options( 10, 20 );
}
-'... set the option okay';
+'set the option okay';
-is( $stuff->num_options, 6, '... got 6 options' );
+is( $stuff->num_options, 6, 'got 6 options' );
is_deeply( $stuff->options, [ 10, 20, 1, 100, 3, 10 ],
- '... got diff options now' );
+ 'got diff options now' );
-is( $stuff->get_option_at(0), 10, '... get option at index 0' );
-is( $stuff->get_option_at(1), 20, '... get option at index 1' );
-is( $stuff->get_option_at(3), 100, '... get option at index 3' );
+is( $stuff->get_option_at(0), 10, 'get option at index 0' );
+is( $stuff->get_option_at(1), 20, 'get option at index 1' );
+is( $stuff->get_option_at(3), 100, 'get option at index 3' );
-is( $stuff->remove_first_option, 10, '... getting the first option' );
+is( $stuff->remove_first_option, 10, 'getting the first option' );
-is( $stuff->num_options, 5, '... got 5 options' );
-is( $stuff->get_option_at(0), 20, '... get option at index 0' );
+is( $stuff->num_options, 5, 'got 5 options' );
+is( $stuff->get_option_at(0), 20, 'get option at index 0' );
$stuff->clear_options;
is_deeply( $stuff->options, [], "... clear options" );
lives_ok {
$stuff->descending_options();
}
-'... curried sort in place lives ok';
+'curried sort in place lives ok';
is_deeply( $stuff->options, [ 5, 3, 2, 1 ], "... sort currying" );
lives_ok {
$stuff->add_options('tree');
}
-'... set the options okay';
+'set the options okay';
lives_ok {
$stuff->add_options_with_speed( 'compatible', 'safe' );
}
-'... add options with speed okay';
+'add options with speed okay';
is_deeply(
$stuff->options, [qw/tree funrolls funbuns compatible safe/],
lives_ok {
$stuff->prepend_prerequisites_along_with();
}
-'... add prerequisite options okay';
+'add prerequisite options okay';
$stuff->clear_options;
$stuff->add_options( 1, 2 );
lives_ok {
$stuff->splice_options( 1, 0, 'foo' );
}
-'... splice_options works';
+'splice_options works';
is_deeply(
$stuff->options, [ 1, 'foo', 2 ],
#dies_ok {
# $stuff->insert_options(undef);
-#} '... could not add an undef where a string is expected';
+#} 'could not add an undef where a string is expected';
#
#dies_ok {
# $stuff->set_option(5, {});
-#} '... could not add a hash ref where a string is expected';
+#} 'could not add a hash ref where a string is expected';
dies_ok {
Stuff->new( options => [ undef, 10, undef, 20 ] );
}
-'... bad constructor params';
+'bad constructor params';
dies_ok {
my $stuff = Stuff->new();
$stuff->add_options(undef);
}
-'... rejects push of an invalid type';
+'rejects push of an invalid type';
dies_ok {
my $stuff = Stuff->new();
$stuff->insert_options(undef);
}
-'... rejects unshift of an invalid type';
+'rejects unshift of an invalid type';
dies_ok {
my $stuff = Stuff->new();
$stuff->set_option_at( 0, undef );
}
-'... rejects set of an invalid type';
+'rejects set of an invalid type';
dies_ok {
my $stuff = Stuff->new();
$stuff->sort_in_place_options(undef);
}
-'... sort rejects arg of invalid type';
+'sort rejects arg of invalid type';
dies_ok {
my $stuff = Stuff->new();
$stuff->option_accessor();
}
-'... accessor rejects 0 args';
+'accessor rejects 0 args';
dies_ok {
my $stuff = Stuff->new();
$stuff->option_accessor( 1, 2, 3 );
}
-'... accessor rejects 3 args';
+'accessor rejects 3 args';
## test the meta
[ 'unshift' => 'first', 'second' ],
'descending_options' => [ 'sort_in_place' => $sort ],
},
- '... got the right handles mapping'
+ 'got the right handles mapping'
);
is( $options->type_constraint->type_parameter, 'Str',
- '... got the right container type' );
+ 'got the right container type' );
option_accessor
];
-ok( $stuff->has_no_options, '... we have no options' );
-is( $stuff->num_options, 0, '... we have no options' );
+ok( $stuff->has_no_options, 'we have no options' );
+is( $stuff->num_options, 0, 'we have no options' );
-is_deeply( $stuff->options, {}, '... no options yet' );
-ok( !$stuff->has_option('foo'), '... we have no foo option' );
+is_deeply( $stuff->options, {}, 'no options yet' );
+ok( !$stuff->has_option('foo'), 'we have no foo option' );
lives_ok {
$stuff->set_option( foo => 'bar' );
}
-'... set the option okay';
+'set the option okay';
-ok( $stuff->is_defined('foo'), '... foo is defined' );
+ok( $stuff->is_defined('foo'), 'foo is defined' );
-ok( !$stuff->has_no_options, '... we have options' );
-is( $stuff->num_options, 1, '... we have 1 option(s)' );
-ok( $stuff->has_option('foo'), '... we have a foo option' );
-is_deeply( $stuff->options, { foo => 'bar' }, '... got options now' );
+ok( !$stuff->has_no_options, 'we have options' );
+is( $stuff->num_options, 1, 'we have 1 option(s)' );
+ok( $stuff->has_option('foo'), 'we have a foo option' );
+is_deeply( $stuff->options, { foo => 'bar' }, 'got options now' );
lives_ok {
$stuff->set_option( bar => 'baz' );
}
-'... set the option okay';
+'set the option okay';
-is( $stuff->num_options, 2, '... we have 2 option(s)' );
+is( $stuff->num_options, 2, 'we have 2 option(s)' );
is_deeply( $stuff->options, { foo => 'bar', bar => 'baz' },
- '... got more options now' );
+ 'got more options now' );
-is( $stuff->get_option('foo'), 'bar', '... got the right option' );
+is( $stuff->get_option('foo'), 'bar', 'got the right option' );
is_deeply( [ $stuff->get_option(qw(foo bar)) ], [qw(bar baz)],
"get multiple options at once" );
is( scalar($stuff->get_option(qw( foo bar) )), "baz",
- '... got last option in scalar context');
+ 'got last option in scalar context');
lives_ok {
$stuff->set_option( oink => "blah", xxy => "flop" );
}
-'... set the option okay';
+'set the option okay';
is( $stuff->num_options, 4, "4 options" );
is_deeply( [ $stuff->get_option(qw(foo bar oink xxy)) ],
lives_ok {
$stuff->delete_option('bar');
}
-'... deleted the option okay';
+'deleted the option okay';
lives_ok {
$stuff->delete_option('oink','xxy');
}
-'... deleted multiple option okay';
+'deleted multiple option okay';
-is( $stuff->num_options, 1, '... we have 1 option(s)' );
-is_deeply( $stuff->options, { foo => 'bar' }, '... got more options now' );
+is( $stuff->num_options, 1, 'we have 1 option(s)' );
+is_deeply( $stuff->options, { foo => 'bar' }, 'got more options now' );
$stuff->clear_options;
lives_ok {
$stuff->quantity(4);
}
-'... options added okay with defaults';
+'options added okay with defaults';
is( $stuff->quantity, 4, 'reader part of curried accessor works' );
-is_deeply( $stuff->options, { quantity => 4 }, '... returns what we expect' );
+is_deeply( $stuff->options, { quantity => 4 }, 'returns what we expect' );
lives_ok {
Stuff->new( options => { foo => 'BAR' } );
}
-'... good constructor params';
+'good constructor params';
## check some errors
dies_ok {
$stuff->set_option( bar => {} );
}
-'... could not add a hash ref where an string is expected';
+'could not add a hash ref where an string is expected';
dies_ok {
Stuff->new( options => { foo => [] } );
}
-'... bad constructor params';
+'bad constructor params';
## test the meta
'options_elements' => 'elements',
'quantity' => [ accessor => 'quantity' ],
},
- '... got the right handles mapping'
+ 'got the right handles mapping'
);
is( $options->type_constraint->type_parameter, 'Str',
- '... got the right container type' );
+ 'got the right container type' );
$stuff->set_option( oink => "blah", xxy => "flop" );
my @key_value = sort{ $a->[0] cmp $b->[0] } $stuff->key_value;
is_deeply(
\@key_value,
[ sort{ $a->[0] cmp $b->[0] } [ 'xxy', 'flop' ], [ 'quantity', 4 ], [ 'oink', 'blah' ] ],
- '... got the right key value pairs'
+ 'got the right key value pairs'
) or do{ require Data::Dumper; diag(Data::Dumper::Dumper(\@key_value)) };
my %options_elements = $stuff->options_elements;
'quantity' => 4,
'xxy' => 'flop'
},
- '... got the right hash elements'
+ 'got the right hash elements'
);
odd => [ mod => 2 ],
cut_in_half => [ div => 2 ],
},
- '... got the right handles mapping'
+ 'got the right handles mapping'
);
product
];
-is_deeply( $stuff->_options, [ 1 .. 10 ], '... got options' );
+is_deeply( $stuff->_options, [ 1 .. 10 ], 'got options' );
-ok( !$stuff->has_no_options, '... we have options' );
-is( $stuff->num_options, 10, '... got 2 options' );
-cmp_ok( $stuff->get_option_at(0), '==', 1, '... get option 0' );
+ok( !$stuff->has_no_options, 'we have options' );
+is( $stuff->num_options, 10, 'got 2 options' );
+cmp_ok( $stuff->get_option_at(0), '==', 1, 'get option 0' );
is_deeply(
[ $stuff->filter_options( sub { $_ % 2 == 0 } ) ],
[ 2, 4, 6, 8, 10 ],
- '... got the right filtered values'
+ 'got the right filtered values'
);
is_deeply(
[ $stuff->map_options( sub { $_ * 2 } ) ],
[ 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 ],
- '... got the right mapped values'
+ 'got the right mapped values'
);
is( $stuff->find_option( sub { $_ % 2 == 0 } ), 2,
'.. found the right option' );
-is_deeply( [ $stuff->options ], [ 1 .. 10 ], '... got the list of options' );
+is_deeply( [ $stuff->options ], [ 1 .. 10 ], 'got the list of options' );
is( $stuff->join_options(':'), '1:2:3:4:5:6:7:8:9:10',
- '... joined the list of options by :' );
+ 'joined the list of options by :' );
is_deeply(
[ $stuff->sorted_options ], [ sort ( 1 .. 10 ) ],
- '... got sorted options (default sort order)'
+ 'got sorted options (default sort order)'
);
is_deeply(
[ $stuff->sorted_options( sub { $_[1] <=> $_[0] } ) ],
[ sort { $b <=> $a } ( 1 .. 10 ) ],
- '... got sorted options (descending sort order) '
+ 'got sorted options (descending sort order) '
);
throws_ok { $stuff->sorted_options('foo') }
'descending' => [ sort => $sort ],
'product' => [ reduce => $prod ],
},
- '... got the right handles mapping'
+ 'got the right handles mapping'
);
is( $options->type_constraint->type_parameter, 'Int',
- '... got the right container type' );
+ 'got the right container type' );
dies_ok {
$stuff->sort_in_place_options(undef);
}
-'... sort rejects arg of invalid type';
+'sort rejects arg of invalid type';
my $page = MyHomePage->new();
isa_ok( $page, 'MyHomePage' );
-is( $page->string, '', '... got the default value' );
-is( $page->length_string, 0,'... length is zero' );
+is( $page->string, '', 'got the default value' );
+is( $page->length_string, 0,'length is zero' );
$page->string('a');
-is( $page->length_string, 1,'... new string has length of one' );
+is( $page->length_string, 1,'new string has length of one' );
$page->inc_string;
-is( $page->string, 'b', '... got the incremented value' );
+is( $page->string, 'b', 'got the incremented value' );
$page->inc_string;
-is( $page->string, 'c', '... got the incremented value (again)' );
+is( $page->string, 'c', 'got the incremented value (again)' );
$page->append_string("foo$/");
is( $page->string, "cfoo$/", 'appended to string' );
is(
$string->type_constraint->name, 'Str',
- '... got the expected type constraint'
+ 'got the expected type constraint'
);
is_deeply(
capitalize_last => [ replace => qr/(.)$/, $uc ],
invalid_number => [ match => qr/\D/ ],
},
- '... got the right handles methods'
+ 'got the right handles methods'
);
lazy => 1,
default => 10,
);
- } '... this didnt die';
+ } 'this didnt die';
}
default => sub { Foo->new() },
handles => qr/^a$/,
);
- } '... can create the attribute with delegations';
+ } 'can create the attribute with delegations';
}
my $bar;
lives_ok {
$bar = Bar->new;
-} '... created the object ok';
+} 'created the object ok';
isa_ok($bar, 'Bar');
-is($bar->a, 'Foo::a', '... got the right delgated value');
+is($bar->a, 'Foo::a', 'got the right delgated value');
my @w;
$SIG{__WARN__} = sub { push @w, "@_" };
default => sub { Foo->new() },
handles => qr/.*/,
);
- } '... can create the attribute with delegations';
+ } 'can create the attribute with delegations';
}
my $baz;
lives_ok {
$baz = Baz->new;
-} '... created the object ok';
+} 'created the object ok';
isa_ok($baz, 'Baz');
-is($baz->a, 'Foo::a', '... got the right delgated value');
+is($baz->a, 'Foo::a', 'got the right delgated value');
default => sub { Foo->new() },
handles => [qw(a new)],
);
- } '... can create the attribute with delegations';
+ } 'can create the attribute with delegations';
}
my $blart;
lives_ok {
$blart = Blart->new;
-} '... created the object ok';
+} 'created the object ok';
isa_ok($blart, 'Blart');
-is($blart->a, 'Foo::a', '... got the right delgated value');
+is($blart->a, 'Foo::a', 'got the right delgated value');
is($baz->foo,
'Foo::foo(Baz::foo and Foo::foo())',
- '... got the right value for 1 augmented subclass calling non-augmented subclass');
+ 'got the right value for 1 augmented subclass calling non-augmented subclass');
::throws_ok {
extends 'My::Role';
} qr/You cannot inherit from a Moose Role \(My\:\:Role\)/,
- '... this croaks correctly';
+ 'this croaks correctly';
}
$foo->ar( [] );
}
qr/Attribute \(ar\) does not pass the type constraint because: ref: ARRAY/,
- '... got the right error message';
+ 'got the right error message';
throws_ok {
$foo->obj($foo); # Doh!
}
qr/Attribute \(obj\) does not pass the type constraint because: Well it is an object/,
- '... got the right error message';
+ 'got the right error message';
throws_ok {
$foo->nt($foo); # scalar
}
qr/Attribute \(nt\) does not pass the type constraint because: blessed/,
- '... got the right error message';
+ 'got the right error message';
my $mc = MyMetaclass->initialize('MyClass');
isa_ok($mc, 'MyMetaclass');
-ok($mc->meta->does_role('MyRole'), '... the metaclass does the role');
+ok($mc->meta->does_role('MyRole'), 'the metaclass does the role');
-is(MyClass->meta, $mc, '... these metas are the same thing');
-is(MyClass->meta->meta, $mc->meta, '... these meta-metas are the same thing');
+is(MyClass->meta, $mc, 'these metas are the same thing');
+is(MyClass->meta->meta, $mc->meta, 'these meta-metas are the same thing');
my $a = MyClass->new;
ok( $a->meta->meta->does_role('MyRole'), 'metaclass does MyRole' );
-is( $a->meta->foo, 'i am foo', '... foo method returns expected value' );
+is( $a->meta->foo, 'i am foo', 'foo method returns expected value' );
ok( MyClass->meta->meta->does_role('MyRole'), 'metaclass does MyRole' );
-is( MyClass->meta->foo, 'i am foo', '... foo method returns expected value' );
+is( MyClass->meta->foo, 'i am foo', 'foo method returns expected value' );
lives_ok {
MyClass->meta->make_immutable;
-} '... make MyClass immutable okay';
+} 'make MyClass immutable okay';
-is(MyClass->meta, $mc, '... these metas are still the same thing');
-is(MyClass->meta->meta, $mc->meta, '... these meta-metas are the same thing');
+is(MyClass->meta, $mc, 'these metas are still the same thing');
+is(MyClass->meta->meta, $mc->meta, 'these meta-metas are the same thing');
ok( $a->meta->meta->does_role('MyRole'), 'metaclass does MyRole' );
-is( $a->meta->foo, 'i am foo', '... foo method returns expected value' );
+is( $a->meta->foo, 'i am foo', 'foo method returns expected value' );
ok( MyClass->meta->meta->does_role('MyRole'), 'metaclass does MyRole' );
-is( MyClass->meta->foo, 'i am foo', '... foo method returns expected value' );
+is( MyClass->meta->foo, 'i am foo', 'foo method returns expected value' );
lives_ok {
MyClass->meta->make_mutable;
-} '... make MyClass mutable okay';
+} 'make MyClass mutable okay';
-is(MyClass->meta, $mc, '... these metas are still the same thing');
-is(MyClass->meta->meta, $mc->meta, '... these meta-metas are the same thing');
+is(MyClass->meta, $mc, 'these metas are still the same thing');
+is(MyClass->meta->meta, $mc->meta, 'these meta-metas are the same thing');
ok( $a->meta->meta->does_role('MyRole'), 'metaclass does MyRole' );
-is( $a->meta->foo, 'i am foo', '... foo method returns expected value' );
+is( $a->meta->foo, 'i am foo', 'foo method returns expected value' );
ok( MyClass->meta->meta->does_role('MyRole'), 'metaclass does MyRole' );
-is( MyClass->meta->foo, 'i am foo', '... foo method returns expected value' );
+is( MyClass->meta->foo, 'i am foo', 'foo method returns expected value' );
lives_ok {
MyMetaclass->meta->make_immutable;
-} '... make MyClass immutable okay';
+} 'make MyClass immutable okay';
-is(MyClass->meta, $mc, '... these metas are still the same thing');
-is(MyClass->meta->meta, $mc->meta, '... these meta-metas are the same thing');
+is(MyClass->meta, $mc, 'these metas are still the same thing');
+is(MyClass->meta->meta, $mc->meta, 'these meta-metas are the same thing');
ok( $a->meta->meta->does_role('MyRole'), 'metaclass does MyRole' );
-is( $a->meta->foo, 'i am foo', '... foo method returns expected value' );
+is( $a->meta->foo, 'i am foo', 'foo method returns expected value' );
ok( MyClass->meta->meta->does_role('MyRole'), 'metaclass does MyRole' );
-is( MyClass->meta->foo, 'i am foo', '... foo method returns expected value' );
+is( MyClass->meta->foo, 'i am foo', 'foo method returns expected value' );
lives_ok {
MyClass->meta->make_immutable;
-} '... make MyClass immutable okay';
+} 'make MyClass immutable okay';
-is(MyClass->meta, $mc, '... these metas are still the same thing');
-is(MyClass->meta->meta, $mc->meta, '... these meta-metas are the same thing');
+is(MyClass->meta, $mc, 'these metas are still the same thing');
+is(MyClass->meta->meta, $mc->meta, 'these meta-metas are the same thing');
ok( $a->meta->meta->does_role('MyRole'), 'metaclass does MyRole' );
-is( $a->meta->foo, 'i am foo', '... foo method returns expected value' );
+is( $a->meta->foo, 'i am foo', 'foo method returns expected value' );
ok( MyClass->meta->meta->does_role('MyRole'), 'metaclass does MyRole' );
-is( MyClass->meta->foo, 'i am foo', '... foo method returns expected value' );
+is( MyClass->meta->foo, 'i am foo', 'foo method returns expected value' );
my $no_more_than_10 = Constraint::NoMoreThan->new(value => 10);
isa_ok($no_more_than_10, 'Constraint::NoMoreThan');
-ok($no_more_than_10->does('Constraint'), '... Constraint::NoMoreThan does Constraint');
+ok($no_more_than_10->does('Constraint'), 'Constraint::NoMoreThan does Constraint');
-ok(!defined($no_more_than_10->validate(1)), '... validated correctly');
-is($no_more_than_10->validate(11), 'must be no more than 10', '... validation failed correctly');
+ok(!defined($no_more_than_10->validate(1)), 'validated correctly');
+is($no_more_than_10->validate(11), 'must be no more than 10', 'validation failed correctly');
my $at_least_10 = Constraint::AtLeast->new(value => 10);
isa_ok($at_least_10, 'Constraint::AtLeast');
-ok($at_least_10->does('Constraint'), '... Constraint::AtLeast does Constraint');
+ok($at_least_10->does('Constraint'), 'Constraint::AtLeast does Constraint');
-ok(!defined($at_least_10->validate(11)), '... validated correctly');
-is($at_least_10->validate(1), 'must be at least 10', '... validation failed correctly');
+ok(!defined($at_least_10->validate(11)), 'validated correctly');
+is($at_least_10->validate(1), 'must be at least 10', 'validation failed correctly');
# onlength
isa_ok($no_more_than_10_chars, 'Constraint::LengthNoMoreThan');
isa_ok($no_more_than_10_chars, 'Constraint::NoMoreThan');
-ok($no_more_than_10_chars->does('Constraint'), '... Constraint::LengthNoMoreThan does Constraint');
-ok($no_more_than_10_chars->does('Constraint::OnLength'), '... Constraint::LengthNoMoreThan does Constraint::OnLength');
+ok($no_more_than_10_chars->does('Constraint'), 'Constraint::LengthNoMoreThan does Constraint');
+ok($no_more_than_10_chars->does('Constraint::OnLength'), 'Constraint::LengthNoMoreThan does Constraint::OnLength');
-ok(!defined($no_more_than_10_chars->validate('foo')), '... validated correctly');
+ok(!defined($no_more_than_10_chars->validate('foo')), 'validated correctly');
is($no_more_than_10_chars->validate('foooooooooo'),
'must be no more than 10 chars',
- '... validation failed correctly');
+ 'validation failed correctly');
my $at_least_10_chars = Constraint::LengthAtLeast->new(value => 10, units => 'chars');
isa_ok($at_least_10_chars, 'Constraint::LengthAtLeast');
isa_ok($at_least_10_chars, 'Constraint::AtLeast');
-ok($at_least_10_chars->does('Constraint'), '... Constraint::LengthAtLeast does Constraint');
-ok($at_least_10_chars->does('Constraint::OnLength'), '... Constraint::LengthAtLeast does Constraint::OnLength');
+ok($at_least_10_chars->does('Constraint'), 'Constraint::LengthAtLeast does Constraint');
+ok($at_least_10_chars->does('Constraint::OnLength'), 'Constraint::LengthAtLeast does Constraint::OnLength');
-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');
+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');
is(Moose::POOP::Object->meta->instance_metaclass,
'Moose::POOP::Meta::Instance',
- '... got the right instance metaclass name');
+ 'got the right instance metaclass name');
isa_ok(Moose::POOP::Object->meta->get_meta_instance, 'Moose::POOP::Meta::Instance');
is($base->meta->instance_metaclass,
'Moose::POOP::Meta::Instance',
- '... got the right instance metaclass name');
+ 'got the right instance metaclass name');
isa_ok($base->meta->get_meta_instance, 'Moose::POOP::Meta::Instance');
}
status => 'pending'
);
- } '... created my article successfully';
+ } 'created my article successfully';
isa_ok($article, 'Newswriter::Article');
isa_ok($article, 'Moose::POOP::Object');
lives_ok {
$article->start_date(DateTime->new(year => 2006, month => 6, day => 10));
$article->end_date(DateTime->new(year => 2006, month => 6, day => 17));
- } '... add the article date-time stuff';
+ } 'add the article date-time stuff';
## check some meta stuff
is($article->meta->instance_metaclass,
'Moose::POOP::Meta::Instance',
- '... got the right instance metaclass name');
+ 'got the right instance metaclass name');
isa_ok($article->meta->get_meta_instance, 'Moose::POOP::Meta::Instance');
- ok($article->oid, '... got a oid for the article');
+ ok($article->oid, 'got a oid for the article');
$article_oid = $article->oid;
$article_ref = "$article";
is($article->headline,
'Home Office Redecorated',
- '... got the right headline');
+ 'got the right headline');
is($article->summary,
'The home office was recently redecorated to match the new company colors',
- '... got the right summary');
- is($article->article, '...', '... got the right article');
+ 'got the right summary');
+ is($article->article, '...', 'got the right article');
isa_ok($article->start_date, 'DateTime');
isa_ok($article->end_date, 'DateTime');
isa_ok($article->author, 'Newswriter::Author');
- is($article->author->first_name, 'Truman', '... got the right author first name');
- is($article->author->last_name, 'Capote', '... got the right author last name');
+ is($article->author->first_name, 'Truman', 'got the right author first name');
+ is($article->author->last_name, 'Capote', 'got the right author last name');
- is($article->status, 'pending', '... got the right status');
+ is($article->status, 'pending', 'got the right status');
}
Moose::POOP::Meta::Instance->_reload_db();
status => 'posted'
);
- } '... created my article successfully';
+ } 'created my article successfully';
isa_ok($article2, 'Newswriter::Article');
isa_ok($article2, 'Moose::POOP::Object');
is($article2->headline,
'Company wins Lottery',
- '... got the right headline');
+ 'got the right headline');
is($article2->summary,
'An email was received today that informed the company we have won the lottery',
- '... got the right summary');
- is($article2->article, 'WoW', '... got the right article');
+ 'got the right summary');
+ is($article2->article, 'WoW', 'got the right article');
- ok(!$article2->start_date, '... these two dates are unassigned');
- ok(!$article2->end_date, '... these two dates are unassigned');
+ ok(!$article2->start_date, 'these two dates are unassigned');
+ ok(!$article2->end_date, 'these two dates are unassigned');
isa_ok($article2->author, 'Newswriter::Author');
- is($article2->author->first_name, 'Katie', '... got the right author first name');
- is($article2->author->last_name, 'Couric', '... got the right author last name');
+ is($article2->author->first_name, 'Katie', 'got the right author first name');
+ is($article2->author->last_name, 'Couric', 'got the right author last name');
- is($article2->status, 'posted', '... got the right status');
+ is($article2->status, 'posted', 'got the right status');
## orig-article
my $article;
lives_ok {
$article = Newswriter::Article->new(oid => $article_oid);
- } '... (re)-created my article successfully';
+ } '(re)-created my article successfully';
isa_ok($article, 'Newswriter::Article');
isa_ok($article, 'Moose::POOP::Object');
- is($article->oid, $article_oid, '... got a oid for the article');
- isnt($article_ref, "$article", '... got a new article instance');
+ is($article->oid, $article_oid, 'got a oid for the article');
+ isnt($article_ref, "$article", 'got a new article instance');
is($article->headline,
'Home Office Redecorated',
- '... got the right headline');
+ 'got the right headline');
is($article->summary,
'The home office was recently redecorated to match the new company colors',
- '... got the right summary');
- is($article->article, '...', '... got the right article');
+ 'got the right summary');
+ is($article->article, '...', 'got the right article');
isa_ok($article->start_date, 'DateTime');
isa_ok($article->end_date, 'DateTime');
isa_ok($article->author, 'Newswriter::Author');
- is($article->author->first_name, 'Truman', '... got the right author first name');
- is($article->author->last_name, 'Capote', '... got the right author last name');
+ is($article->author->first_name, 'Truman', 'got the right author first name');
+ is($article->author->last_name, 'Capote', 'got the right author last name');
lives_ok {
$article->author->first_name('Dan');
$article->author->last_name('Rather');
- } '... changed the value ok';
+ } 'changed the value ok';
- is($article->author->first_name, 'Dan', '... got the changed author first name');
- is($article->author->last_name, 'Rather', '... got the changed author last name');
+ is($article->author->first_name, 'Dan', 'got the changed author first name');
+ is($article->author->last_name, 'Rather', 'got the changed author last name');
- is($article->status, 'pending', '... got the right status');
+ is($article->status, 'pending', 'got the right status');
}
Moose::POOP::Meta::Instance->_reload_db();
my $article;
lives_ok {
$article = Newswriter::Article->new(oid => $article_oid);
- } '... (re)-created my article successfully';
+ } '(re)-created my article successfully';
isa_ok($article, 'Newswriter::Article');
isa_ok($article, 'Moose::POOP::Object');
- is($article->oid, $article_oid, '... got a oid for the article');
- isnt($article_ref, "$article", '... got a new article instance');
+ is($article->oid, $article_oid, 'got a oid for the article');
+ isnt($article_ref, "$article", 'got a new article instance');
is($article->headline,
'Home Office Redecorated',
- '... got the right headline');
+ 'got the right headline');
is($article->summary,
'The home office was recently redecorated to match the new company colors',
- '... got the right summary');
- is($article->article, '...', '... got the right article');
+ 'got the right summary');
+ is($article->article, '...', 'got the right article');
isa_ok($article->start_date, 'DateTime');
isa_ok($article->end_date, 'DateTime');
isa_ok($article->author, 'Newswriter::Author');
- is($article->author->first_name, 'Dan', '... got the changed author first name');
- is($article->author->last_name, 'Rather', '... got the changed author last name');
+ is($article->author->first_name, 'Dan', 'got the changed author first name');
+ is($article->author->last_name, 'Rather', 'got the changed author last name');
- is($article->status, 'pending', '... got the right status');
+ is($article->status, 'pending', 'got the right status');
my $article2;
lives_ok {
$article2 = Newswriter::Article->new(oid => $article2_oid);
- } '... (re)-created my article successfully';
+ } '(re)-created my article successfully';
isa_ok($article2, 'Newswriter::Article');
isa_ok($article2, 'Moose::POOP::Object');
- is($article2->oid, $article2_oid, '... got a oid for the article');
- isnt($article2_ref, "$article2", '... got a new article instance');
+ is($article2->oid, $article2_oid, 'got a oid for the article');
+ isnt($article2_ref, "$article2", 'got a new article instance');
is($article2->headline,
'Company wins Lottery',
- '... got the right headline');
+ 'got the right headline');
is($article2->summary,
'An email was received today that informed the company we have won the lottery',
- '... got the right summary');
- is($article2->article, 'WoW', '... got the right article');
+ 'got the right summary');
+ is($article2->article, 'WoW', 'got the right article');
- ok(!$article2->start_date, '... these two dates are unassigned');
- ok(!$article2->end_date, '... these two dates are unassigned');
+ ok(!$article2->start_date, 'these two dates are unassigned');
+ ok(!$article2->end_date, 'these two dates are unassigned');
isa_ok($article2->author, 'Newswriter::Author');
- is($article2->author->first_name, 'Katie', '... got the right author first name');
- is($article2->author->last_name, 'Couric', '... got the right author last name');
+ is($article2->author->first_name, 'Katie', 'got the right author first name');
+ is($article2->author->last_name, 'Couric', 'got the right author last name');
- is($article2->status, 'posted', '... got the right status');
+ is($article2->status, 'posted', 'got the right status');
}
::lives_ok {
with 'List', 'List::Immutable';
- } '... successfully composed roles together';
+ } 'successfully composed roles together';
package My::List2;
use Moose;
::lives_ok {
with 'List::Immutable', 'List';
- } '... successfully composed roles together';
+ } 'successfully composed roles together';
}
my $coll = My::List1->new;
isa_ok($coll, 'My::List1');
- ok($coll->does('List'), '... $coll does List');
- ok($coll->does('List::Immutable'), '... $coll does List::Immutable');
+ ok($coll->does('List'), '$coll does List');
+ ok($coll->does('List::Immutable'), '$coll does List::Immutable');
- ok($coll->is_empty, '... we have an empty collection');
- is($coll->length, 0, '... we have a length of 1 for the collection');
+ ok($coll->is_empty, 'we have an empty collection');
+ is($coll->length, 0, 'we have a length of 1 for the collection');
}
{
my $coll = My::List2->new;
isa_ok($coll, 'My::List2');
- ok($coll->does('List'), '... $coll does List');
- ok($coll->does('List::Immutable'), '... $coll does List::Immutable');
+ ok($coll->does('List'), '$coll does List');
+ ok($coll->does('List::Immutable'), '$coll does List::Immutable');
- ok($coll->is_empty, '... we have an empty collection');
- is($coll->length, 0, '... we have a length of 1 for the collection');
+ ok($coll->is_empty, 'we have an empty collection');
+ is($coll->length, 0, 'we have a length of 1 for the collection');
}
{
my $coll = My::List1->new('::' => [ 1 .. 10 ]);
isa_ok($coll, 'My::List1');
- ok($coll->does('List'), '... $coll does List');
- ok($coll->does('List::Immutable'), '... $coll does List::Immutable');
+ ok($coll->does('List'), '$coll does List');
+ ok($coll->does('List::Immutable'), '$coll does List::Immutable');
- ok(!$coll->is_empty, '... we do not have an empty collection');
- is($coll->length, 10, '... we have a length of 10 for the collection');
+ ok(!$coll->is_empty, 'we do not have an empty collection');
+ is($coll->length, 10, 'we have a length of 10 for the collection');
- is($coll->print, '1, 2, 3, 4, 5, 6, 7, 8, 9, 10', '... got the right printed value');
+ is($coll->print, '1, 2, 3, 4, 5, 6, 7, 8, 9, 10', 'got the right printed value');
my $coll2 = $coll->apply(sub { $_[0] * $_[0] });
isa_ok($coll2, 'My::List1');
- is($coll->print, '1, 2, 3, 4, 5, 6, 7, 8, 9, 10', '... original is still the same');
- is($coll2->print, '1, 4, 9, 16, 25, 36, 49, 64, 81, 100', '... new collection is changed');
+ is($coll->print, '1, 2, 3, 4, 5, 6, 7, 8, 9, 10', 'original is still the same');
+ is($coll2->print, '1, 4, 9, 16, 25, 36, 49, 64, 81, 100', 'new collection is changed');
}
{
my $coll = My::List2->new('::' => [ 1 .. 10 ]);
isa_ok($coll, 'My::List2');
- ok($coll->does('List'), '... $coll does List');
- ok($coll->does('List::Immutable'), '... $coll does List::Immutable');
+ ok($coll->does('List'), '$coll does List');
+ ok($coll->does('List::Immutable'), '$coll does List::Immutable');
- ok(!$coll->is_empty, '... we do not have an empty collection');
- is($coll->length, 10, '... we have a length of 10 for the collection');
+ ok(!$coll->is_empty, 'we do not have an empty collection');
+ is($coll->length, 10, 'we have a length of 10 for the collection');
- is($coll->print, '1, 2, 3, 4, 5, 6, 7, 8, 9, 10', '... got the right printed value');
+ is($coll->print, '1, 2, 3, 4, 5, 6, 7, 8, 9, 10', 'got the right printed value');
my $coll2 = $coll->apply(sub { $_[0] * $_[0] });
isa_ok($coll2, 'My::List2');
- is($coll->print, '1, 2, 3, 4, 5, 6, 7, 8, 9, 10', '... original is still the same');
- is($coll2->print, '1, 4, 9, 16, 25, 36, 49, 64, 81, 100', '... new collection is changed');
+ is($coll->print, '1, 2, 3, 4, 5, 6, 7, 8, 9, 10', 'original is still the same');
+ is($coll2->print, '1, 4, 9, 16, 25, 36, 49, 64, 81, 100', 'new collection is changed');
}
'bar' => $hash_of_arrays_of_objs,
'baz' => $array_of_ints,
);
-} '... construction succeeded';
+} 'construction succeeded';
isa_ok($foo, 'Foo');
-is_deeply($foo->bar, $hash_of_arrays_of_objs, '... got our value correctly');
-is_deeply($foo->baz, $array_of_ints, '... got our value correctly');
+is_deeply($foo->bar, $hash_of_arrays_of_objs, 'got our value correctly');
+is_deeply($foo->baz, $array_of_ints, 'got our value correctly');
dies_ok {
$foo->bar([]);
-} '... validation failed correctly';
+} 'validation failed correctly';
dies_ok {
$foo->bar({ foo => 3 });
-} '... validation failed correctly';
+} 'validation failed correctly';
dies_ok {
$foo->bar({ foo => [ 1, 2, 3 ] });
-} '... validation failed correctly';
+} 'validation failed correctly';
dies_ok {
$foo->baz([ "foo" ]);
-} '... validation failed correctly';
+} 'validation failed correctly';
dies_ok {
$foo->baz({});
-} '... validation failed correctly';
+} 'validation failed correctly';
my $foo;
lives_ok {
$foo = Foo->new('bar' => $array_of_hashes);
-} '... construction succeeded';
+} 'construction succeeded';
isa_ok($foo, 'Foo');
-is_deeply($foo->bar, $array_of_hashes, '... got our value correctly');
+is_deeply($foo->bar, $array_of_hashes, 'got our value correctly');
dies_ok {
$foo->bar({});
-} '... validation failed correctly';
+} 'validation failed correctly';
dies_ok {
$foo->bar([{ foo => 3 }]);
-} '... validation failed correctly';
+} 'validation failed correctly';
foreach my $class (qw/ProtoMoose::Object Foo Bar/) {
isa_ok($class->meta,
'ProtoMoose::Meta::Class',
- '... got the right metaclass for ' . $class . ' ->');
+ 'got the right metaclass for ' . $class . ' ->');
is($class->meta->instance_metaclass,
'ProtoMoose::Meta::Instance',
- '... got the right instance meta for ' . $class);
+ 'got the right instance meta for ' . $class);
is($class->meta->attribute_metaclass,
'ProtoMoose::Meta::Attribute',
- '... got the right attribute meta for ' . $class);
+ 'got the right attribute meta for ' . $class);
}
## ------------------------------------------------------------------
# set a value in the prototype
$foo_prototype->bar(100);
-is($foo_prototype->bar, 100, '... got the value stored in the prototype');
+is($foo_prototype->bar, 100, 'got the value stored in the prototype');
# the "class" defers to the
# the prototype when asked
# about attributes
-is(Foo->bar, 100, '... got the value stored in the prototype (through the Foo class)');
+is(Foo->bar, 100, 'got the value stored in the prototype (through the Foo class)');
# now make an instance, which
# is basically a clone of the
isa_ok($foo, 'Foo');
# the instance is *not* the prototype
-isnt($foo, $foo_prototype, '... got a new instance of Foo');
+isnt($foo, $foo_prototype, 'got a new instance of Foo');
# but it has the same values ...
-is($foo->bar, 100, '... got the value stored in the instance (inherited from the prototype)');
+is($foo->bar, 100, 'got the value stored in the instance (inherited from the prototype)');
# we can even change the values
# in the instance
$foo->bar(300);
-is($foo->bar, 300, '... got the value stored in the instance (overwriting the one inherited from the prototype)');
+is($foo->bar, 300, 'got the value stored in the instance (overwriting the one inherited from the prototype)');
# and not change the one in the prototype
-is($foo_prototype->bar, 100, '... got the value stored in the prototype');
-is(Foo->bar, 100, '... got the value stored in the prototype (through the Foo class)');
+is($foo_prototype->bar, 100, 'got the value stored in the prototype');
+is(Foo->bar, 100, 'got the value stored in the prototype (through the Foo class)');
## subclasses
# now we can check that the subclass
# will seek out the correct prototypical
# value from it's "parent"
-is(Bar->bar, 100, '... got the value stored in the Foo prototype (through the Bar class)');
+is(Bar->bar, 100, 'got the value stored in the Foo prototype (through the Bar class)');
# we can then also set it's local attrs
Bar->baz(50);
-is(Bar->baz, 50, '... got the value stored in the prototype (through the Bar class)');
+is(Bar->baz, 50, 'got the value stored in the prototype (through the Bar class)');
# now we clone the Bar prototype
my $bar = Bar->new;
# and we see that we got the right values
# in the instance/clone
-is($bar->bar, 100, '... got the value stored in the instance (inherited from the Foo prototype)');
-is($bar->baz, 50, '... got the value stored in the instance (inherited from the Bar prototype)');
+is($bar->bar, 100, 'got the value stored in the instance (inherited from the Foo prototype)');
+is($bar->baz, 50, 'got the value stored in the instance (inherited from the Bar prototype)');
# nowe we can change the value
$bar->bar(200);
-is($bar->bar, 200, '... got the value stored in the instance (overriding the one inherited from the Foo prototype)');
+is($bar->bar, 200, 'got the value stored in the instance (overriding the one inherited from the Foo prototype)');
# and all our original and
# prototypical values are still
# the same
-is($foo->bar, 300, '... still got the original value stored in the instance (inherited from the prototype)');
-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)');
+is($foo->bar, 300, 'still got the original value stored in the instance (inherited from the prototype)');
+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)');
isa_ok( $parent, 'Parent' );
is( $parent->last_name, 'Smith',
- '... the parent has the last name we expected' );
+ 'the parent has the last name we expected' );
$parent->children( [ map { Child->new( parent => $parent ) } ( 0 .. 3 ) ] );
foreach my $child ( @{ $parent->children } ) {
is( $child->last_name, $parent->last_name,
- '... parent and child have the same last name ('
+ 'parent and child have the same last name ('
. $parent->last_name
. ')' );
}
$parent->last_name('Jones');
-is( $parent->last_name, 'Jones', '... the parent has the new last name' );
+is( $parent->last_name, 'Jones', 'the parent has the new last name' );
foreach my $child ( @{ $parent->children } ) {
is( $child->last_name, $parent->last_name,
- '... parent and child have the same last name ('
+ 'parent and child have the same last name ('
. $parent->last_name
. ')' );
}
foreach my $child ( @{ $parent->children } ) {
is( $child->last_name, $parent->last_name,
- '... parent and child have the same last name ('
+ 'parent and child have the same last name ('
. $parent->last_name
. ')' );
}
isnt( $orphan->last_name, $parent->last_name,
- '... the orphan child does not have the same last name anymore ('
+ 'the orphan child does not have the same last name anymore ('
. $parent2->last_name
. ')' );
is( $orphan->last_name, $parent2->last_name,
- '... parent2 and orphan child have the same last name ('
+ 'parent2 and orphan child have the same last name ('
. $parent2->last_name
. ')' );
$parent->last_name('Miller');
is( $parent->last_name, 'Miller',
- '... the parent has the new last name (again)' );
+ 'the parent has the new last name (again)' );
foreach my $child ( @{ $parent->children } ) {
is( $child->last_name, $parent->last_name,
- '... parent and child have the same last name ('
+ 'parent and child have the same last name ('
. $parent->last_name
. ')' );
}
isnt( $orphan->last_name, $parent->last_name,
- '... the orphan child is not affected by changes in the parent anymore' );
+ 'the orphan child is not affected by changes in the parent anymore' );
is( $orphan->last_name, $parent2->last_name,
- '... parent2 and orphan child have the same last name ('
+ 'parent2 and orphan child have the same last name ('
. $parent2->last_name
. ')' );
my $rsi = RecordSetIterator->new(record_set => $rs);
isa_ok($rsi, 'RecordSetIterator');
-is($rsi->first_name, 'Bill', '... got the right first name');
-is($rsi->last_name, 'Smith', '... got the right last name');
+is($rsi->first_name, 'Bill', 'got the right first name');
+is($rsi->last_name, 'Smith', 'got the right last name');
$rsi->get_next_record;
-is($rsi->first_name, 'Bob', '... got the right first name');
-is($rsi->last_name, 'Jones', '... got the right last name');
+is($rsi->first_name, 'Bob', 'got the right first name');
+is($rsi->last_name, 'Jones', 'got the right last name');
$rsi->get_next_record;
-is($rsi->first_name, 'Jim', '... got the right first name');
-is($rsi->last_name, 'Johnson', '... got the right last name');
+is($rsi->first_name, 'Jim', 'got the right first name');
+is($rsi->last_name, 'Johnson', 'got the right last name');
my $foo = Foo->new;
isa_ok($foo, 'Foo');
-is($foo->baz, 'Foo::baz', '... got the right value');
+is($foo->baz, 'Foo::baz', 'got the right value');
lives_ok {
My::Role->meta->apply($foo)
-} '... successfully applied the role to immutable instance';
+} 'successfully applied the role to immutable instance';
-is($foo->baz, 'My::Role::baz(Foo::baz)', '... got the right value');
+is($foo->baz, 'My::Role::baz(Foo::baz)', 'got the right value');
lives_ok {
My::Meta->meta()->make_immutable(debug => 0)
-} '... can make a meta class immutable';
+} 'can make a meta class immutable';
eval { AClass->new(baz => 'bar') };
like ($@, qr/^Pulling the Baz trigger/, "trigger from immutable constructor");
-lives_ok { AClass->new(bar => 'bar') } '... no triggers called';
+lives_ok { AClass->new(bar => 'bar') } 'no triggers called';
is( $class->new( 37 )->bar, 37, "single arg" );
{
my $o = $class->new(bar => 42, baz => 47);
- is($o->bar, 42, '... got the right bar');
- is($o->baz, 47, '... got the right bar');
+ is($o->bar, 42, 'got the right bar');
+ is($o->baz, 47, 'got the right bar');
}
{
my $o = $class->new(42, baz => 47);
- is($o->bar, 42, '... got the right bar');
- is($o->baz, 47, '... got the right bar');
+ is($o->bar, 42, 'got the right bar');
+ is($o->baz, 47, 'got the right bar');
}
}
# Classes
-ok(does_role('Bar', 'Foo'), '... Bar does Foo');
+ok(does_role('Bar', 'Foo'), 'Bar does Foo');
-ok(!does_role('Baz', 'Foo'), '... Baz doesnt do Foo');
+ok(!does_role('Baz', 'Foo'), 'Baz doesnt do Foo');
# Objects
my $bar = Bar->new;
-ok(does_role($bar, 'Foo'), '... $bar does Foo');
+ok(does_role($bar, 'Foo'), '$bar does Foo');
my $baz = Baz->new;
-ok(!does_role($baz, 'Foo'), '... $baz doesnt do Foo');
+ok(!does_role($baz, 'Foo'), '$baz doesnt do Foo');
# Invalid values
-ok(!does_role(undef,'Foo'), '... undef doesnt do Foo');
+ok(!does_role(undef,'Foo'), 'undef doesnt do Foo');
-ok(!does_role(1,'Foo'), '... 1 doesnt do Foo');
+ok(!does_role(1,'Foo'), '1 doesnt do Foo');
# non Moose metaclass
-ok(!does_role('Quux', 'Foo'), '... Quux doesnt do Foo (does not die tho)');
+ok(!does_role('Quux', 'Foo'), 'Quux doesnt do Foo (does not die tho)');
# TODO: make the below work, maybe?
# Self
-#ok(does_role('Foo', 'Foo'), '... Foo does do Foo');
+#ok(does_role('Foo', 'Foo'), 'Foo does do Foo');
# sub-Roles
-#ok(does_role('Foo::Foo', 'Foo'), '... Foo::Foo does do Foo');
+#ok(does_role('Foo::Foo', 'Foo'), 'Foo::Foo does do Foo');
{ package SCBR::A;
use Moose;
}
-is search_class_by_role('SCBR::A', 'SCBR::Role'), undef, '... not found role returns undef';
+is search_class_by_role('SCBR::A', 'SCBR::Role'), undef, 'not found role returns undef';
{ package SCBR::B;
use Moose;
extends 'SCBR::A';
with 'SCBR::Role';
}
-is search_class_by_role('SCBR::B', 'SCBR::Role'), 'SCBR::B', '... class itself returned if it does role';
+is search_class_by_role('SCBR::B', 'SCBR::Role'), 'SCBR::B', 'class itself returned if it does role';
{ package SCBR::C;
use Moose;
extends 'SCBR::B';
}
-is search_class_by_role('SCBR::C', 'SCBR::Role'), 'SCBR::B', '... nearest class doing role returned';
+is search_class_by_role('SCBR::C', 'SCBR::Role'), 'SCBR::B', 'nearest class doing role returned';
{ package SCBR::D;
use Moose;
extends 'SCBR::C';
with 'SCBR::Role';
}
-is search_class_by_role('SCBR::D', 'SCBR::Role'), 'SCBR::D', '... nearest class being direct class returned';
+is search_class_by_role('SCBR::D', 'SCBR::Role'), 'SCBR::D', 'nearest class being direct class returned';
test_out('ok 1 - ... has_attribute_ok(Foo, foo) passes');
-has_attribute_ok('Foo', 'foo', '... has_attribute_ok(Foo, foo) passes');
+has_attribute_ok('Foo', 'foo', 'has_attribute_ok(Foo, foo) passes');
test_out ('not ok 2 - ... has_attribute_ok(Foo, bar) fails');
test_fail (+2);
-has_attribute_ok('Foo', 'bar', '... has_attribute_ok(Foo, bar) fails');
+has_attribute_ok('Foo', 'bar', 'has_attribute_ok(Foo, bar) fails');
test_out('ok 3 - ... has_attribute_ok(Bar, foo) passes');
-has_attribute_ok('Bar', 'foo', '... has_attribute_ok(Bar, foo) passes');
+has_attribute_ok('Bar', 'foo', 'has_attribute_ok(Bar, foo) passes');
test_out('ok 4 - ... has_attribute_ok(Bar, bar) passes');
-has_attribute_ok('Bar', 'bar', '... has_attribute_ok(Bar, bar) passes');
+has_attribute_ok('Bar', 'bar', 'has_attribute_ok(Bar, bar) passes');
test_test ('has_attribute_ok');
test_out('ok 1 - ... meta_ok(Foo) passes');
-meta_ok('Foo', '... meta_ok(Foo) passes');
+meta_ok('Foo', 'meta_ok(Foo) passes');
test_out ('not ok 2 - ... meta_ok(Bar) fails');
test_fail (+2);
-meta_ok('Bar', '... meta_ok(Bar) fails');
+meta_ok('Bar', 'meta_ok(Bar) fails');
test_test ('meta_ok');