From ab7370a2eb3810a0204458ff6f527149608c4059 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sun, 1 Jun 2014 10:30:29 -0400 Subject: [PATCH] Unit Tests - Removed useless setup/teardown tests, improving the signal to noise ratio. --- test/bug.906.t | 9 +-------- test/bug.917.t | 9 +-------- test/bug.924.t | 9 +-------- test/bug.932.t | 9 +-------- test/bug.954.t | 9 +-------- test/bug.955.t | 9 +-------- test/bug.956.t | 11 ++--------- test/bug.972.t | 9 +-------- test/bug.986.t | 11 ++--------- test/bug.990.t | 9 +-------- test/bug.991.t | 9 +-------- 11 files changed, 13 insertions(+), 90 deletions(-) diff --git a/test/bug.906.t b/test/bug.906.t index 57583b55d..19dce14c7 100755 --- a/test/bug.906.t +++ b/test/bug.906.t @@ -27,7 +27,7 @@ use strict; use warnings; -use Test::More tests => 17; +use Test::More tests => 15; # 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 906: escaping runs amok @@ -73,11 +72,5 @@ like ($output, qr/two/, 'list - two included'); # 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/bug.917.t b/test/bug.917.t index f3fcbaeab..41369d03a 100755 --- a/test/bug.917.t +++ b/test/bug.917.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'}; @@ -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 917: escaping runs amok @@ -56,11 +55,5 @@ like ($output, qr/four "five" six/, 'Double quote preserved after modification') # 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/bug.924.t b/test/bug.924.t index e4b73e697..cd15833be 100755 --- a/test/bug.924.t +++ b/test/bug.924.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'}; @@ -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 924: '1.0' --> '1.0000' @@ -52,11 +51,5 @@ like ($output, qr/\s3.0\s/ms, 'Double quote floating point preserved'); # 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/bug.932.t b/test/bug.932.t index 119659a10..46d47a0c4 100755 --- a/test/bug.932.t +++ b/test/bug.932.t @@ -27,7 +27,7 @@ use strict; use warnings; -use Test::More tests => 12; +use Test::More tests => 10; # 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 932: Modifying recurring task's recurrence period - strange outcome @@ -69,11 +68,5 @@ like ($output, qr/No duplicates found/, 'No duplicate UUIDs detected'); # 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/bug.954.t b/test/bug.954.t index 8abb9d62d..1215e4c64 100755 --- a/test/bug.954.t +++ b/test/bug.954.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'}; @@ -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 954 - Deleting task by uuid attempts deleting all tasks @@ -60,10 +59,4 @@ like ($output, qr/bar/ms, 'Task bar not deleted'); # 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/bug.955.t b/test/bug.955.t index 2198499ca..5de2ebe2c 100755 --- a/test/bug.955.t +++ b/test/bug.955.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'}; @@ -39,7 +39,6 @@ if (open my $fh, '>', 'bug.rc') print $fh "data.location=.\n", "confirmation=on\n"; close $fh; - ok (-r 'bug.rc', 'Created bug.rc'); } # Bug 955: When deleting the child of a recurring task, taskwarrior does not ask @@ -58,11 +57,5 @@ like ($output, qr/^No matches/ms, 'No tasks remaining'); # 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/bug.956.t b/test/bug.956.t index 69ad78cb8..be0d47731 100755 --- a/test/bug.956.t +++ b/test/bug.956.t @@ -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'}; @@ -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 956 - 'task ids' prints the header, which prevents using the command in @@ -72,12 +71,6 @@ $output = qx{TASKRC=bug.rc ../src/task _ids 2>/dev/null}; like ($output, qr/^[0-9a-f-]*$/m, 'UUID shown'); unlike ($output, qr/TASKRC/ms, 'The header does not appear with "_ids" (2>/dev/null)'); -### Cleanup. +# 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/bug.972.t b/test/bug.972.t index 059e81eca..75f7ffbe2 100755 --- a/test/bug.972.t +++ b/test/bug.972.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'}; @@ -39,7 +39,6 @@ if (open my $fh, '>', 'bug.rc') print $fh "data.location=.\n", "recurrence.limit=1\n"; close $fh; - ok (-r 'bug.rc', 'Created bug.rc'); } # Bug 972: A recurrence period of "7" is interpreted as "7s", not "7d" as @@ -49,11 +48,5 @@ like ($output, qr/ not recognized as valid, /, 'recur:2 is not valid'); # 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/bug.986.t b/test/bug.986.t index b622ffa4b..ac8745b96 100755 --- a/test/bug.986.t +++ b/test/bug.986.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'}; @@ -39,7 +39,6 @@ if (open my $fh, '>', 'bug.rc') print $fh "data.location=.\n", "verbose=nothing\n"; close $fh; - ok (-r 'bug.rc', 'Created bug.rc'); } # Bug 986 - 'task info' does not format date using dateformat.report @@ -60,12 +59,6 @@ unlike ($output, qr/[0-9]*\/[0-9]*\/20[0-9]*/ms, 'No date is incorrectly formatt $output = qx{../src/task rc:bug.rc test info rc.dateformat:__ rc.dateformat.info: 2>&1}; like ($output, qr/__/ms, 'Date formatted according to dateformat'); -### Cleanup. +# 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/bug.990.t b/test/bug.990.t index c932e4463..eb901d861 100755 --- a/test/bug.990.t +++ b/test/bug.990.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'}; @@ -41,7 +41,6 @@ if (open my $fh, '>', 'color.rc') "color.tagged=red\n", "_forcecolor=1\n"; close $fh; - ok (-r 'color.rc', 'Created color.rc'); } # Bug that colored any task with both priority:L and a tag as though @@ -53,11 +52,5 @@ like ($output, qr/ \033\[32m .* test .* \033\[0m /x, 'Colored with the pr # Cleanup. unlink qw(pending.data completed.data undo.data backlog.data color.rc); -ok (! -r 'pending.data' && - ! -r 'completed.data' && - ! -r 'undo.data' && - ! -r 'backlog.data' && - ! -r 'color.rc', 'Cleanup'); - exit 0; diff --git a/test/bug.991.t b/test/bug.991.t index d62d18d23..89d52a881 100755 --- a/test/bug.991.t +++ b/test/bug.991.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'}; @@ -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 991 - A deprecated configuration variable is checked @@ -54,10 +53,4 @@ unlike ($output, qr/unrecognized/ms, 'No unrecognized variable'); ## 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;