X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F105_ClassEncapsulatedAttributes_test.t;h=3f294264ba92fabff33b8efe454e2fc077e9dd1c;hb=6db5c459d895adc8cea8f285f26aca1ea3c3cd14;hp=199b4c25c0176a11da7db589f2434c63d82abca3;hpb=d6fbcd05c5a7e4bb8a947a603878f3a08b2f5bee;p=gitmo%2FClass-MOP.git diff --git a/t/105_ClassEncapsulatedAttributes_test.t b/t/105_ClassEncapsulatedAttributes_test.t index 199b4c2..3f29426 100644 --- a/t/105_ClassEncapsulatedAttributes_test.t +++ b/t/105_ClassEncapsulatedAttributes_test.t @@ -1,60 +1,49 @@ -#!/usr/bin/perl - use strict; use warnings; -use Test::More tests => 29; +use Test::More tests => 28; use File::Spec; -BEGIN { - use_ok('Class::MOP'); - require_ok(File::Spec->catdir('examples', 'ClassEncapsulatedAttributes.pod')); +BEGIN {use Class::MOP; + require_ok(File::Spec->catfile('examples', 'ClassEncapsulatedAttributes.pod')); } { package Foo; - sub meta { ClassEncapsulatedAttributes->initialize($_[0]) } + use metaclass 'ClassEncapsulatedAttributes'; - Foo->meta->add_attribute( - ClassEncapsulatedAttributes::Attribute->new('foo' => ( - accessor => 'foo', - predicate => 'has_foo', - default => 'init in FOO' - )) - ); + Foo->meta->add_attribute('foo' => ( + accessor => 'foo', + predicate => 'has_foo', + default => 'init in FOO' + )); - Foo->meta->add_attribute( - ClassEncapsulatedAttributes::Attribute->new('bar' => ( - reader => 'get_bar', - writer => 'set_bar', - default => 'init in FOO' - )) - ); + Foo->meta->add_attribute('bar' => ( + reader => 'get_bar', + writer => 'set_bar', + default => 'init in FOO' + )); sub new { my $class = shift; - bless $class->meta->construct_instance(@_) => $class; + $class->meta->new_object(@_); } package Bar; our @ISA = ('Foo'); - Bar->meta->add_attribute( - ClassEncapsulatedAttributes::Attribute->new('foo' => ( - accessor => 'foo', - predicate => 'has_foo', - default => 'init in BAR' - )) - ); + Bar->meta->add_attribute('foo' => ( + accessor => 'foo', + predicate => 'has_foo', + default => 'init in BAR' + )); - Bar->meta->add_attribute( - ClassEncapsulatedAttributes::Attribute->new('bar' => ( - reader => 'get_bar', - writer => 'set_bar', - default => 'init in BAR' - )) - ); + Bar->meta->add_attribute('bar' => ( + reader => 'get_bar', + writer => 'set_bar', + default => 'init in BAR' + )); sub SUPER_foo { (shift)->SUPER::foo(@_) } sub SUPER_has_foo { (shift)->SUPER::foo(@_) }