fix broken gotos for Catalyst::Plugin::C3, added slightly modified next::method tests...
[gitmo/Class-C3-XS.git] / t / 34_next_method_in_eval.t
1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5
6 use Test::More tests => 2;
7
8 BEGIN { use_ok('Class::C3::XS') }
9
10 =pod
11
12 This tests the use of an eval{} block to wrap a next::method call.
13
14 =cut
15
16 {
17     package A;
18
19     sub foo {
20       die 'A::foo died';
21       return 'A::foo succeeded';
22     }
23 }
24
25 {
26     package B;
27     use base 'A';
28     
29     sub foo {
30       eval {
31         return 'B::foo => ' . (shift)->next::method();
32       };
33
34       if ($@) {
35         return $@;
36       }
37     }
38 }
39
40 like(B->foo, 
41    qr/^A::foo died/, 
42    'method resolved inside eval{}');
43
44