Debian Codegraph @

t/time2str-lang.t

raw
1 use strict;
2 use warnings;
3 use Test::More tests => 8;
4 use Date::Format qw(time2str);
5
6 # Unix timestamp for Tue Sep 7 11:22:42 1999 GMT (used in format.t)
7 my $t = 936709362;
8
9 # Baseline: English (default)
10 is( time2str('%A', $t, 'GMT'), 'Tuesday', 'English day (no lang arg)' );
11 is( time2str('%B', $t, 'GMT'), 'September', 'English month (no lang arg)');
12
13 # Explicit English via language argument
14 is( time2str('%A', $t, 'GMT', 'English'), 'Tuesday', 'English day (explicit)' );
15 is( time2str('%B', $t, 'GMT', 'English'), 'September', 'English month (explicit)');
16
17 # German
18 is( time2str('%A', $t, 'GMT', 'German'), 'Dienstag', 'German day' );
19 is( time2str('%B', $t, 'GMT', 'German'), 'September', 'German month');
20
21 # French
22 is( time2str('%A', $t, 'GMT', 'French'), 'mardi', 'French day' );
23 is( time2str('%B', $t, 'GMT', 'French'), 'septembre', 'French month');