Bug Fix - durations

- Fixed bug where durations (recur:x) were not properly parsed and
  validated.
- Fixed bug where the list output was being improperly parsed.
This commit is contained in:
Paul Beckingham 2009-06-19 00:52:48 -04:00
parent 8dab95e200
commit dcb4ae5497
3 changed files with 32 additions and 30 deletions

View file

@ -25,6 +25,7 @@
//
////////////////////////////////////////////////////////////////////////////////
#include <iostream> // TODO Remove
#include <sstream>
#include <stdlib.h>
#include "text.h"
@ -337,8 +338,9 @@ bool Att::validNameValue (
else if (name == "recur")
{
// Just validate, don't convert to days.
Duration d;
if (value != "")
Duration (value);
d.parse (value);
}
else if (name == "limit")

View file

@ -57,16 +57,16 @@ if (open my $fh, '>', 'annual.rc')
qx{../task rc:annual.rc add foo due:1/1/2000 recur:annual until:1/1/2009};
my $output = qx{../task rc:annual.rc list};
like ($output, qr/2\s+1\/1\/2000\s+- foo/, 'synthetic 1 no creep');
like ($output, qr/3\s+1\/1\/2001\s+- foo/, 'synthetic 2 no creep');
like ($output, qr/4\s+1\/1\/2002\s+- foo/, 'synthetic 3 no creep');
like ($output, qr/5\s+1\/1\/2003\s+- foo/, 'synthetic 4 no creep');
like ($output, qr/6\s+1\/1\/2004\s+- foo/, 'synthetic 5 no creep');
like ($output, qr/7\s+1\/1\/2005\s+- foo/, 'synthetic 6 no creep');
like ($output, qr/8\s+1\/1\/2006\s+- foo/, 'synthetic 7 no creep');
like ($output, qr/9\s+1\/1\/2007\s+- foo/, 'synthetic 8 no creep');
like ($output, qr/10\s+1\/1\/2008\s+- foo/, 'synthetic 9 no creep');
like ($output, qr/11\s+1\/1\/2009\s+- foo/, 'synthetic 10 no creep');
like ($output, qr/2\s+1\/1\/2000\s+-\s+foo/, 'synthetic 1 no creep');
like ($output, qr/3\s+1\/1\/2001\s+-\s+foo/, 'synthetic 2 no creep');
like ($output, qr/4\s+1\/1\/2002\s+-\s+foo/, 'synthetic 3 no creep');
like ($output, qr/5\s+1\/1\/2003\s+-\s+foo/, 'synthetic 4 no creep');
like ($output, qr/6\s+1\/1\/2004\s+-\s+foo/, 'synthetic 5 no creep');
like ($output, qr/7\s+1\/1\/2005\s+-\s+foo/, 'synthetic 6 no creep');
like ($output, qr/8\s+1\/1\/2006\s+-\s+foo/, 'synthetic 7 no creep');
like ($output, qr/9\s+1\/1\/2007\s+-\s+foo/, 'synthetic 8 no creep');
like ($output, qr/10\s+1\/1\/2008\s+-\s+foo/, 'synthetic 9 no creep');
like ($output, qr/11\s+1\/1\/2009\s+-\s+foo/, 'synthetic 10 no creep');
# Cleanup.
unlink 'pending.data';

View file

@ -75,61 +75,61 @@ Confirmed:
=cut
my $output = qx{../task rc:period.rc add daily due:tomorrow recur:daily};
like ($output, qr/^$/, 'recur:daily');
unlike ($output, qr/was not recignized/, 'recur:daily');
$output = qx{../task rc:period.rc add day due:tomorrow recur:day};
like ($output, qr/^$/, 'recur:day');
unlike ($output, qr/was not recignized/, 'recur:day');
$output = qx{../task rc:period.rc add weekly due:tomorrow recur:weekly};
like ($output, qr/^$/, 'recur:weekly');
unlike ($output, qr/was not recignized/, 'recur:weekly');
$output = qx{../task rc:period.rc add sennight due:tomorrow recur:sennight};
like ($output, qr/^$/, 'recur:sennight');
unlike ($output, qr/was not recignized/, 'recur:sennight');
$output = qx{../task rc:period.rc add biweekly due:tomorrow recur:biweekly};
like ($output, qr/^$/, 'recur:biweekly');
unlike ($output, qr/was not recignized/, 'recur:biweekly');
$output = qx{../task rc:period.rc add fortnight due:tomorrow recur:fortnight};
like ($output, qr/^$/, 'recur:fortnight');
unlike ($output, qr/was not recignized/, 'recur:fortnight');
$output = qx{../task rc:period.rc add monthly due:tomorrow recur:monthly};
like ($output, qr/^$/, 'recur:monthly');
unlike ($output, qr/was not recignized/, 'recur:monthly');
$output = qx{../task rc:period.rc add quarterly due:tomorrow recur:quarterly};
like ($output, qr/^$/, 'recur:quarterly');
unlike ($output, qr/was not recignized/, 'recur:quarterly');
$output = qx{../task rc:period.rc add semiannual due:tomorrow recur:semiannual};
like ($output, qr/^$/, 'recur:semiannual');
unlike ($output, qr/was not recignized/, 'recur:semiannual');
$output = qx{../task rc:period.rc add bimonthly due:tomorrow recur:bimonthly};
like ($output, qr/^$/, 'recur:bimonthly');
unlike ($output, qr/was not recignized/, 'recur:bimonthly');
$output = qx{../task rc:period.rc add biannual due:tomorrow recur:biannual};
like ($output, qr/^$/, 'recur:biannual');
unlike ($output, qr/was not recignized/, 'recur:biannual');
$output = qx{../task rc:period.rc add biyearly due:tomorrow recur:biyearly};
like ($output, qr/^$/, 'recur:biyearly');
unlike ($output, qr/was not recignized/, 'recur:biyearly');
$output = qx{../task rc:period.rc add annual due:tomorrow recur:annual};
like ($output, qr/^$/, 'recur:annual');
unlike ($output, qr/was not recignized/, 'recur:annual');
$output = qx{../task rc:period.rc add yearly due:tomorrow recur:yearly};
like ($output, qr/^$/, 'recur:yearly');
unlike ($output, qr/was not recignized/, 'recur:yearly');
$output = qx{../task rc:period.rc add 2d due:tomorrow recur:2d};
like ($output, qr/^$/, 'recur:2m');
unlike ($output, qr/was not recignized/, 'recur:2m');
$output = qx{../task rc:period.rc add 2w due:tomorrow recur:2w};
like ($output, qr/^$/, 'recur:2q');
unlike ($output, qr/was not recignized/, 'recur:2q');
$output = qx{../task rc:period.rc add 2m due:tomorrow recur:2m};
like ($output, qr/^$/, 'recur:2d');
unlike ($output, qr/was not recignized/, 'recur:2d');
$output = qx{../task rc:period.rc add 2q due:tomorrow recur:2q};
like ($output, qr/^$/, 'recur:2w');
unlike ($output, qr/was not recignized/, 'recur:2w');
$output = qx{../task rc:period.rc add 2y due:tomorrow recur:2y};
like ($output, qr/^$/, 'recur:2y');
unlike ($output, qr/was not recignized/, 'recur:2y');
# Verify that the recurring task instances get created. One of each.
$output = qx{../task rc:period.rc list};