summaryrefslogtreecommitdiff
path: root/dist/base/t/warnings.t
blob: 51e91741ea6b1d3fc367045474a63f4bef1c2b9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/perl -w

use strict;

use Test::More tests => 1;

my $warnings;
BEGIN {
    $SIG{__WARN__} = sub { $warnings = join '', @_ };
}

{
    package Foo;
    use fields qw(thing);
}

{
    package Bar;
    use fields qw(stuff);
    use base qw(Foo);
}

::like $warnings,
       '/^Bar is inheriting from Foo but already has its own fields!/',
       'Inheriting from a base with protected fields warns';