X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2F020_attributes%2F003_attribute_accessor_generation.t;h=a33c22ca24a4f62534ea11f2f716a5671a7f9782;hb=refs%2Fheads%2Fabandoned%2Fdeath_to_all_ellipses;hp=73487c13280c57e9c10888998bb6c0f68290cc0d;hpb=6b584f6c4dc1c2108c1bc233caec49627b2cce04;p=gitmo%2FMoose.git diff --git a/t/020_attributes/003_attribute_accessor_generation.t b/t/020_attributes/003_attribute_accessor_generation.t index 73487c1..a33c22c 100644 --- a/t/020_attributes/003_attribute_accessor_generation.t +++ b/t/020_attributes/003_attribute_accessor_generation.t @@ -19,7 +19,7 @@ use Scalar::Util 'isweak'; accessor => 'foo', ); }; - ::ok(!$@, '... created the accessor method okay'); + ::ok(!$@, 'created the accessor method okay'); eval { has 'lazy_foo' => ( @@ -28,7 +28,7 @@ use Scalar::Util 'isweak'; default => sub { 10 } ); }; - ::ok(!$@, '... created the lazy accessor method okay'); + ::ok(!$@, 'created the lazy accessor method okay'); eval { @@ -37,7 +37,7 @@ use Scalar::Util 'isweak'; required => 1, ); }; - ::ok(!$@, '... created the required accessor method okay'); + ::ok(!$@, 'created the required accessor method okay'); eval { has 'foo_int' => ( @@ -45,7 +45,7 @@ use Scalar::Util 'isweak'; isa => 'Int', ); }; - ::ok(!$@, '... created the accessor method with type constraint okay'); + ::ok(!$@, 'created the accessor method with type constraint okay'); eval { has 'foo_weak' => ( @@ -53,7 +53,7 @@ use Scalar::Util 'isweak'; 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' => ( @@ -62,7 +62,7 @@ use Scalar::Util 'isweak'; 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' => ( @@ -71,7 +71,7 @@ use Scalar::Util 'isweak'; 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' => ( @@ -80,7 +80,7 @@ use Scalar::Util 'isweak'; auto_deref => 1, ); }; - ::ok(!$@, '... created the reader method with auto_deref okay'); + ::ok(!$@, 'created the reader method with auto_deref okay'); } { @@ -90,72 +90,72 @@ use Scalar::Util 'isweak'; # 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(); @@ -164,7 +164,7 @@ use Scalar::Util 'isweak'; 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" ); @@ -196,7 +196,7 @@ use Scalar::Util 'isweak'; 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" );