mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Unit Tests
- Minor bug fixes.
This commit is contained in:
parent
e2d0126415
commit
d1bc46c355
4 changed files with 34 additions and 54 deletions
|
@ -28,15 +28,15 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 10;
|
use Test::More tests => 5;
|
||||||
|
|
||||||
# Create the rc file.
|
# Create the rc file.
|
||||||
if (open my $fh, '>', 'bug_concat.rc')
|
if (open my $fh, '>', 'bug.rc')
|
||||||
{
|
{
|
||||||
print $fh "data.location=.\n",
|
print $fh "data.location=.\n",
|
||||||
"confirmation=no\n";
|
"confirmation=no\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'bug_concat.rc', 'Created bug_concat.rc');
|
ok (-r 'bug.rc', 'Created bug.rc');
|
||||||
}
|
}
|
||||||
|
|
||||||
# When a task is modified like this:
|
# When a task is modified like this:
|
||||||
|
@ -47,12 +47,12 @@ if (open my $fh, '>', 'bug_concat.rc')
|
||||||
#
|
#
|
||||||
# Thisisanewdescription
|
# Thisisanewdescription
|
||||||
|
|
||||||
qx{../src/task rc:bug_concat.rc add This is the original text};
|
qx{../src/task rc:bug.rc add This is the original text};
|
||||||
my $output = qx{../src/task rc:bug_concat.rc info 1};
|
my $output = qx{../src/task rc:bug.rc info 1};
|
||||||
like ($output, qr/Description\s+This is the original text/, 'original correct');
|
like ($output, qr/Description\s+This is the original text/, 'original correct');
|
||||||
|
|
||||||
qx{../src/task rc:bug_concat.rc 1 modify This is the modified text};
|
qx{../src/task rc:bug.rc 1 modify This is the modified text};
|
||||||
$output = qx{../src/task rc:bug_concat.rc info 1};
|
$output = qx{../src/task rc:bug.rc info 1};
|
||||||
like ($output, qr/Description\s+This is the modified text\n/, 'modified correct');
|
like ($output, qr/Description\s+This is the modified text\n/, 'modified correct');
|
||||||
|
|
||||||
# When a task is added like this:
|
# When a task is added like this:
|
||||||
|
@ -63,28 +63,18 @@ like ($output, qr/Description\s+This is the modified text\n/, 'modified correct'
|
||||||
#
|
#
|
||||||
# aaabbb:ccc ddd
|
# aaabbb:ccc ddd
|
||||||
|
|
||||||
qx{../src/task rc:bug_concat.rc add aaa bbb:ccc ddd};
|
qx{../src/task rc:bug.rc add aaa bbb:ccc ddd};
|
||||||
$output = qx{../src/task rc:bug_concat.rc info 2};
|
$output = qx{../src/task rc:bug.rc info 2};
|
||||||
like ($output, qr/Description\s+aaa bbb:ccc ddd\n/, 'properly concatenated');
|
like ($output, qr/Description\s+aaa bbb:ccc ddd\n/, 'properly concatenated');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink 'pending.data';
|
unlink qw(pending.data completed.data undo.data backlog.data synch.key bug.rc);
|
||||||
ok (!-r 'pending.data', 'Removed pending.data');
|
ok (! -r 'pending.data' &&
|
||||||
|
! -r 'completed.data' &&
|
||||||
unlink 'completed.data';
|
! -r 'undo.data' &&
|
||||||
ok (!-r 'completed.data', 'Removed completed.data');
|
! -r 'backlog.data' &&
|
||||||
|
! -r 'synch_key.data' &&
|
||||||
unlink 'undo.data';
|
! -r 'bug.rc', 'Cleanup');
|
||||||
ok (!-r 'undo.data', 'Removed undo.data');
|
|
||||||
|
|
||||||
unlink 'backlog.data';
|
|
||||||
ok (!-r 'backlog.data', 'Removed backlog.data');
|
|
||||||
|
|
||||||
unlink 'synch.key';
|
|
||||||
ok (!-r 'synch.key', 'Removed synch.key');
|
|
||||||
|
|
||||||
unlink 'bug_concat.rc';
|
|
||||||
ok (!-r 'bug_concat.rc', 'Removed bug_concat.rc');
|
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 9;
|
use Test::More tests => 4;
|
||||||
|
|
||||||
# Create the rc file.
|
# Create the rc file.
|
||||||
if (open my $fh, '>', 'color.rc')
|
if (open my $fh, '>', 'color.rc')
|
||||||
|
@ -51,23 +51,13 @@ like ($output, qr/ (?!<\033\[\d\dm) .* nothing .* (?!>\033\[0m) /x, 'none');
|
||||||
like ($output, qr/ \033\[31m .* red .* \033\[0m /x, 'color.blocked');
|
like ($output, qr/ \033\[31m .* red .* \033\[0m /x, 'color.blocked');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink 'pending.data';
|
unlink qw(pending.data completed.data undo.data backlog.data synch.key color.rc);
|
||||||
ok (!-r 'pending.data', 'Removed pending.data');
|
ok (! -r 'pending.data' &&
|
||||||
|
! -r 'completed.data' &&
|
||||||
unlink 'completed.data';
|
! -r 'undo.data' &&
|
||||||
ok (!-r 'completed.data', 'Removed completed.data');
|
! -r 'backlog.data' &&
|
||||||
|
! -r 'synch_key.data' &&
|
||||||
unlink 'backlog.data';
|
! -r 'color.rc', 'Cleanup');
|
||||||
ok (!-r 'backlog.data', 'Removed backlog.data');
|
|
||||||
|
|
||||||
unlink 'synch.key';
|
|
||||||
ok (!-r 'synch.key', 'Removed synch.key');
|
|
||||||
|
|
||||||
unlink 'undo.data';
|
|
||||||
ok (!-r 'undo.data', 'Removed undo.data');
|
|
||||||
|
|
||||||
unlink 'color.rc';
|
|
||||||
ok (!-r 'color.rc', 'Removed color.rc');
|
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
|
|
@ -36,13 +36,13 @@ use constant false => 0;
|
||||||
use constant true => 1;
|
use constant true => 1;
|
||||||
|
|
||||||
# Create data locations
|
# Create data locations
|
||||||
mkdir("data1", 0755);
|
mkdir("data1", 0755);
|
||||||
ok(-e 'data1', "Created directory data1");
|
mkdir("data2", 0755);
|
||||||
mkdir("data2", 0755);
|
mkdir("data3", 0755);
|
||||||
ok(-e 'data2', "Created directory data2");
|
|
||||||
mkdir("data3", 0755);
|
|
||||||
ok(-e 'data3', "Created directory data3");
|
|
||||||
mkdir('backup', 0755);
|
mkdir('backup', 0755);
|
||||||
|
ok(-e 'data1', "Created directory data1");
|
||||||
|
ok(-e 'data2', "Created directory data2");
|
||||||
|
ok(-e 'data3', "Created directory data3");
|
||||||
ok(-e 'backup', "Created directory backup");
|
ok(-e 'backup', "Created directory backup");
|
||||||
|
|
||||||
# Create the rc files.
|
# Create the rc files.
|
||||||
|
|
|
@ -89,9 +89,9 @@ sleep 1;
|
||||||
qx{../src/task rc:local.rc add right_completed};
|
qx{../src/task rc:local.rc add right_completed};
|
||||||
sleep 1;
|
sleep 1;
|
||||||
|
|
||||||
copy ("local/undo.data", "remote/undo.data") or fail ("copy local/undo.data to remote/undo.data");
|
copy ("local/undo.data", "remote/undo.data");
|
||||||
copy ("local/pending.data", "remote/pending.data") or fail ("copy local/undo.data to remote/undo.data");
|
copy ("local/pending.data", "remote/pending.data");
|
||||||
copy ("local/completed.data", "remote/completed.data") or fail ("copy local/undo.data to remote/undo.data");
|
copy ("local/completed.data", "remote/completed.data");
|
||||||
|
|
||||||
# make local modifications
|
# make local modifications
|
||||||
qx{../src/task rc:local.rc add left_added}; #left_added
|
qx{../src/task rc:local.rc add left_added}; #left_added
|
||||||
|
@ -137,7 +137,7 @@ sleep 1;
|
||||||
qx{../src/task rc:remote.rc 4 modify +gym}; # right_newer
|
qx{../src/task rc:remote.rc 4 modify +gym}; # right_newer
|
||||||
|
|
||||||
# merge remote into local
|
# merge remote into local
|
||||||
copy ("local/undo.data", "local/undo.save") or fail ("copy local/undo.data to local/undo.save");
|
copy ("local/undo.data", "local/undo.save");
|
||||||
my $output_l = qx{../src/task rc:local.rc merge remote/};
|
my $output_l = qx{../src/task rc:local.rc merge remote/};
|
||||||
|
|
||||||
#check output
|
#check output
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue