mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Unit Tests
- Removed useless setup/teardown tests, improving the signal to noise ratio.
This commit is contained in:
parent
1c5a9f70cb
commit
e3e21b72a9
15 changed files with 17 additions and 125 deletions
|
@ -27,7 +27,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
use Test::More tests => 3;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
|
@ -38,7 +38,6 @@ if (open my $fh, '>', 'bug.rc')
|
|||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Attempt a blank annotation.
|
||||
|
@ -55,11 +54,5 @@ unlike ($output, qr/Command prevented from running/, 'Filter-less write command
|
|||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data bug.rc);
|
||||
ok (! -r 'pending.data' &&
|
||||
! -r 'completed.data' &&
|
||||
! -r 'undo.data' &&
|
||||
! -r 'backlog.data' &&
|
||||
! -r 'bug.rc', 'Cleanup');
|
||||
|
||||
exit 0;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 13;
|
||||
use Test::More tests => 11;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
|
@ -43,7 +43,6 @@ if (open my $fh, '>', 'annual.rc')
|
|||
"report.annual.filter=status:pending\n",
|
||||
"report.annual.sort=due+\n";
|
||||
close $fh;
|
||||
ok (-r 'annual.rc', 'Created annual.rc');
|
||||
}
|
||||
|
||||
# If a task is added with a due date ten years ago, with an annual recurrence,
|
||||
|
@ -81,11 +80,5 @@ like ($output, qr/No duplicates found/, 'No duplicate UUIDs detected');
|
|||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data annual.rc);
|
||||
ok (! -r 'pending.data' &&
|
||||
! -r 'completed.data' &&
|
||||
! -r 'undo.data' &&
|
||||
! -r 'backlog.data' &&
|
||||
! -r 'annual.rc', 'Cleanup');
|
||||
|
||||
exit 0;
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
use strict;
|
||||
use warnings;
|
||||
use Time::Local;
|
||||
use Test::More tests => 17;
|
||||
use Test::More tests => 14;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
|
@ -42,7 +42,6 @@ if (open my $fh, '>', 'before.rc')
|
|||
"dateformat=m/d/Y\n",
|
||||
"dateformat.info=m/d/Y\n";
|
||||
close $fh;
|
||||
ok (-r 'before.rc', 'Created before.rc');
|
||||
}
|
||||
|
||||
# Create some example data directly.
|
||||
|
@ -56,7 +55,6 @@ if (open my $fh, '>', 'pending.data')
|
|||
EOF
|
||||
|
||||
close $fh;
|
||||
ok (-r 'pending.data', 'Created pending.data');
|
||||
}
|
||||
|
||||
# Verify data is readable and just as expected.
|
||||
|
@ -87,11 +85,5 @@ unlike ($output, qr/bar/, 'no bar after 5/1/2009');
|
|||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data before.rc);
|
||||
ok (! -r 'pending.data' &&
|
||||
! -r 'completed.data' &&
|
||||
! -r 'undo.data' &&
|
||||
! -r 'backlog.data' &&
|
||||
! -r 'before.rc', 'Cleanup');
|
||||
|
||||
exit 0;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 12;
|
||||
use Test::More tests => 10;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
|
@ -40,7 +40,6 @@ if (open my $fh, '>', 'bulk.rc')
|
|||
"confirmation=yes\n",
|
||||
"bulk=3\n";
|
||||
close $fh;
|
||||
ok (-r 'bulk.rc', 'Created bulk.rc');
|
||||
}
|
||||
|
||||
# Add some tasks with project, prioriy and due date, some with only due date.
|
||||
|
@ -74,11 +73,5 @@ like ($output, qr/Priority\s+M/, 'priority applied to 6');
|
|||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data bulk.rc);
|
||||
ok (! -r 'pending.data' &&
|
||||
! -r 'completed.data' &&
|
||||
! -r 'undo.data' &&
|
||||
! -r 'backlog.data' &&
|
||||
! -r 'bulk.rc', 'Cleanup');
|
||||
|
||||
exit 0;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 3;
|
||||
use Test::More tests => 1;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
|
@ -39,7 +39,6 @@ if (open my $fh, '>', 'bug.rc')
|
|||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Unreported Bug c01: Entering two recurring tasks back to back fails to increment
|
||||
|
@ -56,11 +55,5 @@ like ($output, qr/Created task 2\./ms, 'Recurring task assigned correct ID.');
|
|||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data bug.rc);
|
||||
ok (! -r 'pending.data' &&
|
||||
! -r 'completed.data' &&
|
||||
! -r 'undo.data' &&
|
||||
! -r 'backlog.data' &&
|
||||
! -r 'bug.rc', 'Cleanup');
|
||||
|
||||
exit 0;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 29;
|
||||
use Test::More tests => 27;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
|
@ -37,9 +37,7 @@ delete $ENV{'TASKRC'};
|
|||
if (open my $fh, '>', 'cal.rc')
|
||||
{
|
||||
print $fh "data.location=.";
|
||||
|
||||
close $fh;
|
||||
ok (-r 'cal.rc', 'Created cal.rc');
|
||||
}
|
||||
|
||||
# Bug: The 'cal' command can fail when provided with challenging arguments.
|
||||
|
@ -108,10 +106,4 @@ unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal
|
|||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data cal.rc);
|
||||
ok (! -r 'pending.data' &&
|
||||
! -r 'completed.data' &&
|
||||
! -r 'undo.data' &&
|
||||
! -r 'backlog.data' &&
|
||||
! -r 'cal.rc', 'Cleanup');
|
||||
|
||||
exit 0;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
use Test::More tests => 3;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
|
@ -39,7 +39,6 @@ if (open my $fh, '>', 'bug.rc')
|
|||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# When a task is modified like this:
|
||||
|
@ -72,11 +71,5 @@ like ($output, qr/Description\s+aaa bbb:ccc ddd\n/, 'properly concatenated');
|
|||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data bug.rc);
|
||||
ok (! -r 'pending.data' &&
|
||||
! -r 'completed.data' &&
|
||||
! -r 'undo.data' &&
|
||||
! -r 'backlog.data' &&
|
||||
! -r 'bug.rc', 'Cleanup');
|
||||
|
||||
exit 0;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 3;
|
||||
use Test::More tests => 1;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
|
@ -40,7 +40,6 @@ if (open my $fh, '>', 'hang.rc')
|
|||
"shadow.file=shadow.txt\n",
|
||||
"shadow.command=list\n";
|
||||
close $fh;
|
||||
ok (-r 'hang.rc', 'Created hang.rc');
|
||||
}
|
||||
|
||||
=pod
|
||||
|
@ -74,12 +73,5 @@ if ($@ eq "alarm\n")
|
|||
|
||||
# Cleanup.
|
||||
unlink qw(shadow.txt pending.data completed.data undo.data backlog.data hang.rc);
|
||||
ok (! -r 'shadow.txt' &&
|
||||
! -r 'pending.data' &&
|
||||
! -r 'completed.data' &&
|
||||
! -r 'undo.data' &&
|
||||
! -r 'backlog.data' &&
|
||||
! -r 'hang.rc', 'Cleanup');
|
||||
|
||||
exit 0;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 16;
|
||||
use Test::More tests => 14;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
|
@ -39,7 +39,6 @@ if (open my $fh, '>', 'hasnt.rc')
|
|||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'hasnt.rc', 'Created hasnt.rc');
|
||||
}
|
||||
|
||||
# 1
|
||||
|
@ -71,7 +70,7 @@ qx{../src/task rc:hasnt.rc add one 2>&1};
|
|||
qx{../src/task rc:hasnt.rc 7 annotate two 2>&1};
|
||||
qx{../src/task rc:hasnt.rc 7 annotate three 2>&1};
|
||||
|
||||
my $output = qx{../src/task rc:hasnt.rc ls description.has:foo 2>&1};
|
||||
my $output = qx{../src/task rc:hasnt.rc long description.has:foo 2>&1};
|
||||
like ($output, qr/\n 1/, '1 has foo -> yes');
|
||||
like ($output, qr/\n 2/, '2 has foo -> yes');
|
||||
like ($output, qr/\n 3/, '3 has foo -> yes');
|
||||
|
@ -80,7 +79,7 @@ like ($output, qr/\n 5/, '5 has foo -> yes');
|
|||
like ($output, qr/\n 6/, '6 has foo -> yes');
|
||||
unlike ($output, qr/\n 7/, '7 has foo -> no');
|
||||
|
||||
$output = qx{../src/task rc:hasnt.rc ls description.hasnt:foo 2>&1};
|
||||
$output = qx{../src/task rc:hasnt.rc long description.hasnt:foo 2>&1};
|
||||
unlike ($output, qr/\n 1/, '1 hasnt foo -> no');
|
||||
unlike ($output, qr/\n 2/, '2 hasnt foo -> no'); # 10
|
||||
unlike ($output, qr/\n 3/, '3 hasnt foo -> no');
|
||||
|
@ -91,11 +90,5 @@ like ($output, qr/\n 7/, '7 hasnt foo -> yes'); # 15
|
|||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data hasnt.rc);
|
||||
ok (! -r 'pending.data' &&
|
||||
! -r 'completed.data' &&
|
||||
! -r 'undo.data' &&
|
||||
! -r 'backlog.data' &&
|
||||
! -r 'hasnt.rc', 'Cleanup');
|
||||
|
||||
exit 0;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 41;
|
||||
use Test::More tests => 39;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
|
@ -38,7 +38,6 @@ if (open my $fh, '>', 'period.rc')
|
|||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'period.rc', 'Created period.rc');
|
||||
}
|
||||
|
||||
=pod
|
||||
|
@ -161,11 +160,5 @@ like ($output, qr/No duplicates found/, 'No duplicate UUIDs detected');
|
|||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data period.rc);
|
||||
ok (! -r 'pending.data' &&
|
||||
! -r 'completed.data' &&
|
||||
! -r 'undo.data' &&
|
||||
! -r 'backlog.data' &&
|
||||
! -r 'period.rc', 'Cleanup');
|
||||
|
||||
exit 0;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
use Test::More tests => 3;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
|
@ -40,7 +40,6 @@ if (open my $fh, '>', 'range.rc')
|
|||
"confirmation=no\n",
|
||||
"dateformat=m/d/Y\n";
|
||||
close $fh;
|
||||
ok (-r 'range.rc', 'Created range.rc');
|
||||
}
|
||||
|
||||
# Add three tasks, and attempt to list the middle one within a range.
|
||||
|
@ -54,11 +53,5 @@ unlike ($output, qr/three/, 'Missing after range');
|
|||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data range.rc);
|
||||
ok (! -r 'pending.data' &&
|
||||
! -r 'completed.data' &&
|
||||
! -r 'undo.data' &&
|
||||
! -r 'backlog.data' &&
|
||||
! -r 'range.rc', 'Cleanup');
|
||||
|
||||
exit 0;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 3;
|
||||
use Test::More tests => 1;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
|
@ -39,7 +39,6 @@ if (open my $fh, '>', 'recur.rc')
|
|||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'recur.rc', 'Created recur.rc');
|
||||
}
|
||||
|
||||
# Add a recurring task with no due date, look for expected error.
|
||||
|
@ -49,11 +48,5 @@ unlike ($output, qr/Description\s+foo/, 'task not created - missing due date');
|
|||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data recur.rc);
|
||||
ok (! -r 'pending.data' &&
|
||||
! -r 'completed.data' &&
|
||||
! -r 'undo.data' &&
|
||||
! -r 'backlog.data' &&
|
||||
! -r 'recur.rc', 'Cleanup');
|
||||
|
||||
exit 0;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 4;
|
||||
use Test::More tests => 2;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
|
@ -38,7 +38,6 @@ if (open my $fh, '>', 'bug_sort.rc')
|
|||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'bug_sort.rc', 'Created bug_sort.rc');
|
||||
}
|
||||
|
||||
my $setup = "../src/task rc:bug_sort.rc add one 2>&1;"
|
||||
|
@ -55,11 +54,5 @@ like ($output, qr/three.*one.*two/msi, 'list did not hang after pri:H on 1');
|
|||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data bug_sort.rc);
|
||||
ok (! -r 'pending.data' &&
|
||||
! -r 'completed.data' &&
|
||||
! -r 'undo.data' &&
|
||||
! -r 'backlog.data' &&
|
||||
! -r 'bug_sort.rc', 'Cleanup');
|
||||
|
||||
exit 0;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 6;
|
||||
use Test::More tests => 4;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
|
@ -39,7 +39,6 @@ if (open my $fh, '>', 'extra.rc')
|
|||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'extra.rc', 'Created extra.rc');
|
||||
}
|
||||
|
||||
qx{../src/task rc:extra.rc add foo 2>&1};
|
||||
|
@ -53,11 +52,5 @@ like ($output, qr/bar/, 'Correct annotation');
|
|||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data extra.rc);
|
||||
ok (! -r 'pending.data' &&
|
||||
! -r 'completed.data' &&
|
||||
! -r 'undo.data' &&
|
||||
! -r 'backlog.data' &&
|
||||
! -r 'extra.rc', 'Cleanup');
|
||||
|
||||
exit 0;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
use Test::More tests => 3;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
|
@ -39,7 +39,6 @@ if (open my $fh, '>', 'uuid.rc')
|
|||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'uuid.rc', 'Created uuid.rc');
|
||||
}
|
||||
|
||||
# Add a task, dup it, add a recurring task, list. Then make sure they all have
|
||||
|
@ -89,11 +88,5 @@ like ($output, qr/No duplicates found/, 'No duplicate UUIDs detected');
|
|||
|
||||
# Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data uuid.rc);
|
||||
ok (! -r 'pending.data' &&
|
||||
! -r 'completed.data' &&
|
||||
! -r 'undo.data' &&
|
||||
! -r 'backlog.data' &&
|
||||
! -r 'uuid.rc', 'Cleanup');
|
||||
|
||||
exit 0;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue