Unit Tests
- Improved signal to noise ratio for caseless.t. - Added test count markers to nibbler.t.cpp.
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user