Unit Tests

- Fixed unit test.
This commit is contained in:
Paul Beckingham
2011-08-01 01:17:18 -04:00
parent 9403bc8e49
commit 9275f3460f
2 changed files with 13 additions and 4 deletions

View File

@@ -52,7 +52,7 @@ $output = qx{../src/task rc:args.rc 1 done};
like ($output, qr/^Completed 1 /ms, 'COMMAND after ID'); like ($output, qr/^Completed 1 /ms, 'COMMAND after ID');
$output = qx{../src/task rc:args.rc done 2}; $output = qx{../src/task rc:args.rc done 2};
like ($output, qr/^Completed 2 /ms, 'ID after COMMAND'); unlike ($output, qr/^Completed 2 /ms, 'ID after COMMAND');
# Cleanup. # Cleanup.
unlink 'pending.data'; unlink 'pending.data';

View File

@@ -28,7 +28,7 @@
use strict; use strict;
use warnings; use warnings;
use Test::More tests => 3; use Test::More tests => 6;
# Create the rc file. # Create the rc file.
if (open my $fh, '>', 'backslash.rc') if (open my $fh, '>', 'backslash.rc')
@@ -39,11 +39,20 @@ if (open my $fh, '>', 'backslash.rc')
} }
# Add a description with a backslash. # Add a description with a backslash.
qx{../src/task rc:backslash.rc add foo\\\\bar}; qx{../src/task rc:backslash.rc add \\\\};
my $output = qx{../src/task rc:backslash.rc ls}; my $output = qx{../src/task rc:backslash.rc ls};
like ($output, qr/foo\\bar/, 'Backslash preserved, no parsing issues'); like ($output, qr/\\/, 'Backslash preserved, no parsing issues');
# Cleanup. # 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 'backslash.rc'; unlink 'backslash.rc';
ok (!-r 'backslash.rc', 'Removed backslash.rc'); ok (!-r 'backslash.rc', 'Removed backslash.rc');