mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Unit Tests
- Removed obsolete tests.
This commit is contained in:
parent
a76614aabb
commit
ccc0fa7c30
1 changed files with 13 additions and 16 deletions
|
@ -27,39 +27,36 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 4;
|
use Test::More tests => 2;
|
||||||
|
|
||||||
# Ensure environment has no influence.
|
# Ensure environment has no influence.
|
||||||
delete $ENV{'TASKDATA'};
|
delete $ENV{'TASKDATA'};
|
||||||
delete $ENV{'TASKRC'};
|
delete $ENV{'TASKRC'};
|
||||||
|
|
||||||
|
use File::Basename;
|
||||||
|
my $ut = basename ($0);
|
||||||
|
my $rc = $ut . '.rc';
|
||||||
|
|
||||||
# Create the rc file.
|
# Create the rc file.
|
||||||
if (open my $fh, '>', 'completed.rc')
|
if (open my $fh, '>', $rc)
|
||||||
{
|
{
|
||||||
print $fh "data.location=.\n",
|
print $fh "data.location=.\n",
|
||||||
"confirmation=no\n";
|
"confirmation=off\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'completed.rc', 'Created completed.rc');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add two tasks, mark 1 as done, the other as deleted.
|
# Add two tasks, mark 1 as done, the other as deleted.
|
||||||
qx{../src/task rc:completed.rc add one 2>&1};
|
qx{../src/task rc:$rc add one 2>&1};
|
||||||
qx{../src/task rc:completed.rc add two 2>&1};
|
qx{../src/task rc:$rc add two 2>&1};
|
||||||
qx{../src/task rc:completed.rc 1 done 2>&1};
|
qx{../src/task rc:$rc 1 done 2>&1};
|
||||||
qx{../src/task rc:completed.rc 2 delete 2>&1};
|
qx{../src/task rc:$rc 2 delete 2>&1};
|
||||||
|
|
||||||
# Generate completed report.
|
# Generate completed report.
|
||||||
my $output = qx{../src/task rc:completed.rc completed 2>&1};
|
my $output = qx{../src/task rc:$rc completed 2>&1};
|
||||||
like ($output, qr/one/, 'one -> completed');
|
like ($output, qr/one/, 'one -> completed');
|
||||||
unlike ($output, qr/two/, 'two -> deleted');
|
unlike ($output, qr/two/, 'two -> deleted');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data completed.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data), $rc;
|
||||||
ok (! -r 'pending.data' &&
|
|
||||||
! -r 'completed.data' &&
|
|
||||||
! -r 'undo.data' &&
|
|
||||||
! -r 'backlog.data' &&
|
|
||||||
! -r 'completed.rc', 'Cleanup');
|
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue