Unit tests

- Removed tests for features deprecated in previous release.
This commit is contained in:
Paul Beckingham 2013-10-19 15:25:54 -04:00
parent 3caf05b0c1
commit ac1d79048d
4 changed files with 0 additions and 749 deletions

View file

@ -1,139 +0,0 @@
#! /usr/bin/env perl
################################################################################
## taskwarrior - a command line task list manager.
##
## Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software is
## furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be included
## in all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
## SOFTWARE.
##
## http://www.opensource.org/licenses/mit-license.php
##
################################################################################
use strict;
use warnings;
use Test::More tests => 19;
use File::Copy;
use constant false => 0;
use constant true => 1;
# Create data locations
mkdir("local", 0755);
ok(-e 'local', "Created directory local");
mkdir("remote", 0755);
ok(-e 'remote', "Created directory remote");
# Create the rc files.
if (open my $fh, '>', 'local.rc')
{
print $fh "data.location=./local\n",
"confirmation=no\n",
"merge.autopush=no\n",
"report.list.description=DESC\n",
"report.list.columns=id,project,active,priority,description,tags\n",
"report.list.labels=id,pro,a,pri,d,t\n",
"report.list.sort=id+\n",
"report.list.filter=status:pending depends.none:\n";
close $fh;
ok (-r 'local.rc', 'Created local.rc');
}
if (open my $fh, '>', 'remote.rc')
{
print $fh "data.location=./remote\n",
"confirmation=no\n",
"merge.autopush=no\n",
"report.list.description=DESC\n",
"report.list.columns=id,project,active,priority,description,tags\n",
"report.list.labels=id,pro,a,pri,d,t\n",
"report.list.sort=id+\n",
"report.list.filter=status:pending depends.none:\n";
close $fh;
ok (-r 'remote.rc', 'Created remote.rc');
}
# Create some basic tasks on both sides
qx{../src/task rc:local.rc add both};
qx{faketime -f '+1s' ../src/task rc:local.rc add blocked};
qx{faketime -f '+2s' ../src/task rc:local.rc add blocking};
qx{faketime -f '+3s' ../src/task rc:local.rc 2 dep:3};
# run gc
qx{../src/task rc:remote.rc};
# push to remote
qx{../src/task rc:local.rc push ./remote/};
# make remote modifications
#qx{faketime -f '+10s' ../src/task rc:remote.rc add right};
qx{faketime -f '+11s' ../src/task rc:remote.rc done 3}; #blocking
# run gc
qx{../src/task rc:remote.rc};
my $output_l = qx{../src/task rc:local.rc merge remote/};
#check output
unlike ($output_l, qr/Missing/, "merge: no missing entry");
unlike ($output_l, qr/Not adding duplicate/, "merge: no duplicates");
# check reports
my $report_l = qx{../src/task rc:local.rc};
like ($report_l, qr/blocked/, 'merge: "blocked" pending');
unlike ($report_l, qr/blocking/, 'merge: "blocking" not pending');
$report_l = qx{../src/task rc:local.rc blocked};
unlike ($report_l, qr/blocked/, 'merge: "blocked" unblocked');
#exit
# Cleanup.
unlink 'local/pending.data';
ok (!-r 'local/pending.data', 'Removed local/pending.data');
unlink 'local/completed.data';
ok (!-r 'local/completed.data', 'Removed local/completed.data');
unlink 'local/undo.data';
ok (!-r 'local/undo.data', 'Removed local/undo.data');
unlink 'local.rc';
ok (!-r 'local.rc', 'Removed local.rc');
unlink 'remote/pending.data';
ok (!-r 'remote/pending.data', 'Removed remote/pending.data');
unlink 'remote/completed.data';
ok (!-r 'remote/completed.data', 'Removed remote/completed.data');
unlink 'remote/undo.data';
ok (!-r 'remote/undo.data', 'Removed remote/undo.data');
unlink 'remote.rc';
ok (!-r 'remote.rc', 'Removed remote.rc');
rmdir("remote");
ok (!-e "remote", "Removed dir remote");
rmdir("local");
ok (!-e "local", "Removed dir local");
exit 0;

View file

@ -1,221 +0,0 @@
#! /usr/bin/env perl
################################################################################
## taskwarrior - a command line task list manager.
##
## Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software is
## furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be included
## in all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
## SOFTWARE.
##
## http://www.opensource.org/licenses/mit-license.php
##
################################################################################
use strict;
use warnings;
use Test::More tests => 31;
use File::Copy;
use File::Path;
use constant false => 0;
use constant true => 1;
# Create data locations
mkdir("data1", 0755);
mkdir("data2", 0755);
mkdir("data3", 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");
# Create the rc files.
if (open my $fh, '>', '1.rc')
{
print $fh "data.location=./data1\n",
"confirmation=no\n",
"merge.autopush=yes\n",
"merge.default.uri=./backup/\n",
"report.list.description=DESC\n",
"report.list.columns=id,project,active,priority,description,tags\n",
"report.list.labels=id,pro,a,pri,d,t\n",
"report.list.sort=id+\n",
"report.list.filter=status:pending\n";
close $fh;
ok (-r '1.rc', 'Created 1.rc');
}
# Create the rc files.
if (open my $fh, '>', '2.rc')
{
print $fh "data.location=./data2\n",
"confirmation=no\n",
"merge.autopush=yes\n",
"merge.default.uri=./backup/\n",
"report.list.description=DESC\n",
"report.list.columns=id,project,active,priority,description,tags\n",
"report.list.labels=id,pro,a,pri,d,t\n",
"report.list.sort=id+\n",
"report.list.filter=status:pending\n";
close $fh;
ok (-r '2.rc', 'Created 2.rc');
}
# Create the rc files.
if (open my $fh, '>', '3.rc')
{
print $fh "data.location=./data3\n",
"confirmation=no\n",
"merge.autopush=yes\n",
"merge.default.uri=./backup/\n",
"report.list.description=DESC\n",
"report.list.columns=id,project,active,priority,description,tags\n",
"report.list.labels=id,pro,a,pri,d,t\n",
"report.list.sort=id+\n",
"report.list.filter=status:pending\n";
close $fh;
ok (-r '3.rc', 'Created 3.rc');
}
#######################################
# Create tasks on 1st resource
qx{../src/task rc:1.rc add Task1 2>&1};
diag ("7 second delay");
sleep(1);
qx{../src/task rc:1.rc add Task2 2>&1};
sleep(1);
qx{../src/task rc:1.rc add Task3 2>&1};
sleep(1);
qx{../src/task rc:1.rc add Task4 2>&1};
# Merge with backup
my $output = qx{../src/task rc:1.rc push ./backup/ 2>&1};
#######################################
# Modify on 2nd resource
# first merge
$output = qx{../src/task rc:2.rc merge 2>&1};
like ($output, qr/Merge complete/, "res2: pre-merge completed");
# complete Task1
qx{../src/task rc:2.rc 1 done 2>&1};
sleep(1);
#######################################
# Modify on 3rd resource
# first merge
$output = qx{../src/task rc:3.rc merge 2>&1};
like ($output, qr/Merge complete/, "res3: pre-merge completed");
# complete Task1
qx{../src/task rc:3.rc 1 done 2>&1};
sleep(1);
# now merge 3rd resource
$output = qx{../src/task rc:3.rc merge 2>&1};
like ($output, qr/Merge complete/, "res3: post-merge completed");
unlike ($output, qr/Missing/, "no missing entry");
# and merge 2nd resource
$output = qx{../src/task rc:2.rc merge 2>&1};
like ($output, qr/Merge complete/, "res2: post-merge completed");
unlike ($output, qr/Missing/, "no missing entry");
# merge 3rd
$output = qx{../src/task rc:3.rc merge 2>&1};
like ($output, qr/Merge complete/, "res3: post-merge completed");
unlike ($output, qr/Missing/, "no missing entry");
like ($output, qr/Retain/, "retained changes"); # 16
# pre-merge 1st
$output = qx{../src/task rc:1.rc merge 2>&1};
like ($output, qr/Merge complete/, "res1: pre-merge completed"); # 17
unlike ($output, qr/Missing/, "no missing entry");
qx{../src/task rc:1.rc add Task5 2>&1};
sleep(1);
qx{../src/task rc:1.rc 4 done 2>&1};
sleep(1);
# merge
$output = qx{../src/task rc:1.rc merge 2>&1};
like ($output, qr/Merge complete/, "res1: post-merge completed");
unlike ($output, qr/Missing/, "no missing entry");
# pre-merge 2nd res
$output = qx{../src/task rc:2.rc merge 2>&1};
like ($output, qr/Merge complete/, "res2: pre-merge completed");
unlike ($output, qr/Missing/, "no missing entry");
# merge
$output = qx{../src/task rc:1.rc merge 2>&1};
like ($output, qr/up-to-date/, "res1: up-to-date");
unlike ($output, qr/Missing/, "no missing entry");
# pre-merge 2nd res
$output = qx{../src/task rc:2.rc merge 2>&1};
like ($output, qr/up-to-date/, "res2: up-to-date");
unlike ($output, qr/Missing/, "no missing entry");
# Cleanup.
unlink qw(data1/pending.data data1/completed.data data1/undo.data data1/undo.save data1/backlog.data data1/ 1.rc);
ok (! -r 'data1/pending.data' &&
! -r 'data1/completed.data' &&
! -r 'data1/undo.data' &&
! -r 'data1/undo.save' &&
! -r 'data1/backlog.data' &&
! -r '1.rc', 'data1 Cleanup');
unlink qw(data2/pending.data data2/completed.data data2/undo.data data2/undo.save data2/backlog.data 2.rc);
ok (! -r 'data2/pending.data' &&
! -r 'data2/completed.data' &&
! -r 'data2/undo.data' &&
! -r 'data2/undo.save' &&
! -r 'data2/backlog.data' &&
! -r '2.rc', 'data2 Cleanup');
unlink qw(data3/pending.data data3/completed.data data3/undo.data data3/undo.save data3/backlog.data 3.rc);
ok (! -r 'data3/pending.data' &&
! -r 'data3/completed.data' &&
! -r 'data3/undo.data' &&
! -r 'data3/undo.save' &&
! -r 'data3/backlog.data' &&
! -r '3.rc', 'data3 Cleanup');
unlink qw(backup/pending.data backup/completed.data backup/undo.data backup/undo.save backup/backlog.data);
ok (! -r 'backup/pending.data' &&
! -r 'backup/completed.data' &&
! -r 'backup/undo.data' &&
! -r 'backup/undo.save' &&
! -r 'backup/backlog.data');
rmtree (['data1/extensions', 'data1', 'data2/extensions', 'data2', 'data3/extensions', 'data3', 'backup/extensions', 'backup'], 0, 1);
ok (! -e 'data1/extensions' &&
! -e 'data1' &&
! -e 'data2/extensions' &&
! -e 'data2' &&
! -e 'data3/extensions' &&
! -e 'data3' &&
! -e 'backup/extensions' &&
! -e 'backup', 'Removed dir local');
exit 0;

View file

@ -1,133 +0,0 @@
#! /usr/bin/env perl
################################################################################
## taskwarrior - a command line task list manager.
##
## Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software is
## furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be included
## in all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
## SOFTWARE.
##
## http://www.opensource.org/licenses/mit-license.php
##
################################################################################
use strict;
use warnings;
use File::Copy;
use File::Path;
use Test::More tests => 16;
mkdir("1", 0755);
mkdir("2", 0755);
mkdir("dropbox", 0755);
ok (-e "1", 'Created directory 1/');
ok (-e "2", 'Created directory 2/');
ok (-e "dropbox", 'Created directory dropbox/');
# Create the rc file.
if (open my $fh, '>', '1.rc')
{
print $fh "data.location=1/\n";
print $fh "confirmation=no\n";
print $fh "merge.autopush=yes\n";
print $fh "merge.default.uri=./dropbox/\n";
print $fh "push.default.uri=./dropbox/\n";
print $fh "pull.default.uri=./dropbox/\n";
close $fh;
ok (-r '1.rc', 'Created 1.rc');
}
# Create the rc file.
if (open my $fh, '>', '2.rc')
{
print $fh "data.location=2/\n";
print $fh "confirmation=no\n";
print $fh "merge.autopush=yes\n";
print $fh "merge.default.uri=./dropbox/\n";
print $fh "push.default.uri=./dropbox/\n";
print $fh "pull.default.uri=./dropbox/\n";
close $fh;
ok (-r '2.rc', 'Created 2.rc');
}
# Once-only push from 1 --> dropbox
my $output = qx{../src/task rc:1.rc add one 2>&1};
ok ($? == 0, 'Exit status check');
$output = qx{../src/task rc:1.rc push 2>&1};
ok ($? == 0, 'Exit status check');
# Merges to 2
$output = qx{../src/task rc:2.rc merge 2>&1};
ok ($? == 0, 'Exit status check');
# Add a task to 1
$output = qx{../src/task rc:1.rc add two 2>&1};
ok ($? == 0, 'Exit status check');
# Add with a later timestamp to 2
qx{sleep 1};
$output = qx{../src/task rc:2.rc add three 2>&1};
ok ($? == 0, 'Exit status check');
# Only completing this task triggers duplications
$output = qx{../src/task rc:2.rc three done 2>&1};
ok ($? == 0, 'Exit status check');
# Merge/update the dropbox
$output = qx{../src/task rc:2.rc merge 2>&1};
ok ($? == 0, 'Exit status check');
# Merge to 1, which means that the new task on 1
# will be inserted before the modifications of 2
$output = qx{../src/task rc:1.rc merge 2>&1};
ok ($? == 0, 'Exit status check');
# Merging to 2 now triggers the duplications because
# both sides have exactly the same modifications
# (creation and deletion of a task) after
# the branch point
$output = qx{../src/task rc:2.rc merge 2>&1};
ok ($? == 0, 'Exit status check');
# Cleanup.
unlink qw(1.rc 1/pending.data 1/completed.data 1/undo.data 1/backlog.data 1/synch.key 2/pending.data 2/completed.data 2/undo.data 2.rc 2/backlog.data 2/synch.key dropbox/completed.data dropbox/pending.data dropbox/undo.data);
ok (! -r '1/pending.data' &&
! -r '1/completed.data' &&
! -r '1/undo.data' &&
! -r '1/backlog.data' &&
! -r '1/synch.key' &&
! -r '1.rc' &&
! -r '2/pending.data' &&
! -r '2/completed.data' &&
! -r '2/undo.data' &&
! -r '2/backlog.data' &&
! -r '2/synch.key' &&
! -r '2.rc' &&
! -r 'dropbox/pending.data' &&
! -r 'dropbox/completed.data' &&
! -r 'dropbox/undo.data' , 'Cleanup');
rmtree (['1', '2', 'dropbox'], 0, 1);
ok (! -e '1' &&
! -e '2' &&
! -e 'dropbox', 'Removed directories');
exit 0;

View file

@ -1,256 +0,0 @@
#! /usr/bin/env perl
################################################################################
## taskwarrior - a command line task list manager.
##
## Copyright 2006-2013, Paul Beckingham, Federico Hernandez.
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
## copies of the Software, and to permit persons to whom the Software is
## furnished to do so, subject to the following conditions:
##
## The above copyright notice and this permission notice shall be included
## in all copies or substantial portions of the Software.
##
## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
## SOFTWARE.
##
## http://www.opensource.org/licenses/mit-license.php
##
################################################################################
use strict;
use warnings;
use Test::More tests => 33;
use File::Copy;
use File::Path;
use constant false => 0;
use constant true => 1;
# Create data locations
mkdir("local", 0755);
ok(-e 'local', "Created directory local");
mkdir("remote", 0755);
ok(-e 'remote', "Created directory remote");
# Create the rc files.
if (open my $fh, '>', 'local.rc')
{
print $fh "data.location=./local\n",
"confirmation=no\n",
"merge.autopush=no\n",
"report.list.description=DESC\n",
"report.list.columns=id,project,start.active,priority,description,tags\n",
"report.list.labels=id,pro,a,pri,d,t\n",
"report.list.sort=id+\n",
"report.list.filter=status:pending\n";
close $fh;
ok (-r 'local.rc', 'Created local.rc');
}
if (open my $fh, '>', 'remote.rc')
{
print $fh "data.location=./remote\n",
"confirmation=no\n",
"merge.autopush=no\n",
"report.list.description=DESC\n",
"report.list.columns=id,project,start.active,priority,description,tags\n",
"report.list.labels=id,pro,a,pri,d,t\n",
"report.list.sort=id+\n",
"report.list.filter=status:pending\n";
close $fh;
ok (-r 'remote.rc', 'Created remote.rc');
}
# Create some basic tasks on both sides
qx{../src/task rc:local.rc add left_modified 2>&1};
diag ("25 second delay");
sleep 1;
qx{../src/task rc:local.rc add right_modified 2>&1};
sleep 1;
qx{../src/task rc:local.rc add left_newer 2>&1};
sleep 1;
qx{../src/task rc:local.rc add right_newer 2>&1};
sleep 1;
qx{../src/task rc:local.rc add left_deleted 2>&1};
sleep 1;
qx{../src/task rc:local.rc add right_deleted 2>&1};
sleep 1;
qx{../src/task rc:local.rc add left_completed 2>&1};
sleep 1;
qx{../src/task rc:local.rc add right_completed 2>&1};
sleep 1;
copy ("local/undo.data", "remote/undo.data");
copy ("local/pending.data", "remote/pending.data");
copy ("local/completed.data", "remote/completed.data");
# make local modifications
qx{../src/task rc:local.rc add left_added 2>&1}; #left_added
sleep 1;
qx{../src/task rc:local.rc 1 modify prio:H 2>&1}; #left_modified
sleep 1;
qx{../src/task rc:local.rc 3 modify +stay 2>&1}; #left_newer
sleep 1;
qx{../src/task rc:local.rc 4 modify project:test 2>&1}; #right_newer
sleep 1;
qx{../src/task rc:local.rc 6 modify +delete 2>&1}; #right_deleted
sleep 1;
# make remote modifications
qx{../src/task rc:remote.rc add right_added 2>&1}; #right_added
sleep 1;
qx{../src/task rc:remote.rc 2 modify prio:L 2>&1}; #right_modified
sleep 1;
qx{../src/task rc:remote.rc 2 modify wait:tomorrow 2>&1}; #right_modified
sleep 1;
qx{../src/task rc:remote.rc 4 modify proj:realProject 2>&1}; #right_newer
sleep 1;
qx{../src/task rc:remote.rc 5 modify project:deletion 2>&1}; #left_deleted
sleep 1;
qx{../src/task rc:remote.rc 8 done 2>&1}; #right_completed
sleep 1;
qx{../src/task rc:remote.rc 6 del 2>&1}; #right_deleted
sleep 1;
qx{../src/task rc:remote.rc 3 done 2>&1}; #left_newer
sleep 1;
# make new local modifications
qx{../src/task rc:local.rc 3 start 2>&1}; #left_newer
sleep 1;
qx{../src/task rc:local.rc 4 modify +car 2>&1}; #right_newer
sleep 1;
qx{../src/task rc:local.rc 7 done 2>&1}; #left_completed
sleep 1;
qx{../src/task rc:local.rc 5 del 2>&1}; #left_deleted
sleep 1;
# make new remote modifications
qx{../src/task rc:remote.rc 4 modify +gym 2>&1}; # right_newer
# merge remote into local
copy ("local/undo.data", "local/undo.save");
my $output_l = qx{../src/task rc:local.rc merge remote/ 2>&1};
#check output
unlike ($output_l, qr/Missing/, "local-merge: no missing entry");
unlike ($output_l, qr/Not adding duplicate/, "local-merge: no duplicates");
# merge local into remote
my $output_r = qx{../src/task rc:remote.rc merge local/undo.save 2>&1};
# check output
unlike ($output_r, qr/Missing/, "remote-merge: no missing entry");
unlike ($output_r, qr/Not adding duplicate/, "remote-merge: no duplicates");
# check reports
my $report_l = qx{../src/task rc:local.rc list 2>&1};
my $report_r = qx{../src/task rc:remote.rc list 2>&1};
# local-merge
like ($report_l, qr/left_added/, "local-merge: left_added is present");
like ($report_l, qr/right_added/, "local-merge: right_added is present");
like ($report_l, qr/H.*left_modified/, "local-merge: left_modified ok");
like ($report_l, qr/\*.*left_newer.*stay/, "local-merge: left_newer ok, undo-completed");
like ($report_l, qr/realProject.*right_newer.*gym/, "local-merge: right_newer ok");
$report_l = qx{../src/task rc:local.rc export 2>&1};
like ($report_l, qr/left_deleted.*deleted/, "local-merge: left_deleted ok");
like ($report_l, qr/right_deleted.*deleted/, "local-merge: right_deleted ok");
like ($report_l, qr/left_completed.*completed/, "local-merge: left_completed ok");
like ($report_l, qr/right_completed.*completed/, "local-merge: right_completed ok");
$report_l = qx{../src/task rc:local.rc waiting 2>&1};
like ($report_l, qr/L.*right_modified/, "local-merge: right_modified ok");
# remote-merge
like ($report_r, qr/left_added/, "remote-merge: left_added is present");
like ($report_r, qr/right_added/, "remote-merge: right_added is present");
like ($report_r, qr/H.*left_modified/, "remote-merge: left_modified ok");
like ($report_r, qr/\*.*left_newer.*stay/, "remote-merge: left_newer ok");
like ($report_r, qr/realProject.*right_newer.*gym/, "remote-merge: right_newer ok");
$report_r = qx{../src/task rc:remote.rc export 2>&1};
like ($report_r, qr/left_deleted.*deleted/, "remote-merge: left_deleted ok");
like ($report_r, qr/right_deleted.*deleted/, "remote-merge: right_deleted ok");
like ($report_r, qr/left_completed.*completed/, "remote-merge: left_completed ok");
like ($report_r, qr/right_completed.*completed/, "remote-merge: right_completed ok");
$report_r = qx{../src/task rc:remote.rc waiting 2>&1};
like ($report_r, qr/L.*right_modified/, "remote-merge: right_modified ok");
# check timestamps in undo.data
my $good = true;
if (open my $fh, 'local/undo.data') {
my $lasttime = 0;
while (!eof($fh)) {
if (defined ($_ = <$fh>)) {
if ($_ =~ m/^time (\d+)/) {
my $time = $1 + 0;
if ($time <= $lasttime) {
fail ("timestamps in local/undo.data are not monotonically ordered");
$good = false;
}
$lasttime = $time;
}
}
}
close $fh;
} else {
fail ("could not open local/undo.data");
}
ok ($good, "local-merge: timestamps ok");
$good = true;
if (open my $fh, 'remote/undo.data') {
my $lasttime = 0;
while (!eof($fh)) {
if (defined ($_ = <$fh>)) {
if ($_ =~ m/^time (\d+)/) {
my $time = $1 + 0;
if ($time <= $lasttime) {
fail ("timestamps in remote/undo.data are not monotonically ordered");
$good = false;
}
$lasttime = $time;
}
}
}
close $fh;
} else {
fail ("could not open remote/undo.data");
}
ok ($good, "remote-merge: timestamps ok");
# Cleanup.
unlink qw(local/pending.data local/completed.data local/undo.data local/undo.save local/backlog.data local.rc);
ok (! -r 'local/pending.data' &&
! -r 'local/completed.data' &&
! -r 'local/undo.data' &&
! -r 'local/undo.save' &&
! -r 'local/backlog.data' &&
! -r 'local.rc', 'Local Cleanup');
unlink qw(remote/pending.data remote/completed.data remote/undo.data remote/backlog.data remote.rc);
ok (! -r 'remote/pending.data' &&
! -r 'remote/completed.data' &&
! -r 'remote/undo.data' &&
! -r 'remote/backlog.data' &&
! -r 'remote.rc', 'Remove Cleanup');
rmtree (['remote/extensions', 'remote', 'local/extensions', 'local'], 0, 1);
ok (! -e 'remote/extensions' &&
! -e 'remote' &&
! -e 'local/extensions' &&
! -e 'local', 'Removed dir local');
exit 0;