Unit Tests

- Removed useless setup/teardown tests, improving the signal to noise ratio.
This commit is contained in:
Paul Beckingham 2014-06-01 09:48:19 -04:00
parent 102792e425
commit a59f8644f1
8 changed files with 8 additions and 69 deletions

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'};
@ -46,7 +46,6 @@ if (open my $fh, '>', 'uda.rc')
"report.uda.labels=ID,Extra,Description\n",
"dateformat=m/d/Y\n";
close $fh;
ok (-r 'uda.rc', 'Created uda.rc');
}
# Add tasks with and without the UDA.
@ -62,11 +61,5 @@ unlike ($output, qr/Created task \d+/, 'UDA date bad data not accepted');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data uda.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'uda.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'};
@ -49,7 +49,6 @@ if (open my $fh, '>', 'uda.rc')
"report.uda.sort=id\n",
"report.uda.labels=ID,Smell,Size,Description\n";
close $fh;
ok (-r 'uda.rc', 'Created uda.rc');
}
# Add task with nondefault UDA
@ -69,14 +68,7 @@ like ($output, qr/1\s+strong\s+one/, 'UDA nondefault stored');
like ($output, qr/2\s+weak\s+two/, 'UDA default stored');
like ($output, qr/3\s+weak\s+10\s+three/, 'UDA without default stored');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data uda.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'uda.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'};
@ -45,7 +45,6 @@ if (open my $fh, '>', 'uda.rc')
"report.uda.sort=extra,description\n",
"report.uda.labels=ID,Extra,Description\n";
close $fh;
ok (-r 'uda.rc', 'Created uda.rc');
}
# Add tasks with and without the UDA.
@ -65,11 +64,5 @@ unlike ($output, qr/Created task \d+/, 'UDA duration bad data not accepted');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data uda.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'uda.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'};
@ -45,7 +45,6 @@ if (open my $fh, '>', 'uda.rc')
"report.uda.sort=extra,description\n",
"report.uda.labels=ID,Extra,Description\n";
close $fh;
ok (-r 'uda.rc', 'Created uda.rc');
}
# Add tasks with and without the UDA.
@ -61,11 +60,5 @@ unlike ($output, qr/Created task \d+/, 'UDA numeric bad data not accepted');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data uda.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'uda.rc', 'Cleanup');
exit 0;

View file

@ -27,7 +27,7 @@
use strict;
use warnings;
use Test::More tests => 10;
use Test::More tests => 6;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -41,7 +41,6 @@ if (open my $fh, '>', 'uda.rc')
"uda.extra.type=string\n",
"uda.extra.label=Extra\n";
close $fh;
ok (-r 'uda.rc', 'Created uda.rc');
}
# Add a task with a defined UDA.
@ -55,7 +54,6 @@ if (open my $fh, '>', 'uda.rc')
print $fh "data.location=.\n",
"confirmation=off\n";
close $fh;
ok (-r 'uda.rc', 'Created uda.rc again');
}
# Observe the UDA properly reported by the 'info' command.
@ -79,7 +77,6 @@ if (open my $fh, '>', 'import.txt')
EOF
close $fh;
ok (-r 'import.txt', 'Created sample import data');
}
$output = qx{../src/task rc:uda.rc import import.txt 2>&1 >/dev/null};
@ -89,12 +86,5 @@ like ($output, qr/extra\s+bar/, 'UDA orphan imported and visible');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data uda.rc import.txt);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'uda.rc' &&
! -r 'import.txt', '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'};
@ -51,7 +51,6 @@ if (open my $fh, '>', 'uda.rc')
"report.bad.labels=ID,Extra2\n",
"report.bad.sort=ID\n";
close $fh;
ok (-r 'uda.rc', 'Created uda.rc');
}
# Add a task with a defined UDA.
@ -67,12 +66,5 @@ like ($output, qr/Unrecognized column name/, 'UDA Orphan causes error');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data uda.rc import.txt);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'uda.rc' &&
! -r 'import.txt', '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'};
@ -45,7 +45,6 @@ if (open my $fh, '>', 'uda.rc')
"report.uda.sort=extra,description\n",
"report.uda.labels=ID,Extra,Description\n";
close $fh;
ok (-r 'uda.rc', 'Created uda.rc');
}
# Add tasks with and without the UDA.
@ -57,11 +56,5 @@ like ($output, qr/2\s+without/, 'UDA string blank');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data uda.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'uda.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'};
@ -42,7 +42,6 @@ if (open my $fh, '>', 'uda.rc')
"uda.smell.label=Smell\n",
"uda.smell.values=weak,strong\n";
close $fh;
ok (-r 'uda.rc', 'Created uda.rc');
}
# Add tasks with valid and invalid UDA values.
@ -57,11 +56,5 @@ unlike ($output, qr/Created task 3/, 'UDA smell:toxic disallowed');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data uda.rc);
ok (! -r 'pending.data' &&
! -r 'completed.data' &&
! -r 'undo.data' &&
! -r 'backlog.data' &&
! -r 'uda.rc', 'Cleanup');
exit 0;