From 36db62728b1e087e1d17c31bec58bb7393a7a346 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Tue, 6 Sep 2011 23:39:57 -0400 Subject: [PATCH] Unit Tests - Improved signal to noise ratio for caseless.t. - Added test count markers to nibbler.t.cpp. --- test/caseless.t | 29 +++++++++-------------------- test/nibbler.t.cpp | 6 +++--- 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/test/caseless.t b/test/caseless.t index 9871616cc..d9af12d0e 100755 --- a/test/caseless.t +++ b/test/caseless.t @@ -28,7 +28,7 @@ use strict; use warnings; -use Test::More tests => 23; +use Test::More tests => 18; # Create the rc file. if (open my $fh, '>', 'caseless.rc') @@ -41,12 +41,11 @@ if (open my $fh, '>', 'caseless.rc') # Attempt case-sensitive and case-insensitive substitutions and filters. qx{../src/task rc:caseless.rc add one two three}; qx{../src/task rc:caseless.rc 1 annotate four five six}; -my $output; # Description substitution. # 2 qx{../src/task rc:caseless.rc rc.search.case.sensitive:yes 1 modify /One/ONE/}; -$output = qx{../src/task rc:caseless.rc info 1}; +my $output = qx{../src/task rc:caseless.rc info 1}; unlike ($output, qr/One two three/, 'one two three\nfour five six -> /One/ONE/ = fail'); # 3 @@ -120,23 +119,13 @@ $output = qx{../src/task rc:caseless.rc rc.search.case.sensitive:no ls descripti like ($output, qr/four five six/, 'one two three\nfour five six -> ls description.contains:Six caseless = succeed'); # Cleanup. -unlink 'pending.data'; -ok (!-r 'pending.data', 'Removed pending.data'); - -unlink 'completed.data'; -ok (!-r 'completed.data', 'Removed completed.data'); - -unlink 'undo.data'; -ok (!-r 'undo.data', 'Removed undo.data'); - -unlink 'backlog.data'; -ok (!-r 'backlog.data', 'Removed backlog.data'); - -unlink 'synch.key'; -ok (!-r 'synch.key', 'Removed synch.key'); - -unlink 'caseless.rc'; -ok (!-r 'caseless.rc', 'Removed caseless.rc'); +unlink qw(pending.data completed.data undo.data backlog.data synch.key caseless.rc); +ok (! -r 'pending.data' && + ! -r 'completed.data' && + ! -r 'undo.data' && + ! -r 'backlog.data' && + ! -r 'synch_key.data' && + ! -r 'caseless.rc', 'Cleanup'); exit 0; diff --git a/test/nibbler.t.cpp b/test/nibbler.t.cpp index b4ad2e9db..3ba7b0a32 100644 --- a/test/nibbler.t.cpp +++ b/test/nibbler.t.cpp @@ -58,7 +58,7 @@ int main (int argc, char** argv) t.notok (n.skipAllOneOf ("abc"), "trivial: skipAllOneOf"); t.notok (n.getQuoted ('"', s), "trivial: getQuoted"); t.notok (n.getDigit (i), "trivial: getDigit"); - t.notok (n.getInt (i), "trivial: getInt"); + t.notok (n.getInt (i), "trivial: getInt"); // 10 t.notok (n.getHex (i), "trivial: getHex"); t.notok (n.getUnsignedInt (i), "trivial: getUnsignedInt"); t.notok (n.getUntilEOL (s), "trivial: getUntilEOL"); @@ -72,7 +72,7 @@ int main (int argc, char** argv) t.diag ("Nibbler::getUntil"); n = Nibbler ("one two"); t.ok (n.getUntil (' ', s), " 'one two' : getUntil (' ') -> true"); - t.is (s, "one", " 'one two' : getUntil (' ') -> 'one'"); + t.is (s, "one", " 'one two' : getUntil (' ') -> 'one'"); // 20 t.ok (n.getUntil (' ', s), " ' two' : getUntil (' ') -> true"); t.is (s, "", " ' two' : getUntil (' ') -> ''"); t.ok (n.skip (' '), " ' two' : skip (' ') -> true"); @@ -88,7 +88,7 @@ int main (int argc, char** argv) n = Nibbler ("one two"); t.ok (n.getUntilRx ("e", s), " 'one two' : getUntilRx ('e') -> true"); - t.is (s, "on", " 'one two' : getUntilRx ('e') -> 'on'"); + t.is (s, "on", " 'one two' : getUntilRx ('e') -> 'on'"); // 30 t.ok (n.getUntilRx ("tw", s), " 'e two' : getUntilRx ('tw') -> true"); t.is (s, "e ", " 'e two' : getUntilRx ('tw') -> 'e '"); t.ok (n.getUntilRx ("$", s), " 'two' : getUntilRx ('$') -> true");