Code Cleanup
- Removed deprecated 'push', 'pull' and 'merge' commands.
This commit is contained in:
@@ -8,8 +8,8 @@ include_directories (${CMAKE_SOURCE_DIR}
|
||||
|
||||
set (test_SRCS autocomplete.t color.t config.t date.t directory.t dom.t
|
||||
old_duration.t file.t i18n.t json.t list.t msg.t nibbler.t path.t
|
||||
rx.t t.t t2.t t3.t taskmod.t tdb2.t text.t tree.t uri.t utf8.t util.t
|
||||
view.t width.t json_test iso8601d.t iso8601p.t duration.t lexer.t
|
||||
rx.t t.t t2.t t3.t tdb2.t text.t tree.t utf8.t util.t view.t
|
||||
width.t json_test iso8601d.t iso8601p.t duration.t lexer.t
|
||||
variant_add.t variant_and.t variant_cast.t variant_divide.t
|
||||
variant_equal.t variant_exp.t variant_gt.t variant_gte.t
|
||||
variant_inequal.t variant_lt.t variant_lte.t variant_match.t
|
||||
|
||||
200
test/bug.1104.t
200
test/bug.1104.t
@@ -1,200 +0,0 @@
|
||||
#! /usr/bin/env perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006-2014, 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 => 33;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
delete $ENV{'TASKRC'};
|
||||
|
||||
mkdir("1", 0755);
|
||||
mkdir("2", 0755);
|
||||
mkdir("3", 0755);
|
||||
mkdir("dropbox", 0755);
|
||||
|
||||
ok (-e "1", 'Created directory 1/');
|
||||
ok (-e "2", 'Created directory 2/');
|
||||
ok (-e "3", 'Created directory 3/');
|
||||
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');
|
||||
}
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', '3.rc')
|
||||
{
|
||||
print $fh "data.location=3/\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 '3.rc', 'Created 3.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 add two 2>&1};
|
||||
ok ($? == 0, 'Exit status check');
|
||||
$output = qx{../src/task rc:1.rc add three 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 and 3
|
||||
$output = qx{../src/task rc:2.rc merge 2>&1};
|
||||
ok ($? == 0, 'Exit status check');
|
||||
$output = qx{../src/task rc:3.rc merge 2>&1};
|
||||
ok ($? == 0, 'Exit status check');
|
||||
|
||||
# Make a different change in both locations
|
||||
$output = qx{../src/task rc:1.rc add four 2>&1};
|
||||
ok ($? == 0, 'Exit status check');
|
||||
$output = qx{../src/task rc:1.rc four done 2>&1};
|
||||
ok ($? == 0, 'Exit status check');
|
||||
$output = qx{../src/task rc:2.rc one done 2>&1};
|
||||
ok ($? == 0, 'Exit status check');
|
||||
$output = qx{../src/task rc:3.rc three delete 2>&1};
|
||||
ok ($? == 0, 'Exit status check');
|
||||
|
||||
# Merges 1 and 2
|
||||
$output = qx{../src/task rc:1.rc merge 2>&1};
|
||||
ok ($? == 0, 'Exit status check');
|
||||
$output = qx{../src/task rc:2.rc merge 2>&1};
|
||||
ok ($? == 0, 'Exit status check');
|
||||
|
||||
# see if undo.data is corrupt
|
||||
$output = qx{cat 2/undo.data};
|
||||
unlike ($output, qr/time 0/, "undo.data corrupt");
|
||||
|
||||
# merge again in order to stimulate duplications
|
||||
$output = qx{../src/task rc:1.rc merge 2>&1};
|
||||
ok ($? == 0, 'Exit status check');
|
||||
$output = qx{../src/task rc:1.rc diag 2>&1};
|
||||
unlike ($output, qr/Found duplicate/, "Found duplicate");
|
||||
|
||||
# Merges 3
|
||||
$output = qx{../src/task rc:3.rc merge 2>&1};
|
||||
ok ($? == 0, 'Exit status check');
|
||||
unlike ($output, qr/Retaining/, "Must not retain changes");
|
||||
|
||||
# Merges 1
|
||||
$output = qx{../src/task rc:1.rc merge 2>&1};
|
||||
ok ($? == 0, 'Exit status check');
|
||||
unlike ($output, qr/Retaining/, "Must not retain changes");
|
||||
|
||||
# Merges 1
|
||||
$output = qx{../src/task rc:2.rc merge 2>&1};
|
||||
ok ($? == 0, 'Exit status check');
|
||||
unlike ($output, qr/Retaining/, "Must not retain changes");
|
||||
|
||||
# now all three instances must be in sync
|
||||
$output = qx{diff 1/undo.data dropbox/undo.data};
|
||||
ok ($? == 0, 'Resource 1 up-to-date check');
|
||||
|
||||
$output = qx{diff 2/undo.data dropbox/undo.data};
|
||||
ok ($? == 0, 'Resource 2 up-to-date check');
|
||||
|
||||
$output = qx{diff 3/undo.data dropbox/undo.data};
|
||||
ok ($? == 0, 'Resource 3 up-to-date check');
|
||||
|
||||
## Merges 3
|
||||
#$output = qx{../src/task rc:3.rc merge 2>&1};
|
||||
#ok ($? == 0, 'Exit status check');
|
||||
#unlike ($output, qr/Retaining/, "Must not retain changes");
|
||||
#
|
||||
## Merges 1
|
||||
#$output = qx{../src/task rc:1.rc merge 2>&1};
|
||||
#ok ($? == 0, 'Exit status check');
|
||||
#unlike ($output, qr/Retaining/, "Must not retain changes");
|
||||
#
|
||||
## Merges 1
|
||||
#$output = qx{../src/task rc:2.rc merge 2>&1};
|
||||
#ok ($? == 0, 'Exit status check');
|
||||
#unlike ($output, qr/Retaining/, "Must not retain changes");
|
||||
|
||||
# Cleanup.
|
||||
unlink qw(1.rc 1/pending.data 1/completed.data 1/undo.data 1/backlog.data 2/pending.data 2/completed.data 2/undo.data 2.rc 2/backlog.data dropbox/completed.data dropbox/pending.data dropbox/undo.data 3/pending.data 3/undo.data 3/completed.data 3/backlog.data 3.rc);
|
||||
ok (! -r '1/pending.data' &&
|
||||
! -r '1/completed.data' &&
|
||||
! -r '1/undo.data' &&
|
||||
! -r '1/backlog.data' &&
|
||||
! -r '1.rc' &&
|
||||
! -r '2/pending.data' &&
|
||||
! -r '2/completed.data' &&
|
||||
! -r '2/undo.data' &&
|
||||
! -r '2/backlog.data' &&
|
||||
! -r '2.rc' &&
|
||||
! -r '3/pending.data' &&
|
||||
! -r '3/completed.data' &&
|
||||
! -r '3/undo.data' &&
|
||||
! -r '3/backlog.data' &&
|
||||
! -r '3.rc' &&
|
||||
! -r 'dropbox/pending.data' &&
|
||||
! -r 'dropbox/completed.data' &&
|
||||
! -r 'dropbox/undo.data' , 'Cleanup');
|
||||
|
||||
rmtree (['1', '2', '3', 'dropbox'], 0, 1);
|
||||
ok (! -e '1' &&
|
||||
! -e '2' &&
|
||||
! -e '3' &&
|
||||
! -e 'dropbox', 'Removed directories');
|
||||
|
||||
exit 0;
|
||||
117
test/bug.1117.t
117
test/bug.1117.t
@@ -1,117 +0,0 @@
|
||||
#! /usr/bin/env perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006-2014, 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 => 13;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
delete $ENV{'TASKRC'};
|
||||
|
||||
mkdir("1", 0755);
|
||||
mkdir("2", 0755);
|
||||
mkdir("merge", 0755);
|
||||
|
||||
ok (-e "1", 'Created directory 1/');
|
||||
ok (-e "2", 'Created directory 2/');
|
||||
ok (-e "merge", 'Created directory merge/');
|
||||
|
||||
# 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=./merge/\n";
|
||||
print $fh "push.default.uri=./merge/\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=./merge/\n";
|
||||
print $fh "push.default.uri=./merge/\n";
|
||||
|
||||
close $fh;
|
||||
ok (-r '2.rc', 'Created 2.rc');
|
||||
}
|
||||
|
||||
# add and push on 1
|
||||
my $output = qx{../src/task rc:1.rc add foo1 2>&1};
|
||||
ok ($? == 0, 'Exit status check');
|
||||
$output = qx{../src/task rc:1.rc push};
|
||||
ok ($? == 0, 'Exit status check');
|
||||
|
||||
# add and merge on 2
|
||||
$output = qx{../src/task rc:2.rc add foo2 2>&1};
|
||||
ok ($? == 0, 'Exit status check');
|
||||
|
||||
$output = qx{../src/task rc:2.rc merge 2>&1};
|
||||
ok ($? == 0, 'Exit status check');
|
||||
|
||||
# merge 1
|
||||
$output = qx{../src/task rc:1.rc merge 2>&1};
|
||||
ok ($? == 0, 'Exit status check');
|
||||
|
||||
# undo.data files must not differ
|
||||
$output = qx{diff 1/undo.data 2/undo.data};
|
||||
ok ($? == 0, 'undo.data diff result');
|
||||
|
||||
# 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 merge/completed.data merge/pending.data merge/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 'merge/pending.data' &&
|
||||
! -r 'merge/completed.data' &&
|
||||
! -r 'merge/undo.data' , 'Cleanup');
|
||||
|
||||
rmtree (['1', '2', 'merge'], 0, 1);
|
||||
ok (! -e '1' &&
|
||||
! -e '2' &&
|
||||
! -e 'merge', 'Removed directories');
|
||||
|
||||
exit 0;
|
||||
@@ -1,72 +0,0 @@
|
||||
#! /usr/bin/env perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006-2014, 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 => 4;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
delete $ENV{'TASKRC'};
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=off\n";
|
||||
close $fh;
|
||||
mkdir("localcopy", 0755);
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Bug 1192 - Push fails with POSIX shell that does not do brace expansion.
|
||||
|
||||
# Test push.
|
||||
qx{../src/task rc:bug.rc add foo 2>&1};
|
||||
# completed.data doesn't get created until required.
|
||||
qx{touch completed.data 2>&1};
|
||||
my $output = qx{../src/task rc:bug.rc push sh+cp://localcopy/ 2>&1};
|
||||
#unlike ($output, qr/_user/ms, '_user in there');
|
||||
unlike ($output, qr/No such file or directory/ms, 'Local push to sh+cp://path/');
|
||||
|
||||
# Test pull.
|
||||
$output = qx{../src/task rc:bug.rc pull sh+cp://localcopy/ 2>&1};
|
||||
unlike ($output, qr/No such file or directory/ms, 'Local pull from sh+cp://path/');
|
||||
|
||||
## Cleanup.
|
||||
unlink qw(pending.data completed.data undo.data backlog.data synch.key bug.rc);
|
||||
qx(rm -rf localcopy/);
|
||||
ok (! -d 'localcopy' &&
|
||||
! -r 'pending.data' &&
|
||||
! -r 'completed.data' &&
|
||||
! -r 'undo.data' &&
|
||||
! -r 'backlog.data' &&
|
||||
! -r 'synch.key' &&
|
||||
! -r 'bug.rc', 'Cleanup');
|
||||
|
||||
exit 0;
|
||||
107
test/bug.580.t
107
test/bug.580.t
@@ -1,107 +0,0 @@
|
||||
#! /usr/bin/env perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006-2014, 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 => 11;
|
||||
use File::Copy;
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
delete $ENV{'TASKRC'};
|
||||
|
||||
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.default.uri=remote/\n",
|
||||
"merge.autopush=yes\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";
|
||||
close $fh;
|
||||
ok (-r 'remote.rc', 'Created remote.rc');
|
||||
}
|
||||
|
||||
# add a remote task
|
||||
qx{../src/task rc:remote.rc add remote task 2>&1};
|
||||
|
||||
# add a local task
|
||||
qx{../src/task rc:local.rc add local task 2>&1};
|
||||
|
||||
# merge and autopush
|
||||
qx{../src/task rc:local.rc merge 2>&1};
|
||||
|
||||
my $output = qx{../src/task rc:remote.rc ls 2>&1};
|
||||
like ($output, qr/local task/, "autopush failed");
|
||||
|
||||
# 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', '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', 'Cleanup');
|
||||
|
||||
rmdir("remote/extensions");
|
||||
ok (!-e "remote/extensions", "Removed dir remote/extensions");
|
||||
|
||||
rmdir("remote");
|
||||
ok (!-e "remote", "Removed dir remote");
|
||||
|
||||
rmdir("local/extensions");
|
||||
ok (!-e "local/extensions", "Removed dir local/extensions");
|
||||
|
||||
rmdir("local");
|
||||
ok (!-e "local", "Removed dir local");
|
||||
|
||||
exit 0;
|
||||
@@ -1,143 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006-2014, 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
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cmake.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <stdlib.h>
|
||||
#include <Context.h>
|
||||
#include <Task.h>
|
||||
#include <Taskmod.h>
|
||||
#include <sys/time.h>
|
||||
#include <test.h>
|
||||
|
||||
Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest t (16);
|
||||
|
||||
// Ensure environment has no influence.
|
||||
unsetenv ("TASKDATA");
|
||||
unsetenv ("TASKRC");
|
||||
|
||||
bool good = true;
|
||||
|
||||
// base timestamp
|
||||
unsigned long timestamp = (unsigned long)time(NULL);
|
||||
timestamp -= timestamp % 100;
|
||||
|
||||
// create some tasks
|
||||
Task tasks[3];
|
||||
|
||||
// base task
|
||||
tasks[0] = Task("[description:\"Desc1\" uuid:\"df95dac3-5f2b-af88-5416-03a3163d00fd\"]");
|
||||
// first modification
|
||||
tasks[1] = tasks[0];
|
||||
tasks[1].addTag("tag1");
|
||||
// second modification
|
||||
tasks[2] = tasks[1];
|
||||
tasks[2].setStatus(Task::completed);
|
||||
|
||||
// create taskmods
|
||||
Taskmod mods[4];
|
||||
mods[0] = Taskmod();
|
||||
mods[0].setTimestamp(timestamp);
|
||||
mods[0].setBefore(tasks[0]);
|
||||
mods[0].setAfter(tasks[1]);
|
||||
|
||||
mods[1] = Taskmod();
|
||||
mods[1].setTimestamp(timestamp + 2);
|
||||
mods[1].setBefore(tasks[1]);
|
||||
mods[1].setAfter(tasks[2]);
|
||||
|
||||
// getUuid() not
|
||||
Taskmod empty = Taskmod();
|
||||
good = true;
|
||||
try {
|
||||
empty.getUuid();
|
||||
} catch (const std::string& e) { t.diag(e); good = false; }
|
||||
t.notok (good, "Taskmod::getUuid() not");
|
||||
|
||||
// issetAfter() not
|
||||
Taskmod newMod = Taskmod();
|
||||
t.notok(newMod.issetAfter(), "Taskmod::issetAfter() not");
|
||||
|
||||
// getUuid()
|
||||
newMod.setAfter(tasks[1]);
|
||||
try {
|
||||
std::string uuid = newMod.getUuid();
|
||||
t.is(uuid, "df95dac3-5f2b-af88-5416-03a3163d00fd", "Taskmod::getUuid()");
|
||||
} catch (const std::string& e) {
|
||||
t.diag(e);
|
||||
t.fail("Taskmod::getUuid()");
|
||||
}
|
||||
|
||||
// isValid() not
|
||||
t.notok(newMod.isValid(), "Taskmod::isValid() not") ;
|
||||
|
||||
// issetBefore() not
|
||||
t.notok(newMod.issetBefore(), "Taskmod::issetBefore() not");
|
||||
|
||||
// isValid()
|
||||
newMod.setTimestamp(timestamp+1);
|
||||
t.ok(newMod.isValid(), "Taskmod::isValid()");
|
||||
|
||||
// isNew()
|
||||
t.ok(newMod.isNew(), "Taskmod::isNew()");
|
||||
|
||||
// issetBefore()
|
||||
newMod.setBefore(tasks[0]);
|
||||
t.ok(newMod.issetBefore(), "Taskmod::issetBefore()");
|
||||
|
||||
// isNew() not
|
||||
t.notok(newMod.isNew(), "Taskmod::isNew() not");
|
||||
|
||||
// <
|
||||
t.ok(mods[0] < newMod, "Taskmod::operator<");
|
||||
t.notok(newMod < mods[0], "Taskmod::operator< not");
|
||||
|
||||
// >
|
||||
t.ok(mods[1] > mods[0], "Taskmod::operator>");
|
||||
t.notok(mods[0] > mods[1], "Taskmod::operator> not");
|
||||
|
||||
// !=
|
||||
t.ok(mods[0] != mods[1], "Taskmod::operator!=" );
|
||||
|
||||
// copy constructor
|
||||
Taskmod clone1 = Taskmod(mods[0]);
|
||||
t.ok(mods[0] == clone1, "Taskmod::Taskmod(const Taskmod&)");
|
||||
|
||||
// =
|
||||
Taskmod clone2 = mods[0];
|
||||
t.ok(mods[0] == clone2, "Taskmod::operator=");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
142
test/uri.t.cpp
142
test/uri.t.cpp
@@ -1,142 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2010 - 2014, Johannes Schlatow.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <cmake.h>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <stdlib.h>
|
||||
#include <Context.h>
|
||||
#include <Uri.h>
|
||||
#include <test.h>
|
||||
|
||||
Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest t (54);
|
||||
|
||||
// Ensure environment has no influence.
|
||||
unsetenv ("TASKDATA");
|
||||
unsetenv ("TASKRC");
|
||||
|
||||
Uri uri1 ("asfd://user@host/folder/");
|
||||
uri1.parse ();
|
||||
t.is (uri1._user, "user", "Uri::parse() : asdf://user@host/folder/");
|
||||
t.is (uri1._host, "host", "Uri::parse() : asdf://user@host/folder/");
|
||||
t.is (uri1._port, "", "Uri::parse() : asdf://user@host/folder/");
|
||||
t.is (uri1._path, "folder/", "Uri::parse() : asdf://user@host/folder/");
|
||||
t.is (uri1._protocol, "asfd", "Uri::parse() : asdf://user@host/folder/");
|
||||
t.ok (uri1.append ("file.test"), "Uri::append() to path");
|
||||
t.is (uri1._path, "folder/file.test", "Uri::append() ok");
|
||||
|
||||
Uri uri2 ("user@host:folder/file.test");
|
||||
uri2.parse ();
|
||||
t.is (uri2._user, "user", "Uri::parse() : user@host:folder/file.test");
|
||||
t.is (uri2._host, "host", "Uri::parse() : user@host:folder/file.test");
|
||||
t.is (uri2._port, "", "Uri::parse() : user@host/folder/file.test");
|
||||
t.is (uri2._path, "folder/file.test", "Uri::parse() : user@host/folder/file.test");
|
||||
t.is (uri2._protocol, "ssh", "Uri::parse() : user@host/folder/file.test");
|
||||
t.notok (uri2.append ("test.dat"), "Uri::append() to file");
|
||||
|
||||
Uri uri3 ("rsync://hostname.abc.de:1234//abs/path");
|
||||
uri3.parse ();
|
||||
t.is (uri3._user, "", "Uri::parse() : rsync://hostname.abc.de:1234//abs/path");
|
||||
t.is (uri3._host, "hostname.abc.de", "Uri::parse() : rsync://hostname.abc.de:1234//abs/path");
|
||||
t.is (uri3._port, "1234", "Uri::parse() : rsync://hostname.abc.de:1234//abs/path");
|
||||
t.is (uri3._path, "/abs/path", "Uri::parse() : rsync://hostname.abc.de:1234//abs/path");
|
||||
t.is (uri3._protocol, "rsync", "Uri::parse() : rsync://hostname.abc.de:1234//abs/path");
|
||||
|
||||
Uri uri4 ("hostname:");
|
||||
uri4.parse ();
|
||||
t.is (uri4._user, "", "Uri::parse() : hostname:");
|
||||
t.is (uri4._host, "hostname", "Uri::parse() : hostname:");
|
||||
t.is (uri4._port, "", "Uri::parse() : hostname:");
|
||||
t.is (uri4._path, "", "Uri::parse() : hostname:");
|
||||
t.is (uri4._protocol, "ssh", "Uri::parse() : hostname:");
|
||||
t.notok (uri4.is_local (), "Uri::is_local() : hostname:");
|
||||
t.ok (uri4.append ("file.test"), "Uri::append() : hostname:");
|
||||
t.is (uri4._path, "file.test","Uri::append() : ok");
|
||||
|
||||
context.config.set ("merge.default.uri", "../folder/");
|
||||
context.config.set ("push.test.uri", "/home/user/.task/");
|
||||
|
||||
Uri uri5 ("", "merge");
|
||||
t.ok (uri5.is_local (), "Uri::is_local() : ../server/");
|
||||
uri5.parse ();
|
||||
t.is (uri5._path, "../folder/", "Uri::expand() default");
|
||||
|
||||
Uri uri6 ("test", "push");
|
||||
t.ok (uri6.is_local(), "Uri::is_local() : /home/user/.task/");
|
||||
uri6.parse ();
|
||||
t.is (uri6._path, "/home/user/.task/", "Uri::expand() test");
|
||||
|
||||
Uri uri7 ("ftp://'user@name'@host:321/path/to/x");
|
||||
uri7.parse ();
|
||||
t.is (uri7._user, "user@name", "Uri::parse() : ftp://'user@name'@host:321/path/to/x");
|
||||
t.is (uri7._host, "host", "Uri::parse() : ftp://'user@name'@host:321/path/to/x");
|
||||
t.is (uri7._port, "321", "Uri::parse() : ftp://'user@name'@host:321/path/to/x");
|
||||
t.is (uri7._path, "path/to/x", "Uri::parse() : ftp://'user@name'@host:321/path/to/x");
|
||||
t.is (uri7._protocol, "ftp", "Uri::parse() : ftp://'user@name'@host:321/path/to/x");
|
||||
|
||||
Uri uri8 ("http://'us/er@n:ame'@host/path/to/x");
|
||||
uri8.parse ();
|
||||
t.is (uri8._user, "us/er@n:ame", "Uri::parse() : http://'us/er@n:ame'@host/path/to/x");
|
||||
t.is (uri8._host, "host", "Uri::parse() : http://'us/er@n:ame'@host/path/to/x");
|
||||
t.is (uri8._port, "", "Uri::parse() : http://'us/er@n:ame'@host/path/to/x");
|
||||
t.is (uri8._path, "path/to/x", "Uri::parse() : http://'us/er@n:ame'@host/path/to/x");
|
||||
t.is (uri8._protocol, "http", "Uri::parse() : http://'us/er@n:ame'@host/path/to/x");
|
||||
|
||||
Uri uri9 ("'user@name'@host:path/to/x");
|
||||
uri9.parse ();
|
||||
t.is (uri9._user, "user@name", "Uri::parse() : 'user@name'@host:path/to/x");
|
||||
t.is (uri9._host, "host", "Uri::parse() : 'user@name'@host:path/to/x");
|
||||
t.is (uri9._port, "", "Uri::parse() : 'user@name'@host:path/to/x");
|
||||
t.is (uri9._path, "path/to/x", "Uri::parse() : 'user@name'@host:path/to/x");
|
||||
|
||||
// bug #668
|
||||
Uri uri10 ("user.name@host.com:undo.data");
|
||||
uri10.parse ();
|
||||
t.is (uri10._user, "user.name", "Uri::parse() : user.name@host.com:undo.data");
|
||||
t.is (uri10._host, "host.com", "Uri::parse() : user.name@host.com:undo.data");
|
||||
t.is (uri10._port, "", "Uri::parse() : user.name@host.com:undo.data");
|
||||
t.is (uri10._path, "undo.data", "Uri::parse() : user.name@host.com:undo.data");
|
||||
t.is (uri10._protocol, "ssh", "Uri::parse() : user.name@host.com:undo.data");
|
||||
|
||||
Uri uri11 ("ssh://user.name@host.com/undo.data");
|
||||
uri11.parse ();
|
||||
t.is (uri11._user, "user.name", "Uri::parse() : ssh://user.name@host.com/undo.data");
|
||||
t.is (uri11._host, "host.com", "Uri::parse() : ssh://user.name@host.com/undo.data");
|
||||
t.is (uri11._port, "", "Uri::parse() : ssh://user.name@host.com/undo.data");
|
||||
t.is (uri11._path, "/undo.data", "Uri::parse() : ssh://user.name@host.com/undo.data");
|
||||
t.is (uri11._protocol, "ssh", "Uri::parse() : ssh://user.name@host.com/undo.data");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// vim: et ts=2 sw=2
|
||||
Reference in New Issue
Block a user