mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Unit Tests
- Added unit tests to verify that appending or prepending nothing generates an error.
This commit is contained in:
parent
bb24701f36
commit
df652d2ec7
2 changed files with 11 additions and 3 deletions
|
@ -28,7 +28,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 6;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'append.rc')
|
||||
|
@ -38,12 +38,16 @@ if (open my $fh, '>', 'append.rc')
|
|||
ok (-r 'append.rc', 'Created append.rc');
|
||||
}
|
||||
|
||||
# Add a task, then append more decsription.
|
||||
# Add a task, then append more description.
|
||||
qx{../src/task rc:append.rc add foo};
|
||||
qx{../src/task rc:append.rc 1 append bar};
|
||||
my $output = qx{../src/task rc:append.rc info 1};
|
||||
like ($output, qr/Description\s+foo\sbar\n/, 'append worked');
|
||||
|
||||
# Should cause an error when nothing is appended.
|
||||
$output = qx{../src/task rc:append.rc append 1};
|
||||
unlike ($output, qr/Appended 0 tasks/, 'blank append failed');
|
||||
|
||||
# Cleanup.
|
||||
unlink 'pending.data';
|
||||
ok (!-r 'pending.data', 'Removed pending.data');
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 6;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'prepend.rc')
|
||||
|
@ -44,6 +44,10 @@ qx{../src/task rc:prepend.rc 1 prepend foo};
|
|||
my $output = qx{../src/task rc:prepend.rc info 1};
|
||||
like ($output, qr/Description\s+foo\sbar\n/, 'prepend worked');
|
||||
|
||||
# Should cause an error when nothing is appended.
|
||||
$output = qx{../src/task rc:prepend.rc prepend 1};
|
||||
unlike ($output, qr/Prepended 0 tasks/, 'blank prepend failed');
|
||||
|
||||
# Cleanup.
|
||||
unlink 'pending.data';
|
||||
ok (!-r 'pending.data', 'Removed pending.data');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue