From a59f8644f1639c52c35d2229a6870ac55610c7c4 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 1 Jun 2014 09:48:19 -0400 Subject: [PATCH] Unit Tests - Removed useless setup/teardown tests, improving the signal to noise ratio. --- test/uda_date.t | 9 +-------- test/uda_defaults.t | 10 +--------- test/uda_duration.t | 9 +-------- test/uda_numeric.t | 9 +-------- test/uda_orphan.t | 12 +----------- test/uda_report.t | 10 +--------- test/uda_string.t | 9 +-------- test/uda_value.t | 9 +-------- 8 files changed, 8 insertions(+), 69 deletions(-) diff --git a/test/uda_date.t b/test/uda_date.t index 814337538..e9289b806 100755 --- a/test/uda_date.t +++ b/test/uda_date.t @@ -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; diff --git a/test/uda_defaults.t b/test/uda_defaults.t index f88e63a67..6828fc801 100755 --- a/test/uda_defaults.t +++ b/test/uda_defaults.t @@ -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; diff --git a/test/uda_duration.t b/test/uda_duration.t index a01ae5a33..f7b6fb167 100755 --- a/test/uda_duration.t +++ b/test/uda_duration.t @@ -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; diff --git a/test/uda_numeric.t b/test/uda_numeric.t index 7d83f00db..e54e8b1cb 100755 --- a/test/uda_numeric.t +++ b/test/uda_numeric.t @@ -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; diff --git a/test/uda_orphan.t b/test/uda_orphan.t index 9d8873c15..d6091399c 100755 --- a/test/uda_orphan.t +++ b/test/uda_orphan.t @@ -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; diff --git a/test/uda_report.t b/test/uda_report.t index e5930c53e..552198974 100755 --- a/test/uda_report.t +++ b/test/uda_report.t @@ -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; diff --git a/test/uda_string.t b/test/uda_string.t index 35ba4ce31..07c29122b 100755 --- a/test/uda_string.t +++ b/test/uda_string.t @@ -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; diff --git a/test/uda_value.t b/test/uda_value.t index f9ef2e163..e0fb9bca0 100755 --- a/test/uda_value.t +++ b/test/uda_value.t @@ -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;