[libmoo-perl] 24/43: move attribute overwrite check to more appropriate location
gregor herrmann
gregoa at debian.org
Mon Dec 26 17:56:15 UTC 2016
This is an automated email from the git hooks/post-receive script.
gregoa pushed a commit to branch master
in repository libmoo-perl.
commit 74e4f78326b4c0e85c19967af87c85530fe6edcd
Author: Graham Knop <haarg at haarg.org>
Date: Sat Dec 3 14:57:07 2016 -0500
move attribute overwrite check to more appropriate location
---
t/accessor-mixed.t | 16 ++++++++++++++++
t/accessor-reader-writer.t | 16 ----------------
2 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/t/accessor-mixed.t b/t/accessor-mixed.t
index f76758b..efc4d9a 100644
--- a/t/accessor-mixed.t
+++ b/t/accessor-mixed.t
@@ -47,4 +47,20 @@ is_deeply(
'Stuff fired in expected order'
);
+{
+ package Guff;
+ use Moo;
+
+ sub foo { 1 }
+
+ for my $type (qw(accessor reader writer predicate clearer asserter)) {
+ my $an = $type =~ /^a/ ? 'an' : 'a';
+ ::like ::exception {
+ has "attr_w_$type" => ( is => 'ro', $type => 'foo' );
+ },
+ qr/^You cannot overwrite a locally defined method \(foo\) with $an $type/,
+ "overwriting a sub with $an $type fails";
+ }
+}
+
done_testing;
diff --git a/t/accessor-reader-writer.t b/t/accessor-reader-writer.t
index 3fc3023..9ddc698 100644
--- a/t/accessor-reader-writer.t
+++ b/t/accessor-reader-writer.t
@@ -75,22 +75,6 @@ is( $bar->TWO, '!!!', 'accessor works for writing' );
}, undef, 'declaring non-identifier attribute with proper reader works');
}
-{
- package Guff;
- use Moo;
-
- sub foo { 1 }
-
- for my $type (qw(accessor reader writer predicate clearer asserter)) {
- my $an = $type =~ /^a/ ? 'an' : 'a';
- ::like ::exception {
- has "attr_w_$type" => ( is => 'ro', $type => 'foo' );
- },
- qr/^You cannot overwrite a locally defined method \(foo\) with $an $type/,
- "overwriting a sub with $an $type fails";
- }
-}
-
is( Baz->new->three, 3, '... and reader works');
done_testing;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libmoo-perl.git
More information about the Pkg-perl-cvs-commits
mailing list