summaryrefslogtreecommitdiff
path: root/t/moose_util/moose_util.t
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2015-06-06 17:50:16 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2015-06-06 17:50:16 +0000
commit5ac2026f7eed78958d69d051e7a8e993dcf51205 (patch)
tree298c3d2f08bdfe5689998b11892d72a897985be1 /t/moose_util/moose_util.t
downloadMoose-tarball-5ac2026f7eed78958d69d051e7a8e993dcf51205.tar.gz
Diffstat (limited to 't/moose_util/moose_util.t')
-rw-r--r--t/moose_util/moose_util.t43
1 files changed, 43 insertions, 0 deletions
diff --git a/t/moose_util/moose_util.t b/t/moose_util/moose_util.t
new file mode 100644
index 0000000..3203f74
--- /dev/null
+++ b/t/moose_util/moose_util.t
@@ -0,0 +1,43 @@
+use strict;
+use warnings;
+
+use Test::More;
+
+BEGIN {
+ use_ok('Moose::Util');
+}
+
+{
+ package Moosey::Class;
+ use Moose;
+}
+{
+ package Moosey::Role;
+ use Moose::Role;
+}
+{
+ package Other;
+}
+{
+ package Moosey::Composed;
+ use Moose;
+ with 'Moosey::Role';
+}
+
+use Moose::Util 'is_role';
+
+{
+ my $class = Moosey::Class->new;
+ my $composed = Moosey::Composed->new;
+
+ ok(!is_role('Moosey::Class'), 'a moose class is not a role');
+ ok(is_role('Moosey::Role'), 'a moose role is a role');
+ ok(!is_role('Other'), 'something else is not a role');
+ ok(!is_role('DoesNotExist'), 'non-existent namespace is not a role');
+ ok(!is_role('Moosey::Composed'), 'a moose class that composes a role is not a role');
+
+ ok(!is_role($class), 'instantiated moose object is not a role');
+ ok(!is_role($composed), 'instantiated moose object that does a role is not a role');
+}
+
+done_testing;