File: manip.t

package info (click to toggle)
libtime-format-perl 1.16-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 300 kB
  • sloc: perl: 653; makefile: 4
file content (35 lines) | stat: -rw-r--r-- 1,080 bytes parent folder | download | duplicates (2)
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
26
27
28
29
30
31
32
33
34
35
#!/perl

use strict;
use Test::More tests => 6;
use FindBin;
use lib $FindBin::Bin;
use TimeFormat_MC;


## ----------------------------------------------------------------------------------
## Test for availability of certain modules.
my ($dm_ok, $dmtz_ok) = tf_module_check('Date::Manip');


## ----------------------------------------------------------------------------------
## Load our module.
BEGIN { $Time::Format::NOXS = 1 }
BEGIN { use_ok 'Time::Format', qw(%manip) }


## ----------------------------------------------------------------------------------
## Begin tests.

my $t = 'first thursday in june 2003';

SKIP:
{
    skip 'Date::Manip is not available',           5  unless $dm_ok;
    skip 'Date::Manip cannot determine time zone', 5  unless $dmtz_ok;
    is $manip{'%Y',$t},      '2003'      => 'year';
    is $manip{'%d',$t},      '05'        => 'day of month';
    is $manip{'%D',$t},      '06/05/03'  => '%D';
    is $manip{'%e',$t},      ' 5'        => 'spaced day';
    is $manip{'%H',$t},      '00'        => 'hour';
}