Feature #189 - annotation of start and stop times

- task can now record the invocation of the 'start' and 'stop'
  command as an annotation by setting journal.time to yes.
- the annoatation test can be customized with
  journal.time.start.annoation and
  journal.time.stop.annotation
This commit is contained in:
Federico Hernandez
2010-07-20 20:19:34 +02:00
parent 5ac0bd3800
commit 942f665d71
6 changed files with 84 additions and 10 deletions

View File

@@ -28,7 +28,7 @@
use strict;
use warnings;
use Test::More tests => 14;
use Test::More tests => 23;
# Create the rc file.
if (open my $fh, '>', 'start.rc')
@@ -61,6 +61,46 @@ $output = qx{../task rc:start.rc active};
unlike ($output, qr/one/, 'one not active');
unlike ($output, qr/two/, 'two not active');
qx{../task rc:start.rc done 2};
$output = qx{../task rc:start.rc list};
unlike ($output, qr/two/, 'two deleted');
# Create the rc file.
if (open my $fh, '>', 'start2.rc')
{
print $fh "data.location=.\n";
print $fh "journal.time=on\n";
close $fh;
ok (-r 'start2.rc', 'Created start2.rc');
}
qx{../task rc:start2.rc start 1};
$output = qx{../task rc:start2.rc list};
like ($output, qr/Started task/, 'one start and annotated');
qx{../task rc:start2.rc stop 1};
$output = qx{../task rc:start2.rc list};
like ($output, qr/Stopped task/, 'one stopped and annotated');
# Create the rc file.
if (open my $fh, '>', 'start3.rc')
{
print $fh "data.location=.\n";
print $fh "journal.time=on\n";
print $fh "journal.time.start.annotation=Nu kör vi\n";
print $fh "journal.time.stop.annotation=Nu stannar vi\n";
close $fh;
ok (-r 'start3.rc', 'Created start3.rc');
}
qx{../task rc:start3.rc start 1};
$output = qx{../task rc:start3.rc list};
like ($output, qr/Nu kör vi/, 'one start and annotated with custom description');
qx{../task rc:start3.rc stop 1};
$output = qx{../task rc:start3.rc list};
like ($output, qr/Nu stannar vi/, 'one stopped and annotated with custom description');
# Cleanup.
ok (-r 'pending.data', 'Need to remove pending.data');
unlink 'pending.data';
@@ -72,6 +112,10 @@ ok (!-r 'undo.data', 'Removed undo.data');
unlink 'start.rc';
ok (!-r 'start.rc', 'Removed start.rc');
unlink 'start2.rc';
ok (!-r 'start2.rc', 'Removed start2.rc');
unlink 'start3.rc';
ok (!-r 'start3.rc', 'Removed start3.rc');
exit 0;