mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Fixed 2 unit tests that behaved wrong at the end/beginning of a year.
This commit is contained in:
parent
3031cf8da9
commit
be75b4bf3a
2 changed files with 10 additions and 2 deletions
|
@ -47,7 +47,7 @@ qx{../task rc:bug.rc 2 due:};
|
||||||
# Result: Somehow the due date is incremented and wraps around to 12/31/1969,
|
# Result: Somehow the due date is incremented and wraps around to 12/31/1969,
|
||||||
# then keeps going back to today.
|
# then keeps going back to today.
|
||||||
my $output = qx{../task rc:bug.rc li};
|
my $output = qx{../task rc:bug.rc li};
|
||||||
like ($output, qr/^1 task$/ms, 'Should only be one task');
|
unlike ($output, qr/1969/ms, 'Should not display 12/31/1969');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink 'pending.data';
|
unlink 'pending.data';
|
||||||
|
|
|
@ -42,7 +42,7 @@ if (open my $fh, '>', 'cal.rc')
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'cal.rc', 'Created cal.rc');
|
ok (-r 'cal.rc', 'Created cal.rc');
|
||||||
}
|
}
|
||||||
my @months = qw(Jan Fev Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
|
my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
|
||||||
my ($day, $nmon, $nyear) = (localtime)[3,4,5];
|
my ($day, $nmon, $nyear) = (localtime)[3,4,5];
|
||||||
my $nextmonth = $months[($nmon+1) % 12];
|
my $nextmonth = $months[($nmon+1) % 12];
|
||||||
my $month = $months[($nmon) % 12];
|
my $month = $months[($nmon) % 12];
|
||||||
|
@ -68,7 +68,15 @@ $output = qx{../task rc:cal.rc rc.weekstart:Monday cal};
|
||||||
like ($output, qr/Fr Sa Su/, 'Week starts on Monday');
|
like ($output, qr/Fr Sa Su/, 'Week starts on Monday');
|
||||||
$output = qx{../task rc:cal.rc cal y};
|
$output = qx{../task rc:cal.rc cal y};
|
||||||
like ($output, qr/$month\w+?\s+?$year/, 'Current month and year are displayed');
|
like ($output, qr/$month\w+?\s+?$year/, 'Current month and year are displayed');
|
||||||
|
if ( $month eq "Jan")
|
||||||
|
{
|
||||||
|
$nextyear = $nextyear - 1;
|
||||||
|
}
|
||||||
like ($output, qr/$prevmonth\w+?\s+?$nextyear/, 'Month and year one year ahead are displayed');
|
like ($output, qr/$prevmonth\w+?\s+?$nextyear/, 'Month and year one year ahead are displayed');
|
||||||
|
if ( $month eq "Jan")
|
||||||
|
{
|
||||||
|
$nextyear = $nextyear + 1;
|
||||||
|
}
|
||||||
unlike ($output, qr/$month\w+?\s+?$nextyear/, 'Current month and year ahead are not displayed');
|
unlike ($output, qr/$month\w+?\s+?$nextyear/, 'Current month and year ahead are not displayed');
|
||||||
|
|
||||||
# task cal due and task cal due y
|
# task cal due and task cal due y
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue