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