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 strict;
use warnings; use warnings;
use Test::More tests => 10; use Test::More tests => 8;
# Ensure environment has no influence. # Ensure environment has no influence.
delete $ENV{'TASKDATA'}; delete $ENV{'TASKDATA'};
@@ -38,7 +38,6 @@ if (open my $fh, '>', 'outerr.rc')
{ {
print $fh "data.location=.\n"; print $fh "data.location=.\n";
close $fh; close $fh;
ok (-r 'outerr.rc', 'Created outerr.rc');
} }
# Feature 1013: output error, header, footnote and debug messages on standard # 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. # Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data outerr.rc); 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; exit 0;

View File

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

View File

@@ -27,7 +27,7 @@
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'};
@@ -40,7 +40,6 @@ if (open my $fh, '>', 'bug.rc')
"exit.on.missing.db=yes\n", "exit.on.missing.db=yes\n",
"confirmation=no\n"; "confirmation=no\n";
close $fh; 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. # 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. # Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data bug.rc); 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; exit 0;

View File

@@ -27,7 +27,7 @@
use strict; use strict;
use warnings; use warnings;
use Test::More tests => 3; use Test::More tests => 1;
# Ensure environment has no influence. # Ensure environment has no influence.
delete $ENV{'TASKDATA'}; delete $ENV{'TASKDATA'};
@@ -39,7 +39,6 @@ if (open my $fh, '>', 'bug.rc')
print $fh "data.location=.\n", print $fh "data.location=.\n",
"confirmation=no\n"; "confirmation=no\n";
close $fh; close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
} }
# Feature 608: Done should stop a task # 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. # Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data bug.rc); 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; exit 0;

View File

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

View File

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

View File

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

View File

@@ -27,7 +27,7 @@
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'};
@@ -39,7 +39,6 @@ if (open my $fh, '>', 'exit.rc')
print $fh "data.location=.\n", print $fh "data.location=.\n",
"confirmation=no\n"; "confirmation=no\n";
close $fh; close $fh;
ok (-r 'exit.rc', 'Created exit.rc');
} }
qx{../src/task rc:exit.rc add foo 2>&1}; 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. # Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data exit.rc); 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; exit 0;

View File

@@ -27,7 +27,7 @@
use strict; use strict;
use warnings; use warnings;
use Test::More tests => 6; use Test::More tests => 4;
# Ensure environment has no influence. # Ensure environment has no influence.
delete $ENV{'TASKDATA'}; delete $ENV{'TASKDATA'};
@@ -36,10 +36,9 @@ delete $ENV{'TASKRC'};
# Create the rc file. # Create the rc file.
if (open my $fh, '>', 'bug.rc') if (open my $fh, '>', 'bug.rc')
{ {
print $fh "data.location=.\n"; print $fh "data.location=.\n",
print $fh "report.test.columns=id,project\n"; "report.test.columns=id,project\n";
close $fh; close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
} }
# Feature: variable to control printing of empty columns # 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. # Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data bug.rc); 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; exit 0;