Commit | Line | Data |
9e998a43 |
1 | #!/usr/bin/perl -w |
2 | |
39063025 |
3 | BEGIN { |
4 | if( $ENV{PERL_CORE} ) { |
5 | chdir 't' if -d 't'; |
6 | @INC = qw(../lib); |
7 | } |
8 | } |
9 | |
9e998a43 |
10 | use strict; |
11 | |
12 | use Test::More tests => 1; |
13 | |
14 | my $warnings; |
15 | BEGIN { |
16 | $SIG{__WARN__} = sub { $warnings = join '', @_ }; |
17 | } |
18 | |
19 | { |
20 | package Foo; |
21 | use fields qw(thing); |
22 | } |
23 | |
24 | { |
25 | package Bar; |
26 | use fields qw(stuff); |
27 | use base qw(Foo); |
28 | } |
29 | |
30 | ::like $warnings, |
31 | '/^Bar is inheriting from Foo but already has its own fields!/', |
32 | 'Inheriting from a base with protected fields warns'; |