summaryrefslogtreecommitdiff
path: root/t/moose_util/method_mod_args.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/method_mod_args.t
downloadMoose-tarball-master.tar.gz
Diffstat (limited to 't/moose_util/method_mod_args.t')
-rw-r--r--t/moose_util/method_mod_args.t31
1 files changed, 31 insertions, 0 deletions
diff --git a/t/moose_util/method_mod_args.t b/t/moose_util/method_mod_args.t
new file mode 100644
index 0000000..c4536d8
--- /dev/null
+++ b/t/moose_util/method_mod_args.t
@@ -0,0 +1,31 @@
+use strict;
+use warnings;
+
+use Test::More;
+use Test::Fatal;
+use Moose::Util qw( add_method_modifier );
+
+my $COUNT = 0;
+{
+ package Foo;
+ use Moose;
+
+ sub foo { }
+ sub bar { }
+}
+
+is( exception {
+ add_method_modifier('Foo', 'before', [ ['foo', 'bar'], sub { $COUNT++ } ]);
+}, undef, 'method modifier with an arrayref' );
+
+isnt( exception {
+ add_method_modifier('Foo', 'before', [ {'foo' => 'bar'}, sub { $COUNT++ } ]);
+}, undef, 'method modifier with a hashref' );
+
+my $foo = Foo->new;
+$foo->foo;
+$foo->bar;
+is($COUNT, 2, "checking that the modifiers were installed.");
+
+
+done_testing;