- Implemented simple word substitution aliases. This is not the ultimate form
  which will involve the ability to insert arbitrary constructs.  Later.
This commit is contained in:
Paul Beckingham 2014-06-03 00:10:15 -04:00
parent a470e50ee6
commit 1cd09bc87b
7 changed files with 42 additions and 41 deletions

View file

@ -27,7 +27,7 @@
use strict;
use warnings;
use Test::More tests => 3;
use Test::More tests => 5;
# Ensure environment has no influence.
delete $ENV{'TASKDATA'};
@ -38,22 +38,30 @@ if (open my $fh, '>', 'alias.rc')
{
print $fh "data.location=.\n",
"alias.foo=_projects\n",
"alias.bar=foo\n";
"alias.bar=foo\n",
"alias.baz=bar\n",
"alias.qux=baz\n";
close $fh;
}
# Add a task with certain project, then access that task via aliases.
# Add a task with a certain project, then access that task via aliases.
qx{../src/task rc:alias.rc add project:ALIAS foo 2>&1};
my $output = qx{../src/task rc:alias.rc _projects 2>&1};
like ($output, qr/ALIAS/, 'task _projects -> ALIAS');
$output = qx{../src/task rc:alias.rc foo 2>&1};
$output = qx{../src/task rc:alias.rc qux 2>&1};
like ($output, qr/ALIAS/, 'task foo -> _projects -> ALIAS');
$output = qx{../src/task rc:alias.rc bar 2>&1};
like ($output, qr/ALIAS/, 'task bar -> foo -> _projects -> ALIAS');
$output = qx{../src/task rc:alias.rc baz 2>&1};
like ($output, qr/ALIAS/, 'task baz -> bar -> foo -> _projects -> ALIAS');
$output = qx{../src/task rc:alias.rc qux 2>&1};
like ($output, qr/ALIAS/, 'task qux -> baz -> bar -> foo -> _projects -> ALIAS');
# Cleanup.
unlink qw(pending.data completed.data undo.data backlog.data alias.rc);
exit 0;