Unit tests

- The dependencies.t unit test script failed to unlink completed.data,
  which polluted the subsequent test script.
- Simplified some Perl in start.t.
- Allowed for line wrapping in start.t.
This commit is contained in:
Paul Beckingham 2010-08-02 17:56:34 -04:00
parent e090f556da
commit db27328558
3 changed files with 12 additions and 10 deletions

View file

@ -32,7 +32,7 @@ use Test::More tests => 31;
# Create the rc file.
if (open my $fh, '>', 'dep.rc')
{
{
print $fh "data.location=.\n";
print $fh "dependency.confirm=yes\n";
print $fh "report.depreport.columns=id,depends,description\n";
@ -190,6 +190,9 @@ like ($output, qr/\s1\s+One\s*\n\s2\s+Four\s*\n\s3\s+2\s+Five/, 'dependencies -
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');

View file

@ -49,7 +49,6 @@ if (open my $fh, '<', './export.txt')
@lines = <$fh>;
close $fh;
}
like ($lines[0], qr/^%YAML 1.1$/, 'export.yaml line 0');
like ($lines[1], qr/^---$/, 'export.yaml line 1');
like ($lines[2], qr/^ task:$/, 'export.yaml line 2');

View file

@ -68,8 +68,8 @@ 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";
print $fh "data.location=.\n",
"journal.time=on\n";
close $fh;
ok (-r 'start2.rc', 'Created start2.rc');
}
@ -85,21 +85,21 @@ 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";
print $fh "data.location=.\n",
"journal.time=on\n",
"journal.time.start.annotation=Nu kör vi\n",
"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');
like ($output, qr/Nu.+kör.+vi/ms, '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');
like ($output, qr/Nu.+stannar.+vi/ms, 'one stopped and annotated with custom description');
# Cleanup.
ok (-r 'pending.data', 'Need to remove pending.data');