From ca06927eeaea66b7d7040cd8537830390d80d69b Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 1 Jun 2014 10:23:19 -0400 Subject: [PATCH] Unit Tests - Removed useless setup/teardown tests, improving the signal to noise ratio. --- test/export.yaml.t | 10 +--------- test/filter.t | 9 +-------- test/fontunderline.t | 9 +-------- test/history.annual.t | 9 +-------- test/history.monthly.t | 9 +-------- test/hyphenate.t | 9 +-------- test/ids.t | 9 +-------- 7 files changed, 7 insertions(+), 57 deletions(-) diff --git a/test/export.yaml.t b/test/export.yaml.t index 68501b6dd..1c826374b 100755 --- a/test/export.yaml.t +++ b/test/export.yaml.t @@ -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; diff --git a/test/filter.t b/test/filter.t index b30307ec4..28ba837ae 100755 --- a/test/filter.t +++ b/test/filter.t @@ -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; diff --git a/test/fontunderline.t b/test/fontunderline.t index 827dababf..5fa7fdff7 100755 --- a/test/fontunderline.t +++ b/test/fontunderline.t @@ -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; diff --git a/test/history.annual.t b/test/history.annual.t index c9c9caf07..a01c5c0a3 100755 --- a/test/history.annual.t +++ b/test/history.annual.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'}; @@ -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; diff --git a/test/history.monthly.t b/test/history.monthly.t index 57d2ce936..07af87b86 100755 --- a/test/history.monthly.t +++ b/test/history.monthly.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'}; @@ -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; diff --git a/test/hyphenate.t b/test/hyphenate.t index 9d7144e02..33a770f28 100755 --- a/test/hyphenate.t +++ b/test/hyphenate.t @@ -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; diff --git a/test/ids.t b/test/ids.t index e4d4294b4..612367303 100755 --- a/test/ids.t +++ b/test/ids.t @@ -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;