Bug Fix - #382 task annotate doesn't complain when a task id is omitted

- added error msg when annotating without a task id
This commit is contained in:
Federico Hernandez 2010-02-23 22:50:59 +01:00
parent cb1b1510a9
commit a5d8ef524e
3 changed files with 10 additions and 5 deletions

View file

@ -1887,6 +1887,9 @@ int handleAnnotate (std::string &outs)
if (!context.task.has ("description"))
throw std::string ("Cannot apply a blank annotation.");
if (!context.task.has ("id"))
throw std::string ("ID needed to apply an annotation.");
std::stringstream out;
std::vector <Task> tasks;

View file

@ -28,7 +28,7 @@
use strict;
use warnings;
use Test::More tests => 5;
use Test::More tests => 6;
# Create the rc file.
if (open my $fh, '>', 'bug_annotate.rc')
@ -43,6 +43,10 @@ qx{../task rc:bug_annotate.rc add foo};
my $output = qx{../task rc:bug_annotate.rc 1 annotate};
like ($output, qr/Cannot apply a blank annotation./, 'failed on blank annotation');
# Attempt an annotation without ID
$output = qx{../task rc:bug_annotate.rc annotate bar};
like ($output, qr/ID needed to apply an annotation./, 'failed on annotation without ID');
# Cleanup.
unlink 'pending.data';
ok (!-r 'pending.data', 'Removed pending.data');