Unit Tests - dateformat, shadow
- Improved dateformat.t tests to cover all acceptable date format characters. - Unit tests for shadow file update notification. - Unit tests for shadow file updates under certain circumstances. - Unit tests for shadow file no updates under other circumstances.
This commit is contained in:
@@ -28,27 +28,45 @@
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
use Test::More tests => 8;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'date.rc')
|
||||
if (open my $fh, '>', 'date1.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"dateformat=YMD\n";
|
||||
close $fh;
|
||||
ok (-r 'date.rc', 'Created date.rc');
|
||||
ok (-r 'date1.rc', 'Created date1.rc');
|
||||
}
|
||||
|
||||
qx{../task rc:date.rc add foo due:20091231};
|
||||
my $output = qx{../task rc:date.rc info 1};
|
||||
if (open my $fh, '>', 'date2.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"dateformat=m/d/y\n";
|
||||
close $fh;
|
||||
ok (-r 'date2.rc', 'Created date2.rc');
|
||||
}
|
||||
|
||||
qx{../task rc:date1.rc add foo due:20091231};
|
||||
my $output = qx{../task rc:date1.rc info 1};
|
||||
like ($output, qr/\b20091231\b/, 'date format YMD parsed');
|
||||
|
||||
unlink 'pending.data';
|
||||
ok (!-r 'pending.data', 'Removed pending.data');
|
||||
|
||||
qx{../task rc:date2.rc add foo due:12/1/09};
|
||||
$output = qx{../task rc:date2.rc info 1};
|
||||
like ($output, qr/\b12\/1\/09\b/, 'date format m/d/y parsed');
|
||||
|
||||
# Cleanup.
|
||||
unlink 'pending.data';
|
||||
ok (!-r 'pending.data', 'Removed pending.data');
|
||||
|
||||
unlink 'date.rc';
|
||||
ok (!-r 'date.rc', 'Removed date.rc');
|
||||
unlink 'date1.rc';
|
||||
ok (!-r 'date1.rc', 'Removed date1.rc');
|
||||
|
||||
unlink 'date2.rc';
|
||||
ok (!-r 'date2.rc', 'Removed date2.rc');
|
||||
|
||||
exit 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user