Unit Tests

- Removed useless setup/teardown tests, improving the signal to noise ratio.
This commit is contained in:
Paul Beckingham 2014-06-01 10:05:10 -04:00
parent 307ea1c857
commit f85ff7bde1
8 changed files with 8 additions and 64 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, '>', 'sp.rc')
{
print $fh "data.location=.\n";
close $fh;
ok (-r 'sp.rc', 'Created sp.rc');
}
my $setup = "../src/task rc:sp.rc add project:abc abc 2>&1;"
@ -67,11 +66,5 @@ like ($output, qr/No matches\./, 'abc,ab,a,b | abcd -> nul');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data sp.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'sp.rc', 'Cleanup');
exit 0;

View file

@ -27,7 +27,7 @@
use strict;
use warnings;
use Test::More tests => 9;
use Test::More tests => 7;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -39,7 +39,6 @@ if (open my $fh, '>', 'subst.rc')
print $fh "data.location=.\n",
"regex=off\n";
close $fh;
ok (-r 'subst.rc', 'Created subst.rc');
}
# Test the substitution command.
@ -79,11 +78,5 @@ like ($output, qr/aaa CcC/, 'regex');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data subst.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'subst.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'};
@ -38,7 +38,6 @@ if (open my $fh, '>', 'tag.rc')
{
print $fh "data.location=.\n";
close $fh;
ok (-r 'tag.rc', 'Created tag.rc');
}
# Add task with tags.
@ -67,11 +66,5 @@ unlike ($output, qr/^Tags/m, '-missing NOP');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data tag.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'tag.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 weeks, then verify
@ -86,11 +85,5 @@ like ($output, qr/Completed.+C0.+Started.+PS0.+Completed.+C1.+Started.+PS1.+Comp
# 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 => 32;
use Test::More tests => 30;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -67,7 +67,6 @@ if (open my $fh, '>', 'urgency.rc')
"confirmation=off\n";
close $fh;
ok (-r 'urgency.rc', 'Created urgency.rc');
}
# Add a task, and verify that the individual urgency terms are being correctly
@ -340,10 +339,4 @@ like ($output, qr/Urgency 0\.01$/ms, 'near-zero urgency is truncated');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data urgency.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'urgency.rc', 'Cleanup');
exit 0;

View file

@ -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, '>', 'utf8.rc')
{
print $fh "data.location=.\n";
close $fh;
ok (-r 'utf8.rc', 'Created utf8.rc');
}
# Add a task with UTF8 in the description.
@ -74,11 +73,5 @@ like ($output, qr/utf8 in tag/, 'utf8 in tag works');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data utf8.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'utf8.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, '>', 'verbose.rc')
print $fh "data.location=.\n",
"print.empty.columns=yes\n";
close $fh;
ok (-r 'verbose.rc', 'Created verbose.rc');
}
# Verbosity: 'new-id'
@ -70,11 +69,5 @@ unlike ($output, qr/ID.+Project.+Pri.+Description/, '\'label\' verbosity good');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data verbose.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'verbose.rc', 'Cleanup');
exit 0;

View file

@ -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'};
@ -44,7 +44,6 @@ if (open my $fh, '>', 'wait.rc')
"confirmation=off\n";
close $fh;
ok (-r 'wait.rc', 'Created wait.rc');
}
# Add a waiting task, check it is not there, wait, then check it is.
@ -86,10 +85,4 @@ like ($output, qr/Warning: You have specified that the 'wait' date is after the
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data wait.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'wait.rc', 'Cleanup');
exit 0;