From 79d644c257139343811924ae3b707a0c994c53a2 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 10 Mar 2009 22:30:15 -0400 Subject: [PATCH] Unit Tests - custom - Added unit tests to verify correct functioning of custom report filters. --- src/tests/custom.t | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/tests/custom.t b/src/tests/custom.t index 193e9711e..5ca345aa0 100755 --- a/src/tests/custom.t +++ b/src/tests/custom.t @@ -28,7 +28,7 @@ use strict; use warnings; -use Test::More tests => 4; +use Test::More tests => 6; # Create the rc file. if (open my $fh, '>', 'custom.rc') @@ -36,7 +36,8 @@ if (open my $fh, '>', 'custom.rc') print $fh "data.location=.\n", "report.foo.description=DESC\n", "report.foo.columns=id,description\n", - "report.foo.sort=id+\n"; + "report.foo.sort=id+\n", + "report.foo.filter=project:A\n"; close $fh; ok (-r 'custom.rc', 'Created custom.rc'); } @@ -45,6 +46,12 @@ if (open my $fh, '>', 'custom.rc') my $output = qx{../task rc:custom.rc usage}; like ($output, qr/task foo \[tags\] \[attrs\] desc\.\.\.\s+DESC\n/m, 'report.foo'); +qx{../task rc:custom.rc add project:A one}; +qx{../task rc:custom.rc add two}; +$output = qx{../task rc:custom.rc foo}; +like ($output, qr/one/, 'custom filter included'); +unlike ($output, qr/two/, 'custom filter excluded'); + # Cleanup. unlink 'pending.data'; ok (!-r 'pending.data', 'Removed pending.data');