-#!/usr/bin/perl
-
use strict;
use warnings;
-use Test::More tests => 85;
+use Test::More tests => 88;
use File::Spec;
+use Scalar::Util 'reftype';
-BEGIN {
- use_ok('Class::MOP');
- require_ok(File::Spec->catdir('examples', 'InsideOutClass.pod'));
+BEGIN {use Class::MOP;
+ require_ok(File::Spec->catfile('examples', 'InsideOutClass.pod'));
}
{
use warnings;
use metaclass (
- ':attribute_metaclass' => 'InsideOutClass::Attribute',
- ':instance_metaclass' => 'InsideOutClass::Instance'
+ 'attribute_metaclass' => 'InsideOutClass::Attribute',
+ 'instance_metaclass' => 'InsideOutClass::Instance'
);
Foo->meta->add_attribute('foo' => (
}
package Bar;
+ use metaclass (
+ 'attribute_metaclass' => 'InsideOutClass::Attribute',
+ 'instance_metaclass' => 'InsideOutClass::Instance'
+ );
use strict;
use warnings;
use strict;
use warnings;
use metaclass (
- ':attribute_metaclass' => 'InsideOutClass::Attribute',
- ':instance_metaclass' => 'InsideOutClass::Instance'
+ 'attribute_metaclass' => 'InsideOutClass::Attribute',
+ 'instance_metaclass' => 'InsideOutClass::Instance'
);
Baz->meta->add_attribute('bling' => (
));
package Bar::Baz;
+ use metaclass (
+ 'attribute_metaclass' => 'InsideOutClass::Attribute',
+ 'instance_metaclass' => 'InsideOutClass::Instance'
+ );
use strict;
use warnings;
my $foo = Foo->new();
isa_ok($foo, 'Foo');
+is(reftype($foo), 'SCALAR', '... Foo is made with SCALAR');
+
can_ok($foo, 'foo');
can_ok($foo, 'has_foo');
can_ok($foo, 'get_bar');
my $foo2 = Foo->new();
isa_ok($foo2, 'Foo');
+is(reftype($foo2), 'SCALAR', '... Foo is made with SCALAR');
+
ok(!$foo2->has_foo, '... Foo2::foo is not defined yet');
is($foo2->foo(), undef, '... Foo2::foo is not defined yet');
is($foo2->get_bar(), 'FOO is BAR', '... Foo2::bar has been initialized');
isa_ok($bar, 'Bar');
isa_ok($bar, 'Foo');
+is(reftype($bar), 'SCALAR', '... Bar is made with SCALAR');
+
can_ok($bar, 'foo');
can_ok($bar, 'has_foo');
can_ok($bar, 'get_bar');
isa_ok($baz, 'Foo');
isa_ok($baz, 'Baz');
+is(reftype($baz), 'SCALAR', '... Bar::Baz is made with SCALAR');
+
can_ok($baz, 'foo');
can_ok($baz, 'has_foo');
can_ok($baz, 'get_bar');
is(scalar(keys(%{'Bar::Baz::bar'})), 0, '... got the right number of entries for Bar::Baz::bar');
is(scalar(keys(%{'Bar::Baz::baz'})), 0, '... got the right number of entries for Bar::Baz::baz');
is(scalar(keys(%{'Bar::Baz::bling'})), 0, '... got the right number of entries for Bar::Baz::bling');
-}
\ No newline at end of file
+}