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