Unit Tests

- Removed useless setup/teardown tests, improving the signal to noise ratio.
This commit is contained in:
Paul Beckingham 2014-06-01 10:38:51 -04:00
parent e1602057dd
commit 92ba0055fb
13 changed files with 15 additions and 106 deletions

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'};
@ -39,7 +39,6 @@ if (open my $fh, '>', 'bug.rc')
print $fh "data.location=.\n",
"verbose=affected\n";
close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
}
# Bug with completion of "des" in task descriptions and annotations. It happens
@ -64,10 +63,4 @@ like ($output, qr/entrée interdite/, "'entrée' left intact");
# 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 => 11;
use Test::More tests => 9;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -39,7 +39,6 @@ if (open my $fh, '>', 'bug.rc')
print $fh "data.location=.\n",
"default.project=home\n";
close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
}
# Bug 1023: rc.default.project gets applied during modify, and should not.
@ -69,11 +68,5 @@ unlike ($output, qr/Project\s*home/, "default project not re-applied on attribut
# 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 => 5;
use Test::More tests => 3;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -39,7 +39,6 @@ if (open my $fh, '>', 'bug.rc')
print $fh "data.location=.\n",
"alias.from=to\n";
close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
}
# Bug 1031: -- does not bypass aliasing
@ -58,11 +57,5 @@ like ($output, qr/Description\s+to from$/ms, "'to -- from' --> 'to from'");
# 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, '>', 'bug.rc')
print $fh "data.location=.\n",
"dateformat=m/d/Y\n";
close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
}
# Bug #1036: prevents 'until' attributes to be modified for non-recurring
@ -56,11 +55,5 @@ like ($output, qr/^Modifying task 1 'Test'.$/ms, 'Task with "until" attribute mo
# 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 => 7;
use Test::More tests => 5;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -40,7 +40,6 @@ if (open my $fh, '>', 'bug.rc')
print $fh "alias.samplealias=long\n";
close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
}
# Bug - aliases should be listed by '_aliases' and not by '_commands' or '_zshcommands'
@ -57,10 +56,4 @@ unlike ($output, qr/samplealias/, 'aliases are not listed in _zshcommands');
# 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=off\n";
close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
}
# Bug #1044: 'task projects' considers newly deleted tasks and provides an
@ -55,11 +54,5 @@ like ($output, qr/^1 project \(1 task\)$/ms, 'Summary filtered new deleted 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 => 9;
use Test::More tests => 7;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -41,7 +41,6 @@ if (open my $fh, '>', 'bug.1056')
"color=off\n",
"verbose=nothing\n";
close $fh;
ok (-r 'bug.1056', 'Created pro.rc');
}
# Bug 1056: Project indentation in CmdSummary.
@ -65,11 +64,5 @@ like ($lines[6], qr/^myProject\.\s+\d/, "'myProject.' not indented, wi
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data bug.1056);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'bug.1056', 'Cleanup');
exit 0;

View file

@ -27,7 +27,7 @@
use strict;
use warnings;
use Test::More tests => 8;
use Test::More tests => 6;
use File::Basename;
# Ensure environment has no influence.
@ -49,7 +49,6 @@ if (open my $fh, '>', $rc)
"report.bar.labels=Foo,Desc\n",
"report.bar.sort=foo-\n";
close $fh;
ok (-r $rc, "$ut: Created $rc");
}
# Bug 1063 - Numeric UDA fields are not sortable.
@ -70,10 +69,4 @@ like ($output, qr/1.+2.+3.+4/ms, "$ut: Default ascending sort correct");
## Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data), $rc;
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r $rc, "$ut: 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'};
@ -41,7 +41,6 @@ if (open my $fh, '>', 'bug.rc')
print $fh "imnotrecognized=kai\n";
close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
}
# Bug 1065 - CmdShow should not display the differ message if no non-default in matched elements.
@ -72,10 +71,4 @@ unlike ($output, qr/unrecognized variables/, 'Message is not shown when no non-d
# 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'};
@ -38,7 +38,6 @@ if (open my $fh, '>', 'bug.rc')
{
print $fh "data.location=.\n";
close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
}
# Bug 1110: reports print "Completed" but "Completed" != "completed"
@ -53,10 +52,4 @@ like ($output, qr/ToBeCompleted/, 'status:completed returns completed tasks');
# 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 => 5;
use Test::More tests => 3;
# 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');
}
# Setup: Add three unique tasks with different project names.
@ -56,11 +55,5 @@ like ($output, qr/three.*baz/ms, 'project.isnt:one project.isnt:two - yes baz'
# 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,27 +39,20 @@ if (open my $fh, '>', 'bug.rc')
print $fh "data.location=.\n",
"confirmation=no\n";
close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
}
# Setup: Add a recurring task then remove the due date.
qx{../src/task rc:bug.rc add foo recur:yearly due:eoy 2>&1};
qx{../src/task rc:bug.rc li 2>&1};
qx{../src/task rc:bug.rc list 2>&1};
qx{../src/task rc:bug.rc 2 modify due: 2>&1};
# Result: Somehow the due date is incremented and wraps around to 12/31/1969,
# then keeps going back to today.
my $output = qx{../src/task rc:bug.rc li 2>&1};
my $output = qx{../src/task rc:bug.rc list 2>&1};
like ($output, qr/^1 task$/ms, 'task foo shown');
unlike ($output, qr/1969/ms, 'Should not display 12/31/1969');
# 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')
"dateformat.info=m/d/Y\n",
"confirmation=no\n";
close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
}
# Setup: Add a recurring task, generate an instance, then add a project.
@ -53,11 +52,5 @@ unlike ($output, qr/Until\s+\d{10}/, 'until is not shown as an epoch');
# 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;