From db2732855816eed84ae23dfd92a14ce10597e553 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Mon, 2 Aug 2010 17:56:34 -0400 Subject: [PATCH] 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. --- src/tests/dependencies.t | 5 ++++- src/tests/export.yaml.t | 1 - src/tests/start.t | 16 ++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/tests/dependencies.t b/src/tests/dependencies.t index f2d2baff7..8c3f0aadf 100755 --- a/src/tests/dependencies.t +++ b/src/tests/dependencies.t @@ -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'); diff --git a/src/tests/export.yaml.t b/src/tests/export.yaml.t index de437839d..52d9058a3 100755 --- a/src/tests/export.yaml.t +++ b/src/tests/export.yaml.t @@ -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'); diff --git a/src/tests/start.t b/src/tests/start.t index baf3ca789..2b8e37c84 100755 --- a/src/tests/start.t +++ b/src/tests/start.t @@ -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');