summaryrefslogtreecommitdiff
path: root/t/lib
diff options
context:
space:
mode:
Diffstat (limited to 't/lib')
-rw-r--r--t/lib/Bar.pm9
-rw-r--r--t/lib/Bar7/Meta/Trait.pm8
-rw-r--r--t/lib/Bar7/Meta/Trait2.pm13
-rw-r--r--t/lib/Foo.pm6
-rw-r--r--t/lib/Moose/Meta/Attribute/Custom/Bar.pm10
-rw-r--r--t/lib/Moose/Meta/Attribute/Custom/Foo.pm5
-rw-r--r--t/lib/Moose/Meta/Attribute/Custom/Trait/Bar.pm10
-rw-r--r--t/lib/Moose/Meta/Attribute/Custom/Trait/Foo.pm5
-rw-r--r--t/lib/MyExporter.pm22
-rw-r--r--t/lib/MyMetaclassRole.pm4
-rw-r--r--t/lib/MyMooseA.pm7
-rw-r--r--t/lib/MyMooseB.pm5
-rw-r--r--t/lib/MyMooseObject.pm7
-rw-r--r--t/lib/NoInlineAttribute.pm29
-rw-r--r--t/lib/Overloading/ClassConsumesRoleConsumesOverloads.pm7
-rw-r--r--t/lib/Overloading/ClassWithCombiningRole.pm7
-rw-r--r--t/lib/Overloading/ClassWithOneRole.pm7
-rw-r--r--t/lib/Overloading/CombiningClass.pm7
-rw-r--r--t/lib/Overloading/CombiningRole.pm7
-rw-r--r--t/lib/Overloading/RoleConsumesOverloads.pm7
-rw-r--r--t/lib/Overloading/RoleWithOverloads.pm16
-rw-r--r--t/lib/Overloading/RoleWithoutOverloads.pm5
-rw-r--r--t/lib/OverloadingTests.pm47
-rw-r--r--t/lib/Real/Package.pm7
-rw-r--r--t/lib/Role/BreakOnLoad.pm8
-rw-r--r--t/lib/Role/Child.pm8
-rw-r--r--t/lib/Role/Interface.pm6
-rw-r--r--t/lib/Role/Parent.pm7
28 files changed, 286 insertions, 0 deletions
diff --git a/t/lib/Bar.pm b/t/lib/Bar.pm
new file mode 100644
index 0000000..b520c7a
--- /dev/null
+++ b/t/lib/Bar.pm
@@ -0,0 +1,9 @@
+package Bar;
+use Moose;
+use Moose::Util::TypeConstraints;
+
+type Baz => where { 1 };
+
+subtype Bling => as Baz => where { 1 };
+
+1; \ No newline at end of file
diff --git a/t/lib/Bar7/Meta/Trait.pm b/t/lib/Bar7/Meta/Trait.pm
new file mode 100644
index 0000000..aec769b
--- /dev/null
+++ b/t/lib/Bar7/Meta/Trait.pm
@@ -0,0 +1,8 @@
+package Bar7::Meta::Trait;
+use Moose::Role;
+
+around _immutable_options => sub { };
+
+no Moose::Role;
+
+1;
diff --git a/t/lib/Bar7/Meta/Trait2.pm b/t/lib/Bar7/Meta/Trait2.pm
new file mode 100644
index 0000000..4f1b73f
--- /dev/null
+++ b/t/lib/Bar7/Meta/Trait2.pm
@@ -0,0 +1,13 @@
+package Bar7::Meta::Trait2;
+use Moose::Role;
+
+has foo => (
+ traits => ['Array'],
+ handles => {
+ push_foo => 'push',
+ },
+);
+
+no Moose::Role;
+
+1;
diff --git a/t/lib/Foo.pm b/t/lib/Foo.pm
new file mode 100644
index 0000000..048870c
--- /dev/null
+++ b/t/lib/Foo.pm
@@ -0,0 +1,6 @@
+package Foo;
+use Moose;
+
+has 'bar' => (is => 'rw');
+
+1;
diff --git a/t/lib/Moose/Meta/Attribute/Custom/Bar.pm b/t/lib/Moose/Meta/Attribute/Custom/Bar.pm
new file mode 100644
index 0000000..64dd230
--- /dev/null
+++ b/t/lib/Moose/Meta/Attribute/Custom/Bar.pm
@@ -0,0 +1,10 @@
+package Moose::Meta::Attribute::Custom::Bar;
+
+sub register_implementation { 'My::Bar' }
+
+
+package My::Bar;
+
+use Moose::Role;
+
+1;
diff --git a/t/lib/Moose/Meta/Attribute/Custom/Foo.pm b/t/lib/Moose/Meta/Attribute/Custom/Foo.pm
new file mode 100644
index 0000000..49f7a01
--- /dev/null
+++ b/t/lib/Moose/Meta/Attribute/Custom/Foo.pm
@@ -0,0 +1,5 @@
+package Moose::Meta::Attribute::Custom::Foo;
+
+use Moose::Role;
+
+1;
diff --git a/t/lib/Moose/Meta/Attribute/Custom/Trait/Bar.pm b/t/lib/Moose/Meta/Attribute/Custom/Trait/Bar.pm
new file mode 100644
index 0000000..17412c1
--- /dev/null
+++ b/t/lib/Moose/Meta/Attribute/Custom/Trait/Bar.pm
@@ -0,0 +1,10 @@
+package Moose::Meta::Attribute::Custom::Trait::Bar;
+
+sub register_implementation { 'My::Trait::Bar' }
+
+
+package My::Trait::Bar;
+
+use Moose::Role;
+
+1;
diff --git a/t/lib/Moose/Meta/Attribute/Custom/Trait/Foo.pm b/t/lib/Moose/Meta/Attribute/Custom/Trait/Foo.pm
new file mode 100644
index 0000000..682b61f
--- /dev/null
+++ b/t/lib/Moose/Meta/Attribute/Custom/Trait/Foo.pm
@@ -0,0 +1,5 @@
+package Moose::Meta::Attribute::Custom::Trait::Foo;
+
+use Moose::Role;
+
+1;
diff --git a/t/lib/MyExporter.pm b/t/lib/MyExporter.pm
new file mode 100644
index 0000000..bda6f20
--- /dev/null
+++ b/t/lib/MyExporter.pm
@@ -0,0 +1,22 @@
+package MyExporter;
+use Moose::Exporter;
+use Test::More;
+
+Moose::Exporter->setup_import_methods(
+ with_meta => [qw(with_prototype)],
+ as_is => [qw(as_is_prototype)],
+);
+
+sub with_prototype (&) {
+ my ($class, $code) = @_;
+ isa_ok($code, 'CODE', 'with_prototype received a coderef');
+ $code->();
+}
+
+sub as_is_prototype (&) {
+ my ($code) = @_;
+ isa_ok($code, 'CODE', 'as_is_prototype received a coderef');
+ $code->();
+}
+
+1;
diff --git a/t/lib/MyMetaclassRole.pm b/t/lib/MyMetaclassRole.pm
new file mode 100644
index 0000000..362265a
--- /dev/null
+++ b/t/lib/MyMetaclassRole.pm
@@ -0,0 +1,4 @@
+package MyMetaclassRole;
+use Moose::Role;
+
+1;
diff --git a/t/lib/MyMooseA.pm b/t/lib/MyMooseA.pm
new file mode 100644
index 0000000..9e520b9
--- /dev/null
+++ b/t/lib/MyMooseA.pm
@@ -0,0 +1,7 @@
+package MyMooseA;
+
+use Moose;
+
+has 'b' => (is => 'rw', isa => 'MyMooseB');
+
+1; \ No newline at end of file
diff --git a/t/lib/MyMooseB.pm b/t/lib/MyMooseB.pm
new file mode 100644
index 0000000..c772947
--- /dev/null
+++ b/t/lib/MyMooseB.pm
@@ -0,0 +1,5 @@
+package MyMooseB;
+
+use Moose;
+
+1; \ No newline at end of file
diff --git a/t/lib/MyMooseObject.pm b/t/lib/MyMooseObject.pm
new file mode 100644
index 0000000..5f1a6f7
--- /dev/null
+++ b/t/lib/MyMooseObject.pm
@@ -0,0 +1,7 @@
+package MyMooseObject;
+
+use strict;
+use warnings;
+use parent 'Moose::Object';
+
+1;
diff --git a/t/lib/NoInlineAttribute.pm b/t/lib/NoInlineAttribute.pm
new file mode 100644
index 0000000..af182dc
--- /dev/null
+++ b/t/lib/NoInlineAttribute.pm
@@ -0,0 +1,29 @@
+package NoInlineAttribute;
+
+use Moose::Meta::Class;
+use Moose::Role;
+
+around accessor_metaclass => sub {
+ my $orig = shift;
+ my $self = shift;
+
+ my $class = $self->$orig();
+
+ return Moose::Meta::Class->create_anon_class(
+ superclasses => [$class],
+ roles => ['NoInlineAccessor'],
+ cache => 1,
+ )->name;
+};
+
+no Moose::Role;
+
+{
+ package NoInlineAccessor;
+
+ use Moose::Role;
+
+ sub is_inline { 0 }
+}
+
+1;
diff --git a/t/lib/Overloading/ClassConsumesRoleConsumesOverloads.pm b/t/lib/Overloading/ClassConsumesRoleConsumesOverloads.pm
new file mode 100644
index 0000000..2cfe5e1
--- /dev/null
+++ b/t/lib/Overloading/ClassConsumesRoleConsumesOverloads.pm
@@ -0,0 +1,7 @@
+package Overloading::ClassConsumesRoleConsumesOverloads;
+
+use Moose;
+
+with 'Overloading::RoleConsumesOverloads';
+
+1;
diff --git a/t/lib/Overloading/ClassWithCombiningRole.pm b/t/lib/Overloading/ClassWithCombiningRole.pm
new file mode 100644
index 0000000..5e953f5
--- /dev/null
+++ b/t/lib/Overloading/ClassWithCombiningRole.pm
@@ -0,0 +1,7 @@
+package Overloading::ClassWithCombiningRole;
+
+use Moose;
+
+with 'Overloading::CombiningRole';
+
+1;
diff --git a/t/lib/Overloading/ClassWithOneRole.pm b/t/lib/Overloading/ClassWithOneRole.pm
new file mode 100644
index 0000000..89d135a
--- /dev/null
+++ b/t/lib/Overloading/ClassWithOneRole.pm
@@ -0,0 +1,7 @@
+package Overloading::ClassWithOneRole;
+
+use Moose;
+
+with 'Overloading::RoleWithOverloads';
+
+1;
diff --git a/t/lib/Overloading/CombiningClass.pm b/t/lib/Overloading/CombiningClass.pm
new file mode 100644
index 0000000..524ef46
--- /dev/null
+++ b/t/lib/Overloading/CombiningClass.pm
@@ -0,0 +1,7 @@
+package Overloading::CombiningClass;
+
+use Moose;
+
+with 'Overloading::RoleWithOverloads', 'Overloading::RoleWithoutOverloads';
+
+1;
diff --git a/t/lib/Overloading/CombiningRole.pm b/t/lib/Overloading/CombiningRole.pm
new file mode 100644
index 0000000..db523cb
--- /dev/null
+++ b/t/lib/Overloading/CombiningRole.pm
@@ -0,0 +1,7 @@
+package Overloading::CombiningRole;
+
+use Moose::Role;
+
+with 'Overloading::RoleWithOverloads', 'Overloading::RoleWithoutOverloads';
+
+1;
diff --git a/t/lib/Overloading/RoleConsumesOverloads.pm b/t/lib/Overloading/RoleConsumesOverloads.pm
new file mode 100644
index 0000000..0e0e476
--- /dev/null
+++ b/t/lib/Overloading/RoleConsumesOverloads.pm
@@ -0,0 +1,7 @@
+package Overloading::RoleConsumesOverloads;
+
+use Moose::Role;
+
+with 'Overloading::RoleWithOverloads';
+
+1;
diff --git a/t/lib/Overloading/RoleWithOverloads.pm b/t/lib/Overloading/RoleWithOverloads.pm
new file mode 100644
index 0000000..31471cf
--- /dev/null
+++ b/t/lib/Overloading/RoleWithOverloads.pm
@@ -0,0 +1,16 @@
+package Overloading::RoleWithOverloads;
+
+use Moose::Role;
+
+use overload
+ q{""} => 'as_string',
+ fallback => 1;
+
+has message => (
+ is => 'rw',
+ isa => 'Str',
+);
+
+sub as_string { shift->message }
+
+1;
diff --git a/t/lib/Overloading/RoleWithoutOverloads.pm b/t/lib/Overloading/RoleWithoutOverloads.pm
new file mode 100644
index 0000000..97d3e80
--- /dev/null
+++ b/t/lib/Overloading/RoleWithoutOverloads.pm
@@ -0,0 +1,5 @@
+package Overloading::RoleWithoutOverloads;
+
+use Moose::Role;
+
+1;
diff --git a/t/lib/OverloadingTests.pm b/t/lib/OverloadingTests.pm
new file mode 100644
index 0000000..d1ab195
--- /dev/null
+++ b/t/lib/OverloadingTests.pm
@@ -0,0 +1,47 @@
+package OverloadingTests;
+
+use strict;
+use warnings;
+
+use Test::More 0.88;
+
+sub test_overloading_for_package {
+ my $package = shift;
+
+ ok(
+ overload::Overloaded($package),
+ "$package is overloaded"
+ );
+ ok(
+ overload::Method( $package, q{""} ),
+ "$package overloads stringification"
+ );
+}
+
+sub test_no_overloading_for_package {
+ my $package = shift;
+
+ ok(
+ !overload::Overloaded($package),
+ "$package is not overloaded"
+ );
+ ok(
+ !overload::Method( $package, q{""} ),
+ "$package does not overload stringification"
+ );
+}
+
+sub test_overloading_for_object {
+ my $class = shift;
+ my $thing = shift || "$class object";
+
+ my $object = ref $class ? $class : $class->new( { message => 'foo' } );
+
+ is(
+ "$object",
+ 'foo',
+ "$thing stringifies to value of message attribute"
+ );
+}
+
+1;
diff --git a/t/lib/Real/Package.pm b/t/lib/Real/Package.pm
new file mode 100644
index 0000000..98b3d47
--- /dev/null
+++ b/t/lib/Real/Package.pm
@@ -0,0 +1,7 @@
+package Real::Package;
+use strict;
+use warnings;
+
+sub foo { }
+
+1;
diff --git a/t/lib/Role/BreakOnLoad.pm b/t/lib/Role/BreakOnLoad.pm
new file mode 100644
index 0000000..48367a7
--- /dev/null
+++ b/t/lib/Role/BreakOnLoad.pm
@@ -0,0 +1,8 @@
+package Role::BreakOnLoad;
+use Moose::Role;
+
+sub meth1 { }
+
+this role has a syntax error and should crash on load.
+
+1;
diff --git a/t/lib/Role/Child.pm b/t/lib/Role/Child.pm
new file mode 100644
index 0000000..4c70436
--- /dev/null
+++ b/t/lib/Role/Child.pm
@@ -0,0 +1,8 @@
+package Role::Child;
+use Moose::Role;
+
+with 'Role::Parent' => { -alias => { meth1 => 'aliased_meth1', } };
+
+sub meth1 { }
+
+1;
diff --git a/t/lib/Role/Interface.pm b/t/lib/Role/Interface.pm
new file mode 100644
index 0000000..025cf40
--- /dev/null
+++ b/t/lib/Role/Interface.pm
@@ -0,0 +1,6 @@
+package Role::Interface;
+use Moose::Role;
+
+requires "meth2";
+
+1;
diff --git a/t/lib/Role/Parent.pm b/t/lib/Role/Parent.pm
new file mode 100644
index 0000000..0f49427
--- /dev/null
+++ b/t/lib/Role/Parent.pm
@@ -0,0 +1,7 @@
+package Role::Parent;
+use Moose::Role;
+
+sub meth2 { }
+sub meth1 { }
+
+1;