summaryrefslogtreecommitdiff
path: root/t/cmop/universal_methods.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/cmop/universal_methods.t
downloadMoose-tarball-5ac2026f7eed78958d69d051e7a8e993dcf51205.tar.gz
Diffstat (limited to 't/cmop/universal_methods.t')
-rw-r--r--t/cmop/universal_methods.t38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/cmop/universal_methods.t b/t/cmop/universal_methods.t
new file mode 100644
index 0000000..0d3d646
--- /dev/null
+++ b/t/cmop/universal_methods.t
@@ -0,0 +1,38 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Class::MOP;
+
+my $meta_class = Class::MOP::Class->create_anon_class;
+
+my %methods = map { $_->name => 1 } $meta_class->get_all_methods();
+my %method_names = map { $_ => 1 } $meta_class->get_all_method_names();
+
+my @universal_methods = qw/isa can VERSION/;
+push @universal_methods, 'DOES' if $] >= 5.010;
+
+for my $method (@universal_methods) {
+ ok(
+ $meta_class->find_method_by_name($method),
+ "find_method_by_name finds UNIVERSAL method $method"
+ );
+ ok(
+ $meta_class->find_next_method_by_name($method),
+ "find_next_method_by_name finds UNIVERSAL method $method"
+ );
+ ok(
+ scalar $meta_class->find_all_methods_by_name($method),
+ "find_all_methods_by_name finds UNIVERSAL method $method"
+ );
+ ok(
+ $methods{$method},
+ "get_all_methods includes $method from UNIVERSAL"
+ );
+ ok(
+ $method_names{$method},
+ "get_all_method_names includes $method from UNIVERSAL"
+ );
+}
+
+done_testing;