File: test.pl

package info (click to toggle)
libtime-fake-perl 0.11-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 72 kB
  • sloc: perl: 75; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 621 bytes parent folder | download | duplicates (5)
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
use Time::Fake;
use Test::More tests => 7;
use strict;

my $mon = (localtime)[4];
is(  Time::Fake->offset("+2M"),
    0,
    "original offset zero" );

ok( $mon != (localtime)[4],
    "changes localtime" );

is( 3600*24*60,
    Time::Fake->reset,
    "reflects new offset" );

is( (localtime)[4],
    $mon,
    "localtime reset" );

my $epoch = 1199547498;
Time::Fake->offset($epoch);
is( time,
    $epoch,
    "epoch as argument" );

is( scalar localtime(time),
    scalar localtime(),
    "localtime with arg gives same thing" );

is( scalar gmtime(time),
    scalar gmtime(),
    "gmtime with arg gives same thing" );