Revert most of the conversion to Test::Fatal so we can redo it
[gitmo/Moose.git] / t / 400_moose_util / 008_method_mod_args.t
CommitLineData
775666aa 1use strict;
2use warnings;
3
4use Test::More;
53a4d826 5use Test::Exception;
775666aa 6use Moose::Util qw( add_method_modifier );
7
8my $COUNT = 0;
9{
10 package Foo;
11 use Moose;
12
13 sub foo { }
14 sub bar { }
15}
16
53a4d826 17lives_ok {
775666aa 18 add_method_modifier('Foo', 'before', [ ['foo', 'bar'], sub { $COUNT++ } ]);
53a4d826 19} 'method modifier with an arrayref';
775666aa 20
53a4d826 21dies_ok {
775666aa 22 add_method_modifier('Foo', 'before', [ {'foo' => 'bar'}, sub { $COUNT++ } ]);
53a4d826 23} 'method modifier with a hashref';
775666aa 24
25my $foo = Foo->new;
26$foo->foo;
27$foo->bar;
28is($COUNT, 2, "checking that the modifiers were installed.");
29
30
31done_testing;