mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-20 22:33:08 +02:00
Unit Tests - custom
- Added unit tests to verify correct functioning of custom report filters.
This commit is contained in:
parent
2d07b08260
commit
79d644c257
1 changed files with 9 additions and 2 deletions
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 4;
|
use Test::More tests => 6;
|
||||||
|
|
||||||
# Create the rc file.
|
# Create the rc file.
|
||||||
if (open my $fh, '>', 'custom.rc')
|
if (open my $fh, '>', 'custom.rc')
|
||||||
|
@ -36,7 +36,8 @@ if (open my $fh, '>', 'custom.rc')
|
||||||
print $fh "data.location=.\n",
|
print $fh "data.location=.\n",
|
||||||
"report.foo.description=DESC\n",
|
"report.foo.description=DESC\n",
|
||||||
"report.foo.columns=id,description\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;
|
close $fh;
|
||||||
ok (-r 'custom.rc', 'Created custom.rc');
|
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};
|
my $output = qx{../task rc:custom.rc usage};
|
||||||
like ($output, qr/task foo \[tags\] \[attrs\] desc\.\.\.\s+DESC\n/m, 'report.foo');
|
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.
|
# Cleanup.
|
||||||
unlink 'pending.data';
|
unlink 'pending.data';
|
||||||
ok (!-r 'pending.data', 'Removed pending.data');
|
ok (!-r 'pending.data', 'Removed pending.data');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue