- LocalLib.git
- t
- utils.t
This file ( 903B ) exceeds the allowed full mode (48 kb) size.
The editor full hight is disabled, only scrolling is allowed..
If you wish to edit a file, it is recommended to use the scroll mode as some users do not like the full height
mode, although some users like it.
use Test::More; # see done_testing()
use Test::Deep; # eq_deeply()
use Data::Printer;
use Data::Dumper;
use Path::Tiny;
use DateTime;
use 5.26.0;
use FindBin qw($Bin); # warn $Bin;
use lib '/home/raj/perl-lib';
require_ok( 'Local::Utils' );
my $dt1 = DateTime->now;
my $dt2 = DateTime->now->subtract(days => 1);
{ # stringify DT object:
my $to_string = Local::Utils::datetime_to_string($dt1);
is( $to_string, $dt1->datetime );
}
{ # stringify hashref of DT objects:
my %h = (
foo => $dt1,
bar => $dt2,
);
my $ref = Local::Utils::datetime_to_string(\%h); # p $ref;
is_deeply( $ref, { foo => $dt1->datetime, bar => $dt2->datetime });
}
{ # stringify HoH of DT objects:
my %h = (
foo => {
bar => $dt1,
baz => $dt2,
},
);
my $ref = Local::Utils::datetime_to_string(\%h); # p $ref;
is_deeply( $ref, { foo => { bar => $dt1->datetime, baz => $dt2->datetime } });
}
done_testing(4);