mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Code Cleanup
- Factorize code for parsing date elements. - Better order of blocks for parsing date elements. - Add corresponding minimal-digit date parsing method for reading seconds, minutes and week. - Update documentation and test.
This commit is contained in:
parent
384be4b249
commit
ec330921de
8 changed files with 116 additions and 218 deletions
|
@ -207,17 +207,17 @@ int main (int argc, char** argv)
|
|||
t.is (fromString7.day (), 1, "ctor (std::string) -> d");
|
||||
t.is (fromString7.year (), 2008, "ctor (std::string) -> y");
|
||||
|
||||
Date fromString8 ("Tue 01 Jan 2008 (01)", "a D b Y (V)");
|
||||
t.is (fromString8.month (), 1, "ctor (std::string) -> m");
|
||||
t.is (fromString8.day (), 1, "ctor (std::string) -> d");
|
||||
Date fromString8 ("Tue 05 Feb 2008 (06)", "a D b Y (V)");
|
||||
t.is (fromString8.month (), 2, "ctor (std::string) -> m");
|
||||
t.is (fromString8.day (), 5, "ctor (std::string) -> d");
|
||||
t.is (fromString8.year (), 2008, "ctor (std::string) -> y");
|
||||
|
||||
Date fromString9 ("Tuesday, January 1, 2008", "A, B d, Y");
|
||||
t.is (fromString9.month (), 1, "ctor (std::string) -> m");
|
||||
t.is (fromString9.day (), 1, "ctor (std::string) -> d");
|
||||
Date fromString9 ("Tuesday, February 5, 2008", "A, B d, Y");
|
||||
t.is (fromString9.month (), 2, "ctor (std::string) -> m");
|
||||
t.is (fromString9.day (), 5, "ctor (std::string) -> d");
|
||||
t.is (fromString9.year (), 2008, "ctor (std::string) -> y");
|
||||
|
||||
Date fromString10 ("v01 Tue 2008-01-01", "vV a Y-M-D");
|
||||
Date fromString10 ("w01 Tue 2008-01-01", "wV a Y-M-D");
|
||||
t.is (fromString10.month (), 1, "ctor (std::string) -> m");
|
||||
t.is (fromString10.day (), 1, "ctor (std::string) -> d");
|
||||
t.is (fromString10.year (), 2008, "ctor (std::string) -> y");
|
||||
|
|
|
@ -57,8 +57,8 @@ if (open my $fh, '>', 'date3.rc')
|
|||
"dateformat=m/d/y\n",
|
||||
"dateformat=m/d/y\n",
|
||||
"weekstart=Monday\n",
|
||||
"dateformat.info=A D B Y (vV)\n",
|
||||
"dateformat.report=A D B Y (vV)\n";
|
||||
"dateformat.info=A D B Y (wV)\n",
|
||||
"dateformat.report=A D B Y (wV)\n";
|
||||
close $fh;
|
||||
ok (-r 'date3.rc', 'Created date3.rc');
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ ok (!-r 'pending.data', 'Removed pending.data');
|
|||
|
||||
qx{../src/task rc:date3.rc add foo due:4/8/10 2>&1};
|
||||
$output = qx{../src/task rc:date3.rc list 2>&1};
|
||||
like ($output, qr/Thursday 08 April 2010 \(v14\)/, 'date format A D B Y (vV) parsed');
|
||||
like ($output, qr/Thursday 08 April 2010 \(w14\)/, 'date format A D B Y (wV) parsed');
|
||||
$output = qx{../src/task rc:date3.rc rc.dateformat.report:"D b Y - a" list 2>&1};
|
||||
like ($output, qr/08 Apr 2010 - Thu/, 'date format D b Y - a parsed');
|
||||
|
||||
|
|
|
@ -545,8 +545,8 @@ int main (int argc, char** argv)
|
|||
t.is (dt.day (), 1, "ctor (std::string) -> d");
|
||||
t.is (dt.year (), 2008, "ctor (std::string) -> y");
|
||||
|
||||
n = Nibbler ("v01 Tue 2008-01-01");
|
||||
t.ok (n.getDate ("vV a Y-M-D", ti), "vV a Y-M-D ok");
|
||||
n = Nibbler ("w01 Tue 2008-01-01");
|
||||
t.ok (n.getDate ("wV a Y-M-D", ti), "wV a Y-M-D ok");
|
||||
dt = Date (ti);
|
||||
t.is (dt.month (), 1, "ctor (std::string) -> m");
|
||||
t.is (dt.day (), 1, "ctor (std::string) -> d");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue