1use strict;
2use warnings;
3
4use Test::More;
5
6eval "use Test::Output";
7if ($@) {
8    plan skip_all => 'These tests require Test::Output.';
9}
10
11plan tests => 2;
12
13use DateTime::Locale;
14
15my $loc = DateTime::Locale->load('en');
16
17my @months;
18my $sub = sub {
19    for my $m ( 1 .. 12 ) {
20        my $dt = bless { m => $m }, 'FakeDateTime';
21        push @months, $loc->month_abbreviation($dt);
22    }
23};
24
25stderr_like(
26    $sub,
27    qr/month_abbreviation method in DateTime::Locale::Base has been deprecated/,
28    'got a deprecation warning for month_abbreviation'
29);
30is_deeply(
31    \@months, [qw( Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec )],
32    'month_abbreviation returns the right data'
33);
34
35{
36
37    package FakeDateTime;
38
39    sub month_0 { $_[0]->{m} - 1 }
40}
41