X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Faccessor-shortcuts.t;h=d900163649fb4c395403ef6c4c45e03df696543f;hb=2f425b5770149d4ed2e59da001c3be052cbd6bc1;hp=ef6e7fc502c36fadab9cc01b77cdefd362345274;hpb=e8dc52018eeed58688ed4d0fd233d4ac4837d7b2;p=gitmo%2FMoo.git diff --git a/t/accessor-shortcuts.t b/t/accessor-shortcuts.t index ef6e7fc..d900163 100644 --- a/t/accessor-shortcuts.t +++ b/t/accessor-shortcuts.t @@ -21,7 +21,7 @@ my $foo = Foo->new; # rwp { is $foo->rwp, undef, "rwp value starts out undefined"; - like exception { $foo->rwp($test) }, qr/Usage: Foo::rwp\(self\)/, "rwp is read_only"; + ok exception { $foo->rwp($test) }, "rwp is read_only"; is exception { $foo->_set_rwp($test) }, undef, "rwp can be set by writer"; is $foo->rwp, $test, "rwp value was set by writer"; } @@ -30,20 +30,14 @@ my $foo = Foo->new; { is $foo->{lazy}, undef, "lazy value storage is undefined"; is $foo->lazy, $test, "lazy value returns test value when called"; - like exception { $foo->lazy($test) }, qr/Usage: Foo::lazy\(self\)/, "lazy is read_only"; - - my $foo_with_args = Foo->new(lazy => $test); - is $foo_with_args->{lazy}, undef, "lazy ignores constructor value"; + ok exception { $foo->lazy($test) }, "lazy is read_only"; } # lazy + default { is $foo->{lazy_default}, undef, "lazy_default value storage is undefined"; is $foo->lazy_default, $lazy_default, "lazy_default value returns test value when called"; - like exception { $foo->lazy_default($test) }, qr/Usage: Foo::lazy\(self\)/, "lazy_default is read_only"; - - my $foo_with_args = Foo->new(lazy_default => $test); - is $foo_with_args->{lazy_default}, undef, "lazy_default ignores constructor value"; + ok exception { $foo->lazy_default($test) }, "lazy_default is read_only"; } done_testing;