Command: count

- Now generates recurring tasks.
- Cleaned up unit tests.
This commit is contained in:
Paul Beckingham
2011-08-28 00:17:08 -04:00
parent eeb6479440
commit 0dd4e6d360
2 changed files with 10 additions and 19 deletions

View File

@@ -49,6 +49,7 @@ CmdCount::CmdCount ()
int CmdCount::execute (std::string& output) int CmdCount::execute (std::string& output)
{ {
// Apply filter. // Apply filter.
handleRecurrence ();
std::vector <Task> filtered; std::vector <Task> filtered;
filter (filtered); filter (filtered);

View File

@@ -28,7 +28,7 @@
use strict; use strict;
use warnings; use warnings;
use Test::More tests => 12; use Test::More tests => 7;
# Create the rc file. # Create the rc file.
if (open my $fh, '>', 'count.rc') if (open my $fh, '>', 'count.rc')
@@ -50,7 +50,7 @@ qx{../src/task rc:count.rc add five due:eom recur:monthly};
my $output = qx{../src/task rc:count.rc count}; my $output = qx{../src/task rc:count.rc count};
like ($output, qr/^5$/ms, 'count'); like ($output, qr/^5$/ms, 'count');
$output = qx{../src/task rc:count.rc count status:deleted}; $output = qx{../src/task rc:count.rc count status:deleted rc.debug:1};
like ($output, qr/^1$/ms, 'count status:deleted'); like ($output, qr/^1$/ms, 'count status:deleted');
$output = qx{../src/task rc:count.rc count e}; $output = qx{../src/task rc:count.rc count e};
@@ -63,23 +63,13 @@ $output = qx{../src/task rc:count.rc count due.any:};
like ($output, qr/^1$/ms, 'count due.any:'); like ($output, qr/^1$/ms, 'count due.any:');
# Cleanup. # Cleanup.
unlink 'pending.data'; unlink qw(pending.data completed.data undo.data backlog.data synch.key count.rc);
ok (!-r 'pending.data', 'Removed pending.data'); ok (! -r 'pending.data' &&
! -r 'completed.data' &&
unlink 'completed.data'; ! -r 'undo.data' &&
ok (!-r 'completed.data', 'Removed completed.data'); ! -r 'backlog.data' &&
! -r 'synch_key.data' &&
unlink 'undo.data'; ! -r 'count.rc', 'Cleanup');
ok (!-r 'undo.data', 'Removed undo.data');
unlink 'backlog.data';
ok (!-r 'backlog.data', 'Removed backlog.data');
unlink 'synch.key';
ok (!-r 'synch.key', 'Removed synch.key');
unlink 'count.rc';
ok (!-r 'count.rc', 'Removed count.rc');
exit 0; exit 0;