Unit Tests

- Removed useless setup/teardown tests, improving the signal to noise ratio.
This commit is contained in:
Paul Beckingham 2014-06-01 09:43:00 -04:00
parent 6706d1b955
commit 77d93ef631
9 changed files with 11 additions and 73 deletions

View file

@ -27,7 +27,7 @@
use strict;
use warnings;
use Test::More tests => 10;
use Test::More tests => 8;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -38,7 +38,6 @@ if (open my $fh, '>', 'outerr.rc')
{
print $fh "data.location=.\n";
close $fh;
ok (-r 'outerr.rc', 'Created outerr.rc');
}
# Feature 1013: output error, header, footnote and debug messages on standard
@ -70,11 +69,5 @@ like ($stderr, qr/^Timer Config::load \(.+outerr.rc\) /ms, 'Debugs are sent to s
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data outerr.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'outerr.rc', 'Cleanup');
exit 0;

View file

@ -27,7 +27,7 @@
use strict;
use warnings;
use Test::More tests => 8;
use Test::More tests => 6;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -39,7 +39,6 @@ if (open my $fh, '>', 'bug.rc')
print $fh "data.location=.\n",
"color=off\n";
close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
}
# Test: task columns
@ -56,11 +55,5 @@ unlike ($output, qr/project/, 'columns - did not find \'escr\' in project');
# 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;

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'};
@ -40,7 +40,6 @@ if (open my $fh, '>', 'bug.rc')
"exit.on.missing.db=yes\n",
"confirmation=no\n";
close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
}
# Feature 559: rc.exit.on.missing.db should cause exit if rc.data.location is missing.
@ -53,11 +52,5 @@ like ($output, qr/Error.+does not exist/, 'Error on missing rc.data.location');
# 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;

View file

@ -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');
}
# Feature 608: Done should stop a task
@ -56,11 +55,5 @@ like ($output, qr/End set to/ms, 'Done command also stops started task.');
# 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;

View file

@ -27,7 +27,7 @@
use strict;
use warnings;
use Test::More tests => 12;
use Test::More tests => 10;
use File::Path;
# Ensure environment has no influence.
@ -39,7 +39,6 @@ if (open my $fh, '>', 'rc1')
{
print $fh "data.location=./data1\n";
close $fh;
ok (-r 'rc1', 'Created rc1');
}
if (open my $fh, '>', 'rc2')
@ -87,10 +86,5 @@ rmtree ('./data1', 0 , 1);
rmtree ('./data2', 0 , 1);
unlink qw(rc1 rc2);
ok (! -d './data1' &&
! -d './data2' &&
! -r 'rc1' &&
! -r 'rc2', 'Cleanup');
exit 0

View file

@ -27,7 +27,7 @@
use strict;
use warnings;
use Test::More tests => 8;
use Test::More tests => 6;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -39,7 +39,6 @@ if (open my $fh, '>', 'feature.rc')
print $fh "data.location=.\n",
"confirmation=off\n";
close $fh;
ok (-r 'feature.rc', 'Created feature.rc');
}
# Feature 725: Feedback when tasks become unblocked.
@ -68,11 +67,5 @@ like ($output, qr/Unblocked/, 'Deleting dependency triggers message');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data feature.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'feature.rc', 'Cleanup');
exit 0;

View file

@ -28,7 +28,7 @@
use strict;
use warnings;
use Time::Local;
use Test::More tests => 37;
use Test::More tests => 35;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -39,7 +39,6 @@ if (open my $fh, '>', 'bug.rc')
{
print $fh "data.location=.\n";
close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
}
# Feature 891: UUID filter should be uuid.endswith by default
@ -198,11 +197,5 @@ unlike ($output, qr/one/, "Not found with $short");
# 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;

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'};
@ -39,7 +39,6 @@ if (open my $fh, '>', 'exit.rc')
print $fh "data.location=.\n",
"confirmation=no\n";
close $fh;
ok (-r 'exit.rc', 'Created exit.rc');
}
qx{../src/task rc:exit.rc add foo 2>&1};
@ -50,11 +49,5 @@ isnt ($exit_bad, 0, 'task returns non-zero on failure');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data exit.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'exit.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'};
@ -36,10 +36,9 @@ delete $ENV{'TASKRC'};
# Create the rc file.
if (open my $fh, '>', 'bug.rc')
{
print $fh "data.location=.\n";
print $fh "report.test.columns=id,project\n";
print $fh "data.location=.\n",
"report.test.columns=id,project\n";
close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
}
# Feature: variable to control printing of empty columns
@ -60,10 +59,4 @@ like ($output, qr/Project/, 'non-empty \'project\' column is printed if rc.print
# 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;