Unit Tests

- Removed useless setup/teardown tests, improving the signal to noise ratio.
This commit is contained in:
Paul Beckingham 2014-06-01 10:22:05 -04:00
parent 7f08ec5a63
commit abb663fae3
8 changed files with 8 additions and 66 deletions

View file

@ -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'};
@ -46,7 +46,6 @@ if (open my $fh, '>', 'datesort.rc')
"report.small_list.dateformat=MD\n";
close $fh;
ok (-r 'datesort.rc', 'Created datesort.rc');
}
qx{../src/task rc:datesort.rc add two due:20100201 2>&1};
@ -61,11 +60,5 @@ like ($output, qr/three.+two.+one/ms, 'Sorting by due- with format MD works');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data datesort.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'datesort.rc', 'Cleanup');
exit 0;

View file

@ -27,7 +27,7 @@
use strict;
use warnings;
use Test::More tests => 21;
use Test::More tests => 19;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -43,7 +43,6 @@ if (open my $fh, '>', 'default.rc')
"default.due=eom\n",
"dateformat=m/d/Y\n";
close $fh;
ok (-r 'default.rc', 'Created default.rc');
}
# Set up a default command, project and priority.
@ -89,11 +88,5 @@ unlike ($output, qr/ L /, 'priority:L excluded from default command');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data default.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'default.rc', 'Cleanup');
exit 0;

View file

@ -27,7 +27,7 @@
use strict;
use warnings;
use Test::More tests => 14;
use Test::More tests => 12;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -39,7 +39,6 @@ if (open my $fh, '>', 'delete.rc')
print $fh "data.location=.\n",
"confirmation=no\n";
close $fh;
ok (-r 'delete.rc', 'Created delete.rc');
}
# Add a task, delete it, undelete it.
@ -82,11 +81,5 @@ like ($output, qr/Deleted/, 'task added, completed, then deleted');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data delete.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'delete.rc', 'Cleanup');
exit 0;

View file

@ -27,7 +27,7 @@
use strict;
use warnings;
use Test::More tests => 49;
use Test::More tests => 47;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -43,9 +43,6 @@ if (open my $fh, '>', 'dep.rc')
print $fh "report.depreport.filter=status:pending\n";
print $fh "report.depreport.sort=depends+\n";
close $fh;
# [1]
ok (-r 'dep.rc', 'Created dep.rc');
}
qx{../src/task rc:dep.rc add One 2>&1};
@ -261,11 +258,5 @@ unlike ($output, qr/test5/ms, 'Dependency not appearing for task5');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data dep.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'dep.rc', 'Cleanup');
exit 0;

View file

@ -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'};
@ -40,7 +40,6 @@ if (open my $fh, '>', 'dom.rc')
"dateformat=YMD\n",
"dateformat.info=YMD\n";
close $fh;
ok (-r 'dom.rc', 'Created dom.rc');
}
# DOM reference to other task.
@ -63,11 +62,5 @@ like ($output, qr/^1$/, 'DOM uuid --> id');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data dom.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'dom.rc', 'Cleanup');
exit 0;

View file

@ -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'};
@ -44,7 +44,6 @@ if (open my $fh, '>', 'due.rc')
"_forcecolor=on\n",
"dateformat=m/d/Y\n";
close $fh;
ok (-r 'due.rc', 'Created due.rc');
}
# Add a task that is almost due, and one that is just due.
@ -69,11 +68,5 @@ like ($output, qr/three/, 'due.is:today works as a filter');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data due.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'due.rc', 'Cleanup');
exit 0;

View file

@ -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'};
@ -38,7 +38,6 @@ if (open my $fh, '>', 'dup.rc')
{
print $fh "data.location=.\n";
close $fh;
ok (-r 'dup.rc', 'Created dup.rc');
}
# Test the duplicate command.
@ -65,11 +64,5 @@ like ($output, qr/Created\s+task\s+4/, 'duplicate output of new task id'
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data dup.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'dup.rc', 'Cleanup');
exit 0;

View file

@ -27,7 +27,7 @@
use strict;
use warnings;
use Test::More tests => 14;
use Test::More tests => 12;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -38,7 +38,6 @@ if (open my $fh, '>', 'dup.rc')
{
print $fh "data.location=.\n";
close $fh;
ok (-r 'dup.rc', 'Created dup.rc');
}
# Add a recurring task. Duplicate both parent and child.
@ -76,11 +75,5 @@ like ($output, qr/Parent/, 'Found duplicated child task - wi
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data dup.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'dup.rc', 'Cleanup');
exit 0;