Unit Tests

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

View file

@ -27,7 +27,7 @@
use strict;
use warnings;
use Test::More tests => 22;
use Test::More tests => 20;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -42,7 +42,6 @@ if (open my $fh, '>', 'export.rc')
print $fh "data.location=.\n",
"verbose=no\n";
close $fh;
ok (-r 'export.rc', 'Created export.rc');
}
# Add two tasks, export, examine result.
@ -81,12 +80,5 @@ like ($lines[19], qr/^\.\.\.$/, 'export YAML line 20');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data export.rc export.txt);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'export.rc' &&
! -r 'export.txt', 'Cleanup');
exit 0;

View file

@ -27,7 +27,7 @@
use strict;
use warnings;
use Test::More tests => 163;
use Test::More tests => 161;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -38,7 +38,6 @@ if (open my $fh, '>', 'filter.rc')
{
print $fh "data.location=.\n";
close $fh;
ok (-r 'filter.rc', 'Created filter.rc');
}
# Test the filters.
@ -278,11 +277,5 @@ unlike ($output, qr/seven/, 'y7');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data filter.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'filter.rc', 'Cleanup');
exit 0;

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, '>', 'font.rc')
{
print $fh "data.location=.\n";
close $fh;
ok (-r 'font.rc', 'Created font.rc');
}
# Test the fontunderline config variable. The following truth table defines
@ -77,11 +76,5 @@ unlike ($output, qr/--------/, '1,1,1 -> underline');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data font.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'font.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'};
@ -38,7 +38,6 @@ if (open my $fh, '>', 'time.rc')
{
print $fh "data.location=.\n";
close $fh;
ok (-r 'time.rc', 'Created time.rc');
}
# Create some tasks that were started/finished in different months, then verify
@ -72,10 +71,4 @@ like ($output, qr/4\s+2\s+1\s+1/, 'history.annual - average');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data time.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'time.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'};
@ -38,7 +38,6 @@ if (open my $fh, '>', 'time.rc')
{
print $fh "data.location=.\n";
close $fh;
ok (-r 'time.rc', 'Created time.rc');
}
# Create some tasks that were started/finished in different months, then verify
@ -72,10 +71,4 @@ like ($output, qr/4\s+2\s+1\s+1/, 'history.monthly - average');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data time.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'time.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'};
@ -42,7 +42,6 @@ if (open my $fh, '>', 'bug.rc')
print $fh "detection=off\n";
print $fh "verbose=nothing\n";
close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
}
# Split on comma instead of hyphenating
@ -52,11 +51,5 @@ unlike ($output, qr/-/, 'split on comma for comma-separated lists');
# 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 => 10;
use Test::More tests => 8;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -39,7 +39,6 @@ if (open my $fh, '>', 'ids.rc')
print $fh "data.location=.\n",
"confirmation=off\n";
close $fh;
ok (-r 'ids.rc', 'Created ids.rc');
}
# Test the count command.
@ -76,11 +75,5 @@ like ($output, qr/^[0-9a-f-]+:[a-z]+\n[0-9a-f-]+:[a-z]+\n[0-9a-f-]+:[a-z]+\n[0-9
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data ids.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'ids.rc', 'Cleanup');
exit 0;