mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Moved src/tests to test (cmake preperations)
This commit is contained in:
parent
02dcdf83b5
commit
17ef077e27
210 changed files with 0 additions and 0 deletions
33
test/.gitignore
vendored
Normal file
33
test/.gitignore
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
*.log
|
||||
att.t
|
||||
autocomplete.t
|
||||
cmd.t
|
||||
color.t
|
||||
config.t
|
||||
date.t
|
||||
directory.t
|
||||
duration.t
|
||||
file.t
|
||||
filt.t
|
||||
grid.t
|
||||
lisp.t
|
||||
list.t
|
||||
nibbler.t
|
||||
path.t
|
||||
record.t
|
||||
rectangle.t
|
||||
rx.t
|
||||
sensor.t
|
||||
seq.t
|
||||
stringtable.t
|
||||
subst.t
|
||||
t.benchmark.t
|
||||
t.t
|
||||
taskmod.t
|
||||
tdb.t
|
||||
text.t
|
||||
transport.t
|
||||
tree.t
|
||||
tree2.t
|
||||
uri.t
|
||||
util.t
|
127
test/Makefile
Normal file
127
test/Makefile
Normal file
|
@ -0,0 +1,127 @@
|
|||
PROJECT = t.t tdb.t date.t duration.t t.benchmark.t text.t autocomplete.t \
|
||||
config.t seq.t att.t stringtable.t record.t nibbler.t subst.t filt.t \
|
||||
cmd.t util.t color.t list.t path.t file.t directory.t grid.t rx.t \
|
||||
taskmod.t sensor.t rectangle.t tree.t tree2.t lisp.t uri.t
|
||||
CFLAGS = -I. -I.. -I../.. -Wall -pedantic -ggdb3 -fno-rtti
|
||||
LFLAGS = -L/usr/local/lib -lpthread -llua
|
||||
OBJECTS = ../t-TDB.o ../t-Task.o ../t-text.o ../t-Date.o ../t-Table.o \
|
||||
../t-Duration.o ../t-util.o ../t-Config.o ../t-Sequence.o ../t-Att.o \
|
||||
../t-Cmd.o ../t-Record.o ../t-StringTable.o ../t-Subst.o \
|
||||
../t-Nibbler.o ../t-Location.o ../t-Filter.o ../t-Context.o \
|
||||
../t-Keymap.o ../t-command.o ../t-interactive.o ../t-report.o \
|
||||
../t-Grid.o ../t-Color.o ../t-rules.o ../t-recur.o ../t-custom.o \
|
||||
../t-export.o ../t-import.o ../t-edit.o ../t-Timer.o \
|
||||
../t-Permission.o ../t-Path.o ../t-File.o ../t-Directory.o \
|
||||
../t-Hooks.o ../t-API.o ../t-rx.o ../t-Taskmod.o ../t-dependency.o \
|
||||
../t-Transport.o ../t-TransportSSH.o ../t-Sensor.o ../t-Thread.o \
|
||||
../t-Lisp.o ../t-Rectangle.o ../t-Tree.o ../t-TransportRSYNC.o \
|
||||
../t-TransportCurl.o ../t-Uri.o ../t-diag.o ../t-burndown.o \
|
||||
../t-history.o
|
||||
|
||||
all: $(PROJECT)
|
||||
|
||||
install: $(PROJECT)
|
||||
@echo unimplemented
|
||||
|
||||
test: $(PROJECT)
|
||||
@echo unimplemented
|
||||
|
||||
clean:
|
||||
-rm *.o $(PROJECT)
|
||||
|
||||
.cpp.o:
|
||||
g++ -c $(CFLAGS) $<
|
||||
|
||||
t.t: t.t.o $(OBJECTS) test.o
|
||||
g++ t.t.o $(OBJECTS) test.o $(LFLAGS) -o t.t
|
||||
|
||||
tdb.t: tdb.t.o $(OBJECTS) test.o
|
||||
g++ tdb.t.o $(OBJECTS) test.o $(LFLAGS) -o tdb.t
|
||||
|
||||
date.t: date.t.o $(OBJECTS) test.o
|
||||
g++ date.t.o $(OBJECTS) test.o $(LFLAGS) -o date.t
|
||||
|
||||
duration.t: duration.t.o $(OBJECTS) test.o
|
||||
g++ duration.t.o $(OBJECTS) test.o $(LFLAGS) -o duration.t
|
||||
|
||||
t.benchmark.t: t.benchmark.t.o $(OBJECTS) test.o
|
||||
g++ t.benchmark.t.o $(OBJECTS) test.o $(LFLAGS) -o t.benchmark.t
|
||||
|
||||
text.t: text.t.o $(OBJECTS) test.o
|
||||
g++ text.t.o $(OBJECTS) test.o $(LFLAGS) -o text.t
|
||||
|
||||
autocomplete.t: autocomplete.t.o $(OBJECTS) test.o
|
||||
g++ autocomplete.t.o $(OBJECTS) test.o $(LFLAGS) -o autocomplete.t
|
||||
|
||||
seq.t: seq.t.o $(OBJECTS) test.o
|
||||
g++ seq.t.o $(OBJECTS) test.o $(LFLAGS) -o seq.t
|
||||
|
||||
record.t: record.t.o $(OBJECTS) test.o
|
||||
g++ record.t.o $(OBJECTS) test.o $(LFLAGS) -o record.t
|
||||
|
||||
att.t: att.t.o $(OBJECTS) test.o
|
||||
g++ att.t.o $(OBJECTS) test.o $(LFLAGS) -o att.t
|
||||
|
||||
stringtable.t: stringtable.t.o $(OBJECTS) test.o
|
||||
g++ stringtable.t.o $(OBJECTS) test.o $(LFLAGS) -o stringtable.t
|
||||
|
||||
subst.t: subst.t.o $(OBJECTS) test.o
|
||||
g++ subst.t.o $(OBJECTS) test.o $(LFLAGS) -o subst.t
|
||||
|
||||
nibbler.t: nibbler.t.o $(OBJECTS) test.o
|
||||
g++ nibbler.t.o $(OBJECTS) test.o $(LFLAGS) -o nibbler.t
|
||||
|
||||
filt.t: filt.t.o $(OBJECTS) test.o
|
||||
g++ filt.t.o $(OBJECTS) test.o $(LFLAGS) -o filt.t
|
||||
|
||||
cmd.t: cmd.t.o $(OBJECTS) test.o
|
||||
g++ cmd.t.o $(OBJECTS) test.o $(LFLAGS) -o cmd.t
|
||||
|
||||
config.t: config.t.o $(OBJECTS) test.o
|
||||
g++ config.t.o $(OBJECTS) test.o $(LFLAGS) -o config.t
|
||||
|
||||
util.t: util.t.o $(OBJECTS) test.o
|
||||
g++ util.t.o $(OBJECTS) test.o $(LFLAGS) -o util.t
|
||||
|
||||
color.t: color.t.o $(OBJECTS) test.o
|
||||
g++ color.t.o $(OBJECTS) test.o $(LFLAGS) -o color.t
|
||||
|
||||
list.t: list.t.o $(OBJECTS) test.o
|
||||
g++ list.t.o $(OBJECTS) test.o $(LFLAGS) -o list.t
|
||||
|
||||
path.t: path.t.o $(OBJECTS) test.o
|
||||
g++ path.t.o $(OBJECTS) test.o $(LFLAGS) -o path.t
|
||||
|
||||
file.t: file.t.o $(OBJECTS) test.o
|
||||
g++ file.t.o $(OBJECTS) test.o $(LFLAGS) -o file.t
|
||||
|
||||
directory.t: directory.t.o $(OBJECTS) test.o
|
||||
g++ directory.t.o $(OBJECTS) test.o $(LFLAGS) -o directory.t
|
||||
|
||||
grid.t: grid.t.o $(OBJECTS) test.o
|
||||
g++ grid.t.o $(OBJECTS) test.o $(LFLAGS) -o grid.t
|
||||
|
||||
rx.t: rx.t.o $(OBJECTS) test.o
|
||||
g++ rx.t.o $(OBJECTS) test.o $(LFLAGS) -o rx.t
|
||||
|
||||
taskmod.t: taskmod.t.o $(OBJECTS) test.o
|
||||
g++ taskmod.t.o $(OBJECTS) test.o $(LFLAGS) -o taskmod.t
|
||||
|
||||
lisp.t: lisp.t.o $(OBJECTS) test.o
|
||||
g++ lisp.t.o $(OBJECTS) test.o $(LFLAGS) -o lisp.t
|
||||
|
||||
rectangle.t: rectangle.t.o $(OBJECTS) test.o
|
||||
g++ rectangle.t.o $(OBJECTS) test.o $(LFLAGS) -o rectangle.t
|
||||
|
||||
sensor.t: sensor.t.o $(OBJECTS) test.o
|
||||
g++ sensor.t.o $(OBJECTS) test.o $(LFLAGS) -o sensor.t
|
||||
|
||||
tree.t: tree.t.o $(OBJECTS) test.o
|
||||
g++ tree.t.o $(OBJECTS) test.o $(LFLAGS) -o tree.t
|
||||
|
||||
tree2.t: tree2.t.o $(OBJECTS) test.o
|
||||
g++ tree2.t.o $(OBJECTS) test.o $(LFLAGS) -o tree2.t
|
||||
|
||||
uri.t: uri.t.o $(OBJECTS) test.o
|
||||
g++ uri.t.o $(OBJECTS) test.o $(LFLAGS) -o uri.t
|
||||
|
105
test/abbreviation.t
Executable file
105
test/abbreviation.t
Executable file
|
@ -0,0 +1,105 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 24;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'abbrev.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'abbrev.rc', 'Created abbrev.rc');
|
||||
}
|
||||
|
||||
# Test the priority attribute abbrevations.
|
||||
qx{../task rc:abbrev.rc add priority:H with};
|
||||
qx{../task rc:abbrev.rc add without};
|
||||
|
||||
my $output = qx{../task rc:abbrev.rc list priority:H};
|
||||
like ($output, qr/\bwith\b/, 'priority:H with');
|
||||
unlike ($output, qr/\bwithout\b/, 'priority:H without');
|
||||
|
||||
$output = qx{../task rc:abbrev.rc list priorit:H};
|
||||
like ($output, qr/\bwith\b/, 'priorit:H with');
|
||||
unlike ($output, qr/\bwithout\b/, 'priorit:H without');
|
||||
|
||||
$output = qx{../task rc:abbrev.rc list priori:H};
|
||||
like ($output, qr/\bwith\b/, 'priori:H with');
|
||||
unlike ($output, qr/\bwithout\b/, 'priori:H without');
|
||||
|
||||
$output = qx{../task rc:abbrev.rc list prior:H};
|
||||
like ($output, qr/\bwith\b/, 'prior:H with');
|
||||
unlike ($output, qr/\bwithout\b/, 'prior:H without');
|
||||
|
||||
$output = qx{../task rc:abbrev.rc list prio:H};
|
||||
like ($output, qr/\bwith\b/, 'prio:H with');
|
||||
unlike ($output, qr/\bwithout\b/, 'prio:H without');
|
||||
|
||||
$output = qx{../task rc:abbrev.rc list pri:H};
|
||||
like ($output, qr/\bwith\b/, 'pri:H with');
|
||||
unlike ($output, qr/\bwithout\b/, 'pri:H without');
|
||||
|
||||
# Test the version command abbreviations.
|
||||
$output = qx{../task rc:abbrev.rc version};
|
||||
like ($output, qr/GNU\s+General\s+Public\s+License/, 'version');
|
||||
|
||||
$output = qx{../task rc:abbrev.rc versio};
|
||||
like ($output, qr/GNU\s+General\s+Public\s+License/, 'versio');
|
||||
|
||||
$output = qx{../task rc:abbrev.rc versi};
|
||||
like ($output, qr/GNU\s+General\s+Public\s+License/, 'versi');
|
||||
|
||||
$output = qx{../task rc:abbrev.rc vers};
|
||||
like ($output, qr/GNU\s+General\s+Public\s+License/, 'vers');
|
||||
|
||||
$output = qx{../task rc:abbrev.rc ver};
|
||||
like ($output, qr/GNU\s+General\s+Public\s+License/, 'ver');
|
||||
|
||||
$output = qx{../task rc:abbrev.rc ve};
|
||||
like ($output, qr/GNU\s+General\s+Public\s+License/, 've');
|
||||
|
||||
$output = qx{../task rc:abbrev.rc v};
|
||||
like ($output, qr/GNU\s+General\s+Public\s+License/, 'v');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'abbrev.rc';
|
||||
ok (!-r 'abbrev.rc', 'Removed abbrev.rc');
|
||||
|
||||
exit 0;
|
||||
|
72
test/add.t
Executable file
72
test/add.t
Executable file
|
@ -0,0 +1,72 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 12;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'add.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=off\n";
|
||||
close $fh;
|
||||
ok (-r 'add.rc', 'Created add.rc');
|
||||
}
|
||||
|
||||
# Test the add command.
|
||||
qx{../task rc:add.rc add This is a test};
|
||||
my $output = qx{../task rc:add.rc info 1};
|
||||
like ($output, qr/ID\s+1\n/, 'add ID');
|
||||
like ($output, qr/Description\s+This is a test\n/, 'add ID');
|
||||
like ($output, qr/Status\s+Pending\n/, 'add Pending');
|
||||
like ($output, qr/UUID\s+[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\n/, 'add UUID');
|
||||
|
||||
# Test the /// modifier.
|
||||
qx{../task rc:add.rc 1 /test/TEST/};
|
||||
qx{../task rc:add.rc 1 "/is //"};
|
||||
$output = qx{../task rc:add.rc info 1};
|
||||
like ($output, qr/ID\s+1\n/, 'add ID');
|
||||
like ($output, qr/Status\s+Pending\n/, 'add Pending');
|
||||
like ($output, qr/Description\s+This a TEST\n/, 'add ID');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'add.rc';
|
||||
ok (!-r 'add.rc', 'Removed add.rc');
|
||||
|
||||
exit 0;
|
||||
|
69
test/alias.t
Executable file
69
test/alias.t
Executable file
|
@ -0,0 +1,69 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 8;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'alias.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"alias.foo=_projects\n",
|
||||
"alias.bar=foo\n";
|
||||
close $fh;
|
||||
ok (-r 'alias.rc', 'Created alias.rc');
|
||||
}
|
||||
|
||||
# Add a task with certain project, then access that task via aliases.
|
||||
qx{../task rc:alias.rc add project:ALIAS foo};
|
||||
|
||||
my $output = qx{../task rc:alias.rc _projects};
|
||||
like ($output, qr/ALIAS/, 'task _projects -> ALIAS');
|
||||
|
||||
$output = qx{../task rc:alias.rc foo};
|
||||
like ($output, qr/ALIAS/, 'task foo -> _projects -> ALIAS');
|
||||
|
||||
$output = qx{../task rc:alias.rc bar};
|
||||
like ($output, qr/ALIAS/, 'task bar -> foo -> _projects -> ALIAS');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'alias.rc';
|
||||
ok (!-r 'alias.rc', 'Removed alias.rc');
|
||||
|
||||
exit 0;
|
||||
|
164
test/annotate.t
Executable file
164
test/annotate.t
Executable file
|
@ -0,0 +1,164 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 51;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'annotate.rc')
|
||||
{
|
||||
# Note: Use 'rrr' to guarantee a unique report name. Using 'r' conflicts
|
||||
# with 'recurring'.
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=off\n",
|
||||
"report.rrr.description=rrr\n",
|
||||
"report.rrr.columns=id,description\n",
|
||||
"report.rrr.sort=id+\n";
|
||||
close $fh;
|
||||
ok (-r 'annotate.rc', 'Created annotate.rc');
|
||||
}
|
||||
|
||||
# Add four tasks, annotate one three times, one twice, one just once and one none.
|
||||
qx{../task rc:annotate.rc add one};
|
||||
qx{../task rc:annotate.rc add two};
|
||||
qx{../task rc:annotate.rc add three};
|
||||
qx{../task rc:annotate.rc add four};
|
||||
qx{../task rc:annotate.rc annotate 1 foo1};
|
||||
diag ("5 second delay");
|
||||
sleep 1;
|
||||
qx{../task rc:annotate.rc annotate 1 foo2};
|
||||
sleep 1;
|
||||
qx{../task rc:annotate.rc annotate 1 foo3};
|
||||
sleep 1;
|
||||
qx{../task rc:annotate.rc annotate 2 bar1};
|
||||
sleep 1;
|
||||
qx{../task rc:annotate.rc annotate 2 bar2};
|
||||
sleep 1;
|
||||
qx{../task rc:annotate.rc annotate 3 baz1};
|
||||
|
||||
my $output = qx{../task rc:annotate.rc rrr};
|
||||
|
||||
# ID Description
|
||||
# -- -------------------------------
|
||||
# 1 one
|
||||
# 3/24/2009 foo1
|
||||
# 3/24/2009 foo2
|
||||
# 3/24/2009 foo3
|
||||
# 2 two
|
||||
# 3/24/2009 bar1
|
||||
# 3/24/2009 bar2
|
||||
# 3 three
|
||||
# 3/24/2009 baz1
|
||||
# 4 four
|
||||
#
|
||||
# 4 tasks
|
||||
|
||||
like ($output, qr/1 one/, 'task 1');
|
||||
like ($output, qr/2 two/, 'task 2');
|
||||
like ($output, qr/3 three/, 'task 3');
|
||||
like ($output, qr/4 four/, 'task 4');
|
||||
like ($output, qr/one.+\d{1,2}\/\d{1,2}\/\d{4} foo1/ms, 'full - first annotation task 1');
|
||||
like ($output, qr/foo1.+\d{1,2}\/\d{1,2}\/\d{4} foo2/ms, 'full - second annotation task 1');
|
||||
like ($output, qr/foo2.+\d{1,2}\/\d{1,2}\/\d{4} foo3/ms, 'full - third annotation task 1');
|
||||
like ($output, qr/two.+\d{1,2}\/\d{1,2}\/\d{4} bar1/ms, 'full - first annotation task 2');
|
||||
like ($output, qr/bar1.+\d{1,2}\/\d{1,2}\/\d{4} bar2/ms, 'full - second annotation task 2');
|
||||
like ($output, qr/three.+\d{1,2}\/\d{1,2}\/\d{4} baz1/ms,'full - first annotation task 3');
|
||||
like ($output, qr/4 tasks/, 'count');
|
||||
|
||||
$output = qx{../task rc:annotate.rc rc.annotations:sparse rrr};
|
||||
like ($output, qr/1 \+one/, 'task 1');
|
||||
like ($output, qr/2 \+two/, 'task 2');
|
||||
like ($output, qr/3 three/, 'task 3');
|
||||
like ($output, qr/4 four/, 'task 4');
|
||||
unlike ($output, qr/one.+\d{1,2}\/\d{1,2}\/\d{4} foo1/ms, 'sparse - first annotation task 1');
|
||||
unlike ($output, qr/foo1.+\d{1,2}\/\d{1,2}\/\d{4} foo2/ms, 'sparse - second annotation task 1');
|
||||
like ($output, qr/one.+\d{1,2}\/\d{1,2}\/\d{4} foo3/ms, 'sparse - third annotation task 1');
|
||||
unlike ($output, qr/two.+\d{1,2}\/\d{1,2}\/\d{4} bar1/ms, 'sparse - first annotation task 2');
|
||||
like ($output, qr/two.+\d{1,2}\/\d{1,2}\/\d{4} bar2/ms, 'sparse - second annotation task 2');
|
||||
like ($output, qr/three.+\d{1,2}\/\d{1,2}\/\d{4} baz1/ms, 'sparse - third annotation task 3');
|
||||
like ($output, qr/4 tasks/, 'count');
|
||||
|
||||
$output = qx{../task rc:annotate.rc rc.annotations:none rrr};
|
||||
like ($output, qr/1 \+one/, 'task 1');
|
||||
like ($output, qr/2 \+two/, 'task 2');
|
||||
like ($output, qr/3 \+three/, 'task 3');
|
||||
like ($output, qr/4 four/, 'task 4');
|
||||
unlike ($output, qr/one.+\d{1,2}\/\d{1,2}\/\d{4} foo1/ms, 'none - first annotation task 1');
|
||||
unlike ($output, qr/foo1.+\d{1,2}\/\d{1,2}\/\d{4} foo2/ms, 'none - second annotation task 1');
|
||||
unlike ($output, qr/foo2.+\d{1,2}\/\d{1,2}\/\d{4} foo3/ms, 'none - third annotation task 1');
|
||||
unlike ($output, qr/two.+\d{1,2}\/\d{1,2}\/\d{4} bar1/ms, 'none - first annotation task 2');
|
||||
unlike ($output, qr/bar1.+\d{1,2}\/\d{1,2}\/\d{4} bar2/ms, 'none - second annotation task 2');
|
||||
unlike ($output, qr/three.+\d{1,2}\/\d{1,2}\/\d{4} baz1/ms, 'none - third annotation task 3');
|
||||
like ($output, qr/4 tasks/, 'count');
|
||||
|
||||
if (open my $fh, '>', 'annotate2.rc')
|
||||
{
|
||||
# Note: Use 'rrr' to guarantee a unique report name. Using 'r' conflicts
|
||||
# with 'recurring'.
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=off\n",
|
||||
"report.rrr.description=rrr\n",
|
||||
"report.rrr.columns=id,description\n",
|
||||
"report.rrr.sort=id+\n",
|
||||
"dateformat.annotation=yMD HNS\n";
|
||||
close $fh;
|
||||
ok (-r 'annotate2.rc', 'Created annotate2.rc');
|
||||
}
|
||||
|
||||
$output = qx{../task rc:annotate2.rc rrr};
|
||||
like ($output, qr/1 one/, 'task 1');
|
||||
like ($output, qr/2 two/, 'task 2');
|
||||
like ($output, qr/3 three/, 'task 3');
|
||||
like ($output, qr/4 four/, 'task 4');
|
||||
like ($output, qr/one.+\d{1,6} \d{1,6} foo1/ms, 'dateformat - first annotation task 1');
|
||||
like ($output, qr/foo1.+\d{1,6} \d{1,6} foo2/ms, 'dateformat - second annotation task 1');
|
||||
like ($output, qr/foo2.+\d{1,6} \d{1,6} foo3/ms, 'dateformat - third annotation task 1');
|
||||
like ($output, qr/two.+\d{1,6} \d{1,6} bar1/ms, 'dateformat - first annotation task 2');
|
||||
like ($output, qr/bar1.+\d{1,6} \d{1,6} bar2/ms, 'dateformat - second annotation task 2');
|
||||
like ($output, qr/three.+\d{1,6} \d{1,6} baz1/ms,'dateformat - first annotation task 3');
|
||||
like ($output, qr/4 tasks/, 'count');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'annotate.rc';
|
||||
ok (!-r 'annotate.rc', 'Removed annotate.rc');
|
||||
|
||||
unlink 'annotate2.rc';
|
||||
ok (!-r 'annotate2.rc', 'Removed annotate2.rc');
|
||||
|
||||
exit 0;
|
||||
|
61
test/append.t
Executable file
61
test/append.t
Executable file
|
@ -0,0 +1,61 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 6;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'append.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'append.rc', 'Created append.rc');
|
||||
}
|
||||
|
||||
# Add a task, then append more decsription.
|
||||
qx{../task rc:append.rc add foo};
|
||||
qx{../task rc:append.rc 1 append bar};
|
||||
my $output = qx{../task rc:append.rc info 1};
|
||||
like ($output, qr/Description\s+foo\sbar\n/, 'append worked');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'append.rc';
|
||||
ok (!-r 'append.rc', 'Removed append.rc');
|
||||
|
||||
exit 0;
|
||||
|
77
test/args.t
Executable file
77
test/args.t
Executable file
|
@ -0,0 +1,77 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 10;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'args.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'args.rc', 'Created args.rc');
|
||||
}
|
||||
|
||||
# Test the -- argument.
|
||||
qx{../task rc:args.rc add project:p pri:H +tag foo};
|
||||
my $output = qx{../task rc:args.rc info 1};
|
||||
like ($output, qr/Description\s+foo\n/ms, 'task add project:p pri:H +tag foo');
|
||||
|
||||
qx{../task rc:args.rc 1 project:p pri:H +tag -- foo};
|
||||
$output = qx{../task rc:args.rc info 1};
|
||||
like ($output, qr/Description\s+foo\n/ms, 'task 1 project:p pri:H +tag -- foo');
|
||||
|
||||
qx{../task rc:args.rc 1 project:p pri:H -- +tag foo};
|
||||
$output = qx{../task rc:args.rc info 1};
|
||||
like ($output, qr/Description\s+\+tag\sfoo\n/ms, 'task 1 project:p pri:H -- +tag foo');
|
||||
|
||||
qx{../task rc:args.rc 1 project:p -- pri:H +tag foo};
|
||||
$output = qx{../task rc:args.rc info 1};
|
||||
like ($output, qr/Description\s+pri:H\s\+tag\sfoo\n/ms, 'task 1 project:p -- pri:H +tag foo');
|
||||
|
||||
qx{../task rc:args.rc 1 -- project:p pri:H +tag foo};
|
||||
$output = qx{../task rc:args.rc info 1};
|
||||
like ($output, qr/Description\s+project:p\spri:H\s\+tag\sfoo\n/ms, 'task 1 -- project:p pri:H +tag foo');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'args.rc';
|
||||
ok (!-r 'args.rc', 'Removed args.rc');
|
||||
|
||||
exit 0;
|
||||
|
381
test/att.t.cpp
Normal file
381
test/att.t.cpp
Normal file
|
@ -0,0 +1,381 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free Software
|
||||
// Foundation; either version 2 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program; if not, write to the
|
||||
//
|
||||
// Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor,
|
||||
// Boston, MA
|
||||
// 02110-1301
|
||||
// USA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include <Context.h>
|
||||
#include <Att.h>
|
||||
#include <test.h>
|
||||
#include <algorithm>
|
||||
|
||||
Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest t (117);
|
||||
|
||||
Att a;
|
||||
t.notok (a.valid ("name"), "Att::valid name -> fail");
|
||||
t.notok (a.valid (":"), "Att::valid : -> fail");
|
||||
t.notok (a.valid (":value"), "Att::valid :value -> fail");
|
||||
|
||||
t.ok (a.valid ("name:value"), "Att::valid name:value");
|
||||
t.ok (a.valid ("name:value "), "Att::valid name:value\\s");
|
||||
t.ok (a.valid ("name:'value'"), "Att::valid name:'value'");
|
||||
t.ok (a.valid ("name:'one two'"), "Att::valid name:'one two'");
|
||||
t.ok (a.valid ("name:\"value\""), "Att::valid name:\"value\"");
|
||||
t.ok (a.valid ("name:\"one two\""), "Att::valid name:\"one two\"");
|
||||
t.ok (a.valid ("name:"), "Att::valid name:");
|
||||
t.ok (a.valid ("name:""), "Att::valid "");
|
||||
t.ok (a.valid ("name.one:value"), "Att::valid name.one.value");
|
||||
t.ok (a.valid ("name.one.two:value"), "Att::valid name.one.two:value");
|
||||
t.ok (a.valid ("name.:value"), "Att::valid name.:value");
|
||||
t.ok (a.valid ("name..:value"), "Att::valid name..:value");
|
||||
|
||||
Att a1 ("name", "value");
|
||||
t.is (a1.name (), "name", "Att::Att (name, value), Att.name");
|
||||
t.is (a1.value (), "value", "Att::Att (name, value), Att.value");
|
||||
|
||||
Att a2;
|
||||
a2.name ("name");
|
||||
a2.value ("value");
|
||||
t.is (a2.name (), "name", "Att::Att (), Att.name");
|
||||
t.is (a2.value (), "value", "Att::Att (), Att.value");
|
||||
|
||||
Att a3 (a2);
|
||||
t.is (a3.name (), "name", "Att::Att (Att), Att.name");
|
||||
t.is (a3.value (), "value", "Att::Att (Att), Att.value");
|
||||
|
||||
Att a4;
|
||||
a4 = a2;
|
||||
t.is (a4.name (), "name", "Att::Att (), Att.operator=, Att.name");
|
||||
t.is (a4.value (), "value", "Att::Att (), Att.operator=, Att.value");
|
||||
|
||||
Att a5 ("name", "value");
|
||||
t.is (a5.composeF4 (), "name:\"value\"", "Att::composeF4 simple");
|
||||
a5.value ("\"");
|
||||
t.is (a5.composeF4 (), "name:\"&dquot;\"", "Att::composeF4 encoded \"");
|
||||
a5.value ("\t\",[]:");
|
||||
t.is (a5.composeF4 (), "name:\"&tab;&dquot;,&open;&close;:\"", "Att::composeF4 fully encoded \\t\",[]:");
|
||||
|
||||
Att a6 ("name", 6);
|
||||
t.is (a6.value_int (), 6, "Att::value_int get");
|
||||
a6.value_int (7);
|
||||
t.is (a6.value_int (), 7, "Att::value_int set/get");
|
||||
t.is (a6.value (), "7", "Att::value 7");
|
||||
|
||||
// Att::mod - straight comparisons.
|
||||
bool good = true;
|
||||
try {a6.mod ("is");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (is)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("before");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (before)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("after");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (after)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("none");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (none)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("any");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (any)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("over");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (over)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("under");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (under)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("above");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (above)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("below");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (below)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("isnt");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (isnt)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("has");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (has)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("contains");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (contains)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("hasnt");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (hasnt)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("startswith");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (startswith)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("endswith");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (endswith)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("word");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (word)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("noword");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (noword)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("unrecognized");} catch (...) {good = false;}
|
||||
t.notok (good, "Att::mod (unrecognized)");
|
||||
|
||||
// Att::mod - regex comparisons.
|
||||
context.config.set ("regex", "on");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("is");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (is)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("before");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (before)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("after");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (after)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("none");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (none)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("any");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (any)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("over");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (over)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("under");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (under)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("above");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (above)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("below");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (below)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("isnt");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (isnt)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("has");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (has)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("contains");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (contains)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("hasnt");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (hasnt)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("startswith");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (startswith)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("endswith");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (endswith)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("word");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (word)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("noword");} catch (...) {good = false;}
|
||||
t.ok (good, "Att::mod (noword)");
|
||||
|
||||
good = true;
|
||||
try {a6.mod ("unrecognized");} catch (...) {good = false;}
|
||||
t.notok (good, "Att::mod (unrecognized)");
|
||||
|
||||
// Att::parse
|
||||
Nibbler n ("");
|
||||
Att a7;
|
||||
good = true;
|
||||
try {a7.parse (n);} catch (...) {good = false;}
|
||||
t.notok (good, "Att::parse () -> throw");
|
||||
|
||||
n = Nibbler ("name:value");
|
||||
a7.parse (n);
|
||||
t.is (a7.composeF4 (), "name:\"value\"",
|
||||
"Att::parse (name:value)");
|
||||
|
||||
n = Nibbler ("name:\"value\"");
|
||||
a7.parse (n);
|
||||
t.is (a7.composeF4 (), "name:\"value\"",
|
||||
"Att::parse (name:\"value\")");
|
||||
|
||||
n = Nibbler ("name:\"one two\"");
|
||||
a7.parse (n);
|
||||
t.is (a7.composeF4 (), "name:\"one two\"",
|
||||
"Att::parse (name:\"one two\")");
|
||||
|
||||
n = Nibbler ("name:\""\"");
|
||||
a7.parse (n);
|
||||
t.is (a7.composeF4 (), "name:\"'\"",
|
||||
"Att::parse (name:\"'\")");
|
||||
|
||||
n = Nibbler ("name:\"&tab;",&open;&close;:\"");
|
||||
a7.parse (n);
|
||||
t.is (a7.composeF4 (), "name:\"&tab;',&open;&close;:\"",
|
||||
"Att::parse (name:\"&tab;',&open;&close;:\")");
|
||||
|
||||
n = Nibbler ("total gibberish");
|
||||
good = true;
|
||||
try {a7.parse (n);} catch (...) {good = false;}
|
||||
t.notok (good, "Att::parse (total gibberish)");
|
||||
|
||||
n = Nibbler ("malformed");
|
||||
good = true;
|
||||
try {a7.parse (n);} catch (...) {good = false;}
|
||||
t.notok (good, "Att::parse (malformed)");
|
||||
|
||||
n = Nibbler (":malformed");
|
||||
good = true;
|
||||
try {a7.parse (n);} catch (...) {good = false;}
|
||||
t.notok (good, "Att::parse (:malformed)");
|
||||
|
||||
n = Nibbler (":\"\"");
|
||||
good = true;
|
||||
try {a7.parse (n);} catch (...) {good = false;}
|
||||
t.notok (good, "Att::parse (:\"\")");
|
||||
|
||||
n = Nibbler (":\"");
|
||||
good = true;
|
||||
try {a7.parse (n);} catch (...) {good = false;}
|
||||
t.notok (good, "Att::parse (:\")");
|
||||
|
||||
n = Nibbler ("name:");
|
||||
good = true;
|
||||
try {a7.parse (n);} catch (...) {good = false;}
|
||||
t.ok (good, "Att::parse (name:)");
|
||||
|
||||
n = Nibbler ("name:\"value");
|
||||
good = true;
|
||||
try {a7.parse (n);} catch (...) {good = false;}
|
||||
t.ok (good, "Att::parse (name:\"value)");
|
||||
t.is (a7.composeF4 (), "name:\"&dquot;value\"", "Att::composeF4 -> name:\"&dquot;value\"");
|
||||
|
||||
n = Nibbler ("name:value\"");
|
||||
good = true;
|
||||
try {a7.parse (n);} catch (...) {good = false;}
|
||||
t.ok (good, "Att::parse (name:value\")");
|
||||
t.is (a7.composeF4 (), "name:\"value&dquot;\"", "Att::composeF4 -> name:\"value&dquot;\"");
|
||||
|
||||
n = Nibbler ("name:val\"ue");
|
||||
good = true;
|
||||
try {a7.parse (n);} catch (...) {good = false;}
|
||||
t.ok (good, "Att::parse (name:val\"ue)");
|
||||
t.is (a7.composeF4 (), "name:\"val&dquot;ue\"", "Att::composeF4 -> name:\"val&dquot;ue\"");
|
||||
|
||||
n = Nibbler ("name\"");
|
||||
good = true;
|
||||
try {a7.parse (n);} catch (...) {good = false;}
|
||||
t.notok (good, "Att::parse (name\")");
|
||||
|
||||
// Mods
|
||||
n = Nibbler ("name.any:\"value\"");
|
||||
good = true;
|
||||
try {a7.parse (n);} catch (...) {good = false;}
|
||||
t.ok (good, "Att::parse (name.any:\"value\")");
|
||||
t.is (a7.composeF4 (), "name:\"value\"", "Att::composeF4 -> name:\"value\"");
|
||||
|
||||
n = Nibbler ("name.bogus:\"value\"");
|
||||
good = true;
|
||||
try {a7.parse (n);} catch (...) {good = false;}
|
||||
t.notok (good, "Att::parse (name.bogus:\"value\")");
|
||||
|
||||
// Att::type
|
||||
t.is (a.type ("entry"), "date", "Att::type entry -> date");
|
||||
t.is (a.type ("due"), "date", "Att::type due -> date");
|
||||
t.is (a.type ("until"), "date", "Att::type until -> date");
|
||||
t.is (a.type ("start"), "date", "Att::type start -> date");
|
||||
t.is (a.type ("end"), "date", "Att::type end -> date");
|
||||
t.is (a.type ("wait"), "date", "Att::type wait -> date");
|
||||
t.is (a.type ("recur"), "duration", "Att::type recur -> duration");
|
||||
t.is (a.type ("limit"), "number", "Att::type limit -> number");
|
||||
t.is (a.type ("description"), "text", "Att::type description -> text");
|
||||
t.is (a.type ("foo"), "text", "Att::type foo -> text");
|
||||
|
||||
// Att::validInternalName
|
||||
t.ok (Att::validInternalName ("entry"), "internal entry");
|
||||
t.ok (Att::validInternalName ("start"), "internal start");
|
||||
t.ok (Att::validInternalName ("end"), "internal end");
|
||||
t.ok (Att::validInternalName ("parent"), "internal parent");
|
||||
t.ok (Att::validInternalName ("uuid"), "internal uuid");
|
||||
t.ok (Att::validInternalName ("mask"), "internal mask");
|
||||
t.ok (Att::validInternalName ("imask"), "internal imask");
|
||||
t.ok (Att::validInternalName ("limit"), "internal limit");
|
||||
t.ok (Att::validInternalName ("status"), "internal status");
|
||||
t.ok (Att::validInternalName ("description"), "internal description");
|
||||
|
||||
// Att::validModifiableName
|
||||
t.ok (Att::validModifiableName ("project"), "modifiable project");
|
||||
t.ok (Att::validModifiableName ("priority"), "modifiable priority");
|
||||
t.ok (Att::validModifiableName ("fg"), "modifiable fg");
|
||||
t.ok (Att::validModifiableName ("bg"), "modifiable bg");
|
||||
t.ok (Att::validModifiableName ("due"), "modifiable due");
|
||||
t.ok (Att::validModifiableName ("recur"), "modifiable recur");
|
||||
t.ok (Att::validModifiableName ("until"), "modifiable until");
|
||||
t.ok (Att::validModifiableName ("wait"), "modifiable wait");
|
||||
|
||||
// Att::allNames
|
||||
std::vector <std::string> all;
|
||||
Att::allNames (all);
|
||||
|
||||
std::vector <std::string>::iterator it;
|
||||
it = std::find (all.begin (), all.end (), "uuid");
|
||||
t.ok (it != all.end (), "internal name 'uuid' found in Att::allNames");
|
||||
it = std::find (all.begin (), all.end (), "project");
|
||||
t.ok (it != all.end (), "modifiable name 'project' found in Att::allNames");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
66
test/autocomplete.t.cpp
Normal file
66
test/autocomplete.t.cpp
Normal file
|
@ -0,0 +1,66 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free Software
|
||||
// Foundation; either version 2 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program; if not, write to the
|
||||
//
|
||||
// Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor,
|
||||
// Boston, MA
|
||||
// 02110-1301
|
||||
// USA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include <iostream>
|
||||
#include <test.h>
|
||||
#include <util.h>
|
||||
#include <main.h>
|
||||
|
||||
Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest t (8);
|
||||
|
||||
std::vector <std::string> options;
|
||||
options.push_back ("abc");
|
||||
options.push_back ("abcd");
|
||||
options.push_back ("abcde");
|
||||
options.push_back ("bcdef");
|
||||
options.push_back ("cdefg");
|
||||
|
||||
std::vector <std::string> matches;
|
||||
int result = autoComplete ("", options, matches);
|
||||
t.is (result, 0, "no match on empty string");
|
||||
|
||||
result = autoComplete ("x", options, matches);
|
||||
t.is (result, 0, "no match on wrong string");
|
||||
|
||||
result = autoComplete ("abcd", options, matches);
|
||||
t.is (result, 1, "exact match on 'abcd'");
|
||||
t.is (matches[0], "abcd", "exact match on 'abcd'");
|
||||
|
||||
result = autoComplete ("ab", options, matches);
|
||||
t.is (result, 3, "partial match on 'ab'");
|
||||
t.is (matches[0], "abc", "partial match on 'abc'");
|
||||
t.is (matches[1], "abcd", "partial match on 'abcd'");
|
||||
t.is (matches[2], "abcde", "partial match on 'abcde'");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
52
test/backslash.t
Executable file
52
test/backslash.t
Executable file
|
@ -0,0 +1,52 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 3;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'backslash.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'backslash.rc', 'Created backslash.rc');
|
||||
}
|
||||
|
||||
# Add a description with a backslash.
|
||||
qx{../task rc:backslash.rc add foo\\\\bar};
|
||||
my $output = qx{../task rc:backslash.rc ls};
|
||||
like ($output, qr/foo\\bar/, 'Backslash preserved, no parsing issues');
|
||||
|
||||
# Cleanup.
|
||||
unlink 'backslash.rc';
|
||||
ok (!-r 'backslash.rc', 'Removed backslash.rc');
|
||||
|
||||
exit 0;
|
||||
|
||||
################################################################################
|
82
test/basic.t
Executable file
82
test/basic.t
Executable file
|
@ -0,0 +1,82 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'basic.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"default.command=\n";
|
||||
close $fh;
|
||||
ok (-r 'basic.rc', 'Created basic.rc');
|
||||
}
|
||||
|
||||
# Get the version number from configure.ac
|
||||
my $version = slurp ('../../configure.ac');
|
||||
|
||||
# Test the usage command.
|
||||
my $output = qx{../task rc:basic.rc};
|
||||
like ($output, qr/You must specify a command, or a task ID to modify/m, 'missing command and ID');
|
||||
|
||||
# Test the version command.
|
||||
$output = qx{../task rc:basic.rc version};
|
||||
like ($output, qr/task $version/, 'version - task version number');
|
||||
like ($output, qr/GNU\s+General\s+Public\s+License/, 'version - license');
|
||||
like ($output, qr/http:\/\/taskwarrior\.org/, 'version - url');
|
||||
|
||||
# Test the _version command.
|
||||
$output = qx{../task rc:basic.rc _version};
|
||||
like ($output, qr/$version/, '_version - task version number');
|
||||
|
||||
# Cleanup.
|
||||
unlink 'basic.rc';
|
||||
ok (!-r 'basic.rc', 'Removed basic.rc');
|
||||
|
||||
exit 0;
|
||||
|
||||
################################################################################
|
||||
sub slurp
|
||||
{
|
||||
my ($file) = @_;
|
||||
if (open my $fh, '<', $file)
|
||||
{
|
||||
while (<$fh>) {
|
||||
if (/AC_INIT/) {
|
||||
chomp;
|
||||
s/^AC_INIT\(task, //;
|
||||
s/, support.*$//;
|
||||
close $fh;
|
||||
return $_;
|
||||
}
|
||||
}
|
||||
}
|
||||
'';
|
||||
}
|
106
test/benchmark.t
Executable file
106
test/benchmark.t
Executable file
|
@ -0,0 +1,106 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bench.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"_forcecolor=1\n";
|
||||
close $fh;
|
||||
ok (-r 'bench.rc', 'Created bench.rc');
|
||||
}
|
||||
|
||||
# Do lots of things. Time it all.
|
||||
|
||||
my @tags = qw(t_one t_two t_three t_four t_five t_six t_seven t_eight);
|
||||
my @projects = qw(p_one p_two p_three p_foud p_five p_six p_seven p_eight);
|
||||
my @priorities = qw(H M L);
|
||||
my $description = 'This is a medium-sized description with no special characters';
|
||||
|
||||
# Start the clock.
|
||||
my $start = time ();
|
||||
my $cursor = $start;
|
||||
diag ("start=$start");
|
||||
|
||||
# Make a mess.
|
||||
for my $i (1 .. 1000)
|
||||
{
|
||||
my $project = $projects[rand % 8];
|
||||
my $priority = $priorities[rand % 3];
|
||||
my $tag = $tags[rand % 8];
|
||||
|
||||
qx{../task rc:bench.rc add project:$project priority:$priority +$tag $i $description};
|
||||
}
|
||||
diag ("1000 tasks added in " . (time () - $cursor) . " seconds");
|
||||
$cursor = time ();
|
||||
|
||||
qx{../task rc:bench.rc /with/WITH/} for 1 .. 200;
|
||||
qx{../task rc:bench.rc done $_} for 201 .. 400;
|
||||
qx{../task rc:bench.rc start $_} for 401 .. 600;
|
||||
diag ("600 tasks altered in " . (time () - $cursor) . " seconds");
|
||||
$cursor = time ();
|
||||
|
||||
# Report it all. Note that all Timer information is displayed.
|
||||
|
||||
for (1 .. 100)
|
||||
{
|
||||
diag (grep {/^Timer /} qx{../task rc:bench.rc ls});
|
||||
diag (grep {/^Timer /} qx{../task rc:bench.rc list});
|
||||
diag (grep {/^Timer /} qx{../task rc:bench.rc list priority:H});
|
||||
diag (grep {/^Timer /} qx{../task rc:bench.rc list +tag});
|
||||
diag (grep {/^Timer /} qx{../task rc:bench.rc list project_A});
|
||||
diag (grep {/^Timer /} qx{../task rc:bench.rc long});
|
||||
diag (grep {/^Timer /} qx{../task rc:bench.rc completed});
|
||||
diag (grep {/^Timer /} qx{../task rc:bench.rc history});
|
||||
diag (grep {/^Timer /} qx{../task rc:bench.rc ghistory});
|
||||
}
|
||||
|
||||
# Stop the clock.
|
||||
my $stop = time ();
|
||||
diag ("stop=$stop");
|
||||
diag ("total=" . ($stop - $start));
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bench.rc';
|
||||
ok (!-r 'bench.rc', 'Removed bench.rc');
|
||||
|
||||
exit 0;
|
||||
|
130
test/benchmark2.t
Executable file
130
test/benchmark2.t
Executable file
|
@ -0,0 +1,130 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bench2.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"_forcecolor=1\n",
|
||||
"color.debug=\n",
|
||||
"debug=on\n";
|
||||
close $fh;
|
||||
ok (-r 'bench2.rc', 'Created bench2.rc');
|
||||
}
|
||||
|
||||
# Data.
|
||||
my @tags = qw(t_one t_two t_three t_four t_five t_six t_seven t_eight);
|
||||
my @projects = qw(p_one p_two p_three p_foud p_five p_six p_seven p_eight);
|
||||
my @priorities = qw(H M L);
|
||||
my $description = 'This is a medium-sized description with no special characters';
|
||||
|
||||
my $output;
|
||||
|
||||
# Add 1 task.
|
||||
add (1);
|
||||
$output = qx{../task rc:bench2.rc list};
|
||||
report ('run-1', $output);
|
||||
|
||||
# Add 9 more tasks.
|
||||
add (9);
|
||||
$output = qx{../task rc:bench2.rc list};
|
||||
report ('run-10', $output);
|
||||
|
||||
# Add 90 more tasks.
|
||||
add (90);
|
||||
$output = qx{../task rc:bench2.rc list};
|
||||
report ('run-100', $output);
|
||||
|
||||
# Add 900 more tasks.
|
||||
add (900);
|
||||
$output = qx{../task rc:bench2.rc list};
|
||||
report ('run-1000', $output);
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bench2.rc';
|
||||
ok (!-r 'bench2.rc', 'Removed bench2.rc');
|
||||
|
||||
exit 0;
|
||||
|
||||
################################################################################
|
||||
sub add
|
||||
{
|
||||
my ($quantity) = @_;
|
||||
|
||||
for my $i (1 .. $quantity)
|
||||
{
|
||||
my $project = $projects[rand % 8];
|
||||
my $priority = $priorities[rand % 3];
|
||||
my $tag = $tags[rand % 8];
|
||||
|
||||
qx{../task rc:bench2.rc add project:$project priority:$priority +$tag $i $description};
|
||||
}
|
||||
}
|
||||
|
||||
################################################################################
|
||||
sub report
|
||||
{
|
||||
my ($label, $output) = @_;
|
||||
|
||||
my %data;
|
||||
while ($output =~ /^Timer (\S+) ([0-9.e-]+)/msg)
|
||||
{
|
||||
$data{$1} += $2;
|
||||
}
|
||||
|
||||
# Generate output for benchmark2 chart.
|
||||
chomp (my $version = qx{../task _version});
|
||||
my $out = sprintf "%s %s %f,%f,%f,%f,%f,%f,%f",
|
||||
$label,
|
||||
$version,
|
||||
$data{'Context::initialize'},
|
||||
$data{'Context::parse'},
|
||||
$data{'TDB::loadPending'},
|
||||
$data{'TDB::loadCompleted'} || 0,
|
||||
$data{'TDB::gc'},
|
||||
$data{'TDB::commit'},
|
||||
$data{'Table::render'};
|
||||
|
||||
diag ($out);
|
||||
}
|
||||
|
||||
################################################################################
|
||||
|
68
test/bug.299.t
Executable file
68
test/bug.299.t
Executable file
|
@ -0,0 +1,68 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 8;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Setup: Add three unique tasks with different project names.
|
||||
qx{../task rc:bug.rc add project:one foo};
|
||||
qx{../task rc:bug.rc add project:two bar};
|
||||
qx{../task rc:bug.rc add project:three baz};
|
||||
|
||||
# Result: Run list but exclude two of the three projects names using
|
||||
# project.hasnt:<name>
|
||||
my $output = qx{../task rc:bug.rc list project.isnt:one project.isnt:two};
|
||||
unlike ($output, qr/one.*foo/ms, 'project.isnt:one project.isnt:two - no foo');
|
||||
unlike ($output, qr/two.*bar/ms, 'project.isnt:one project.isnt:two - no bar');
|
||||
like ($output, qr/three.*baz/ms, 'project.isnt:one project.isnt:two - yes baz');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bug.rc';
|
||||
ok (!-r 'bug.rc', 'Removed bug.rc');
|
||||
|
||||
exit 0;
|
||||
|
66
test/bug.327.t
Executable file
66
test/bug.327.t
Executable file
|
@ -0,0 +1,66 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 6;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Setup: Add a recurring task then remove the due date.
|
||||
qx{../task rc:bug.rc add foo recur:yearly due:eoy};
|
||||
qx{../task rc:bug.rc li};
|
||||
qx{../task rc:bug.rc 2 due:};
|
||||
|
||||
# Result: Somehow the due date is incremented and wraps around to 12/31/1969,
|
||||
# then keeps going back to today.
|
||||
my $output = qx{../task rc:bug.rc li};
|
||||
unlike ($output, qr/1969/ms, 'Should not display 12/31/1969');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bug.rc';
|
||||
ok (!-r 'bug.rc', 'Removed bug.rc');
|
||||
|
||||
exit 0;
|
||||
|
81
test/bug.360.t
Executable file
81
test/bug.360.t
Executable file
|
@ -0,0 +1,81 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 9;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Setup: Add a recurring task, generate an instance, then add a project.
|
||||
qx{../task rc:bug.rc add foo due:tomorrow recur:daily};
|
||||
qx{../task rc:bug.rc ls};
|
||||
|
||||
# Result: trying to add the project generates an error about removing
|
||||
# recurrence from a task.
|
||||
my $output = qx{../task rc:bug.rc 1 project:bar};
|
||||
unlike ($output, qr/You cannot remove the recurrence from a recurring task./ms, 'No recurrence removal error');
|
||||
|
||||
# Now try to generate the error above via regular means - ie, is it actually
|
||||
# doing what it should?
|
||||
$output = qx{../task rc:bug.rc 1 recur:};
|
||||
like ($output, qr/You cannot remove the recurrence from a recurring task./ms, 'Recurrence removal error');
|
||||
|
||||
# Prevent removal of the due date from a recurring task.
|
||||
$output = qx{../task rc:bug.rc 1 due:};
|
||||
like ($output, qr/You cannot remove the due date from a recurring task./ms, 'Cannot remove due date from a recurring task');
|
||||
|
||||
# Allow removal of the due date from a non-recurring task.
|
||||
qx{../task rc:bug.rc add nonrecurring};
|
||||
$output = qx{../task rc:bug.rc ls};
|
||||
my ($id) = $output =~ /(\d+)\s+nonrecurring/;
|
||||
$output = qx{../task rc:bug.rc $id due:};
|
||||
unlike ($output, qr/You cannot remove the due date from a recurring task./ms, 'Can remove due date from a non-recurring task');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bug.rc';
|
||||
ok (!-r 'bug.rc', 'Removed bug.rc');
|
||||
|
||||
exit 0;
|
||||
|
65
test/bug.368.t
Executable file
65
test/bug.368.t
Executable file
|
@ -0,0 +1,65 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"dateformat=m/d/Y\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Setup: Add a recurring task, generate an instance, then add a project.
|
||||
qx{../task rc:bug.rc add foo due:today recur:daily until:eom};
|
||||
my $output = qx{../task rc:bug.rc info 1};
|
||||
|
||||
# Result: Make sure the 'until' date is rendered as a date, not an epoch.
|
||||
unlike ($output, qr/Recur until\s+\d{10}/, 'until is not shown as an epoch');
|
||||
like ($output, qr/Recur until\s+\d+\/\d+\/\d{4}/, 'until is shown as a date');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bug.rc';
|
||||
ok (!-r 'bug.rc', 'Removed bug.rc');
|
||||
|
||||
exit 0;
|
||||
|
73
test/bug.414.t
Executable file
73
test/bug.414.t
Executable file
|
@ -0,0 +1,73 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 9;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Bug #414: Tags filtering not working with unicode characters
|
||||
|
||||
# Add a task with a UTF-8 tag.
|
||||
qx{../task rc:bug.rc add one +osobní};
|
||||
my $output = qx{../task rc:bug.rc ls +osobní};
|
||||
like ($output, qr/one/, 'found UTF8 tag osobní');
|
||||
|
||||
$output = qx{../task rc:bug.rc ls -osobní};
|
||||
unlike ($output, qr/one/, 'not found UTF8 tag osobní');
|
||||
|
||||
# And a different one
|
||||
qx{../task rc:bug.rc add two +föo};
|
||||
$output = qx{../task rc:bug.rc ls +föo};
|
||||
like ($output, qr/two/, 'found UTF8 tag föo');
|
||||
|
||||
$output = qx{../task rc:bug.rc ls -föo};
|
||||
unlike ($output, qr/two/, 'not found UTF8 tag föo');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bug.rc';
|
||||
ok (!-r 'bug.rc', 'Removed bug.rc');
|
||||
|
||||
exit 0;
|
||||
|
67
test/bug.417.t
Executable file
67
test/bug.417.t
Executable file
|
@ -0,0 +1,67 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"defaultwidth=100\n";
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Bug #417: Sorting by countdown_compact not working
|
||||
qx{../task rc:bug.rc add due:yesterday before};
|
||||
qx{../task rc:bug.rc add due:today now};
|
||||
qx{../task rc:bug.rc add due:tomorrow after};
|
||||
|
||||
my $output = qx{../task rc:bug.rc rc.report.long.sort:countdown+ long};
|
||||
like ($output, qr/before.+now.+after/ms, 'rc.report.long.sort:countdown+ works');
|
||||
|
||||
$output = qx{../task rc:bug.rc rc.report.long.sort:countdown- long};
|
||||
like ($output, qr/after.+now.+before/ms, 'rc.report.long.sort:countdown- works');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bug.rc';
|
||||
ok (!-r 'bug.rc', 'Removed bug.rc');
|
||||
|
||||
exit 0;
|
||||
|
96
test/bug.418.t
Executable file
96
test/bug.418.t
Executable file
|
@ -0,0 +1,96 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 23;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"dateformat=m/d/Y\n",
|
||||
"report.foo.description=Sample\n",
|
||||
"report.foo.columns=id,due,description\n",
|
||||
"report.foo.labels=ID,Due,Description\n",
|
||||
"report.foo.sort=due+\n",
|
||||
"report.foo.filter=status:pending\n",
|
||||
"report.foo.dateformat=MD\n";
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Bug #418: due.before:eow not working
|
||||
# - with dateformat is MD
|
||||
qx{../task rc:bug.rc add one due:6/28/2010};
|
||||
qx{../task rc:bug.rc add two due:6/29/2010};
|
||||
qx{../task rc:bug.rc add three due:6/30/2010};
|
||||
qx{../task rc:bug.rc add four due:7/1/2010};
|
||||
qx{../task rc:bug.rc add five due:7/2/2010};
|
||||
qx{../task rc:bug.rc add six due:7/3/2010};
|
||||
qx{../task rc:bug.rc add seven due:7/4/2010};
|
||||
qx{../task rc:bug.rc add eight due:7/5/2010};
|
||||
qx{../task rc:bug.rc add nine due:7/6/2010};
|
||||
|
||||
my $output = qx{../task rc:bug.rc foo};
|
||||
like ($output, qr/one/ms, 'task 1 listed');
|
||||
like ($output, qr/two/ms, 'task 2 listed');
|
||||
like ($output, qr/three/ms, 'task 3 listed');
|
||||
like ($output, qr/four/ms, 'task 4 listed');
|
||||
like ($output, qr/five/ms, 'task 5 listed');
|
||||
like ($output, qr/six/ms, 'task 6 listed');
|
||||
like ($output, qr/seven/ms, 'task 7 listed');
|
||||
like ($output, qr/eight/ms, 'task 8 listed');
|
||||
like ($output, qr/nine/ms, 'task 9 listed');
|
||||
|
||||
$output = qx{../task rc:bug.rc foo due.before:7/2/2010};
|
||||
like ($output, qr/one/ms, 'task 1 listed');
|
||||
like ($output, qr/two/ms, 'task 2 listed');
|
||||
like ($output, qr/three/ms, 'task 3 listed');
|
||||
like ($output, qr/four/ms, 'task 4 listed');
|
||||
unlike ($output, qr/five/ms, 'task 5 not listed');
|
||||
unlike ($output, qr/six/ms, 'task 6 not listed');
|
||||
unlike ($output, qr/seven/ms, 'task 7 not listed');
|
||||
unlike ($output, qr/eight/ms, 'task 8 not listed');
|
||||
unlike ($output, qr/nine/ms, 'task 9 not listed');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bug.rc';
|
||||
ok (!-r 'bug.rc', 'Removed bug.rc');
|
||||
|
||||
exit 0;
|
||||
|
67
test/bug.425.x
Executable file
67
test/bug.425.x
Executable file
|
@ -0,0 +1,67 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 6;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', '425.rc')
|
||||
{
|
||||
print $fh "data.location=.";
|
||||
|
||||
close $fh;
|
||||
ok (-r '425.rc', 'Created 425.rc');
|
||||
}
|
||||
|
||||
# Bug #425: Parser preventing editing of an existing task depending on description
|
||||
|
||||
# Create a task and attempt to revise the description to include the word 'in'
|
||||
# (this breaks in 1.9.3 and earlier)
|
||||
|
||||
qx{../task rc:425.rc add Foo};
|
||||
qx{../task rc:425.rc 1 Bar in Bar};
|
||||
|
||||
my $output = qx{../task rc:425.rc 1 ls};
|
||||
|
||||
like ($output, qr/1\s+Bar in Bar/m, 'parser - interpret \'in\' in description');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink '425.rc';
|
||||
ok (!-r '425.rc', 'Removed 425.rc');
|
||||
|
||||
exit 0;
|
62
test/bug.434.t
Executable file
62
test/bug.434.t
Executable file
|
@ -0,0 +1,62 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 6;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Bug #434: Task shouldn't prevent users from marking as done tasks with status:waiting
|
||||
|
||||
# Add a task that is waiting
|
||||
qx{../task rc:bug.rc add One wait:tomorrow};
|
||||
my $output = qx{../task rc:bug.rc do 1};
|
||||
like ($output, qr/Marked 1 task as done\./, 'Waiting task marked completed');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bug.rc';
|
||||
ok (!-r 'bug.rc', 'Removed bug.rc');
|
||||
|
||||
exit 0;
|
||||
|
97
test/bug.438.t
Executable file
97
test/bug.438.t
Executable file
|
@ -0,0 +1,97 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 11;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"dateformat=SNHDMY\n",
|
||||
"report.foo.columns=entry,start,end,description\n",
|
||||
"report.foo.dateformat=SNHDMY\n";
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Bug #438: Reports sorting by end, start, and entry are ordered incorrectly, if
|
||||
# time is included.
|
||||
|
||||
# Ensure the two tasks have a 1 second delta in entry.
|
||||
qx{../task rc:bug.rc add older};
|
||||
diag ("1 second delay");
|
||||
sleep 1;
|
||||
qx{../task rc:bug.rc add newer};
|
||||
|
||||
my $output = qx{../task rc:bug.rc rc.report.foo.sort:entry+ foo};
|
||||
like ($output, qr/older.+newer/ms, 'sort:entry+ -> older newer');
|
||||
|
||||
$output = qx{../task rc:bug.rc rc.report.foo.sort:entry- foo};
|
||||
like ($output, qr/newer.+older/ms, 'sort:entry- -> newer older');
|
||||
|
||||
# Ensure the two tasks have a 1 second delta in start.
|
||||
qx{../task rc:bug.rc start 1};
|
||||
diag ("1 second delay");
|
||||
sleep 1;
|
||||
qx{../task rc:bug.rc start 2};
|
||||
|
||||
$output = qx{../task rc:bug.rc rc.report.foo.sort:start+ foo};
|
||||
like ($output, qr/older.+newer/ms, 'sort:start+ -> older newer');
|
||||
|
||||
$output = qx{../task rc:bug.rc rc.report.foo.sort:start- foo};
|
||||
like ($output, qr/newer.+older/ms, 'sort:start- -> newer older');
|
||||
|
||||
# Ensure the two tasks have a 1 second delta in end.
|
||||
qx{../task rc:bug.rc done 1};
|
||||
diag ("1 second delay");
|
||||
sleep 1;
|
||||
qx{../task rc:bug.rc done 2};
|
||||
|
||||
$output = qx{../task rc:bug.rc rc.report.foo.sort:end+ foo};
|
||||
like ($output, qr/older.+newer/ms, 'sort:end+ -> older newer');
|
||||
|
||||
$output = qx{../task rc:bug.rc rc.report.foo.sort:end- foo};
|
||||
like ($output, qr/newer.+older/ms, 'sort:end- -> newer older');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bug.rc';
|
||||
ok (!-r 'bug.rc', 'Removed bug.rc');
|
||||
|
||||
exit 0;
|
||||
|
74
test/bug.440.t
Executable file
74
test/bug.440.t
Executable file
|
@ -0,0 +1,74 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 9;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', '440.rc')
|
||||
{
|
||||
print $fh "data.location=.";
|
||||
|
||||
close $fh;
|
||||
ok (-r '440.rc', 'Created 440.rc');
|
||||
}
|
||||
|
||||
# Bug #440: Parser recognizes an attempt to simultaneously subst and append, but doesn't do it
|
||||
|
||||
# Create a task and attempt simultaneous subst and appends, both permutations
|
||||
|
||||
qx{../task rc:440.rc add Foo};
|
||||
qx{../task rc:440.rc add Foo};
|
||||
|
||||
qx{../task rc:440.rc 1 /Foo/Bar/ append Appendtext};
|
||||
qx{../task rc:440.rc 2 append Appendtext /Foo/Bar/};
|
||||
|
||||
my $output1 = qx{../task rc:440.rc 1 ls};
|
||||
my $output2 = qx{../task rc:440.rc 2 ls};
|
||||
|
||||
unlike ($output1, qr/Foo/, 'simultaneous subst and append - subst');
|
||||
like ($output1, qr/\w+ Appendtext/, 'simultaneous subst and append - append');
|
||||
|
||||
unlike ($output2, qr/Foo/, 'simultaneous append and subst - subst');
|
||||
like ($output2, qr/\w+ Appendtext/, 'simultaneous append and subst - append');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink '440.rc';
|
||||
ok (!-r '440.rc', 'Removed 440.rc');
|
||||
|
||||
exit 0;
|
62
test/bug.441.t
Executable file
62
test/bug.441.t
Executable file
|
@ -0,0 +1,62 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 6;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', '441.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=off\n";
|
||||
|
||||
close $fh;
|
||||
ok (-r '441.rc', 'Created 441.rc');
|
||||
}
|
||||
|
||||
# Bug #441: A colon messes up text replacement with ///
|
||||
qx{../task rc:441.rc add one two three};
|
||||
qx{../task rc:441.rc 1 /two/two:/};
|
||||
my $output = qx{../task rc:441.rc ls};
|
||||
like ($output, qr/one two: three/ms, 'Substitution with colon worked');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink '441.rc';
|
||||
ok (!-r '441.rc', 'Removed 441.rc');
|
||||
|
||||
exit 0;
|
65
test/bug.455.t
Executable file
65
test/bug.455.t
Executable file
|
@ -0,0 +1,65 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', '455.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
|
||||
close $fh;
|
||||
ok (-r '455.rc', 'Created 455.rc');
|
||||
}
|
||||
|
||||
# Bug #455 - Text alignment in reports is broken when text contains utf8 characters
|
||||
|
||||
qx{../task rc:455.rc add abc pro:Bar\x{263A}};
|
||||
qx{../task rc:455.rc add def pro:Foo!};
|
||||
|
||||
my $output = qx{../task rc:455.rc ls};
|
||||
|
||||
like ($output, qr/\s{7}abc/ms, 'bug 455 - correct spacing in utf8 task');
|
||||
like ($output, qr/\s{7}def/ms, 'bug 455 - correct spacing in non utf8 task');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink '455.rc';
|
||||
ok (!-r '455.rc', 'Removed 455.rc');
|
||||
|
||||
exit 0;
|
63
test/bug.466.t
Executable file
63
test/bug.466.t
Executable file
|
@ -0,0 +1,63 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 6;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', '466.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"report.foo.description=DESC\n",
|
||||
"report.foo.columns=id,description\n",
|
||||
"report.foo.sort=id,description\n";
|
||||
|
||||
close $fh;
|
||||
ok (-r '466.rc', 'Created 466.rc');
|
||||
}
|
||||
|
||||
# Bug #466 - wrong error message when sort key missing +/-
|
||||
my $output = qx{../task rc:466.rc foo};
|
||||
like ($output, qr/Sort column 'id' does not have a \+\/- ascending\/descending indicator\./,
|
||||
'Error on missing sort direction');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink '466.rc';
|
||||
ok (!-r '466.rc', 'Removed 466.rc');
|
||||
|
||||
exit 0;
|
136
test/bug.480.t
Executable file
136
test/bug.480.t
Executable file
|
@ -0,0 +1,136 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 40;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Bug #480 - putting a '@' character in tags breaks filters.
|
||||
qx{../task rc:bug.rc add one +ordinary};
|
||||
qx{../task rc:bug.rc add two +\@strange};
|
||||
|
||||
my $output = qx{../task rc:bug.rc long +ordinary};
|
||||
like ($output, qr/one/, '+ordinary explicitly included');
|
||||
unlike ($output, qr/two/, '@strange implicitly excluded');
|
||||
|
||||
$output = qx{../task rc:bug.rc long -ordinary};
|
||||
unlike ($output, qr/one/, '-ordinary explicitly excluded');
|
||||
like ($output, qr/two/, '@strange implicitly included');
|
||||
|
||||
$output = qx{../task rc:bug.rc long +\@strange};
|
||||
unlike ($output, qr/one/, '-ordinary implicitly excluded');
|
||||
like ($output, qr/two/, '@strange explicitly included');
|
||||
|
||||
$output = qx{../task rc:bug.rc long -\@strange};
|
||||
like ($output, qr/one/, '+ordinary implicitly included');
|
||||
unlike ($output, qr/two/, '@strange explicitly excluded');
|
||||
|
||||
# Bug #XXX - '-t1 -t2' doesn't seem to work, when @ characters are involved.
|
||||
unlink 'pending.data';
|
||||
qx{../task rc:bug.rc add one +t1};
|
||||
qx{../task rc:bug.rc add two +t2};
|
||||
qx{../task rc:bug.rc add three +t3};
|
||||
|
||||
$output = qx{../task rc:bug.rc list -t1};
|
||||
unlike ($output, qr/one/, 'Single: no t1');
|
||||
like ($output, qr/two/, 'Single: yes t2');
|
||||
like ($output, qr/three/, 'Single: yes t3');
|
||||
|
||||
$output = qx{../task rc:bug.rc list -t1 -t2};
|
||||
unlike ($output, qr/one/, 'Double: no t1');
|
||||
unlike ($output, qr/two/, 'Double: no t2');
|
||||
like ($output, qr/three/, 'Double: yes t3');
|
||||
|
||||
$output = qx{../task rc:bug.rc list -t1 -t2 -t3};
|
||||
unlike ($output, qr/one/, 'Triple: no t1');
|
||||
unlike ($output, qr/two/, 'Triple: no t2');
|
||||
unlike ($output, qr/three/, 'Triple: no t3');
|
||||
|
||||
# Once again, with @ characters.
|
||||
qx{../task rc:bug.rc 1 +\@1};
|
||||
qx{../task rc:bug.rc 2 +\@2};
|
||||
qx{../task rc:bug.rc 3 +\@3};
|
||||
|
||||
$output = qx{../task rc:bug.rc list -\@1};
|
||||
unlike ($output, qr/one/, 'Single: no @1');
|
||||
like ($output, qr/two/, 'Single: yes @2');
|
||||
like ($output, qr/three/, 'Single: yes @3');
|
||||
|
||||
$output = qx{../task rc:bug.rc list -\@1 -\@2};
|
||||
unlike ($output, qr/one/, 'Double: no @1');
|
||||
unlike ($output, qr/two/, 'Double: no @2');
|
||||
like ($output, qr/three/, 'Double: yes @3');
|
||||
|
||||
$output = qx{../task rc:bug.rc list -\@1 -\@2 -\@3};
|
||||
unlike ($output, qr/one/, 'Triple: no @1');
|
||||
unlike ($output, qr/two/, 'Triple: no @2');
|
||||
unlike ($output, qr/three/, 'Triple: no @3');
|
||||
|
||||
# Once again, with @ characters and punctuation.
|
||||
qx{../task rc:bug.rc 1 +\@foo.1};
|
||||
qx{../task rc:bug.rc 2 +\@foo.2};
|
||||
qx{../task rc:bug.rc 3 +\@foo.3};
|
||||
|
||||
$output = qx{../task rc:bug.rc list -\@foo.1};
|
||||
unlike ($output, qr/one/, 'Single: no @foo.1');
|
||||
like ($output, qr/two/, 'Single: yes @foo.2');
|
||||
like ($output, qr/three/, 'Single: yes @foo.3');
|
||||
|
||||
$output = qx{../task rc:bug.rc list -\@foo.1 -\@foo.2};
|
||||
unlike ($output, qr/one/, 'Double: no @foo.1');
|
||||
unlike ($output, qr/two/, 'Double: no @foo.2');
|
||||
like ($output, qr/three/, 'Double: yes @foo.3');
|
||||
|
||||
$output = qx{../task rc:bug.rc list -\@foo.1 -\@foo.2 -\@foo.3};
|
||||
unlike ($output, qr/one/, 'Triple: no @foo.1');
|
||||
unlike ($output, qr/two/, 'Triple: no @foo.2');
|
||||
unlike ($output, qr/three/, 'Triple: no @foo.3');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bug.rc';
|
||||
ok (!-r 'bug.rc', 'Removed bug.rc');
|
||||
|
||||
exit 0;
|
66
test/bug.485.x
Executable file
66
test/bug.485.x
Executable file
|
@ -0,0 +1,66 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 9;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Bug #485 - 'task list recur:month' doesn't list monthly tasks
|
||||
qx{../task rc:bug.rc add one due:tomorrow recur:monthly};
|
||||
qx{../task rc:bug.rc add two due:tomorrow recur:month};
|
||||
my $output = qx{../task rc:bug.rc list recur:monthly};
|
||||
like ($output, qr/one/, 'monthly -> monthly');
|
||||
like ($output, qr/two/, 'month -> monthly');
|
||||
|
||||
$output = qx{../task rc:bug.rc list recur:month};
|
||||
like ($output, qr/one/, 'monthly -> month');
|
||||
like ($output, qr/two/, 'month -> month');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bug.rc';
|
||||
ok (!-r 'bug.rc', 'Removed bug.rc');
|
||||
|
||||
exit 0;
|
62
test/bug.489.t
Executable file
62
test/bug.489.t
Executable file
|
@ -0,0 +1,62 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Bug #489 - tags.none: is not filtering tagless tasks
|
||||
qx{../task rc:bug.rc add with +tag};
|
||||
qx{../task rc:bug.rc add without};
|
||||
my $output = qx{../task rc:bug.rc list tags.none:};
|
||||
unlike ($output, qr/with /, 'tags.none: skips tagged');
|
||||
like ($output, qr/without/, 'tags.none: finds tagless');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bug.rc';
|
||||
ok (!-r 'bug.rc', 'Removed bug.rc');
|
||||
|
||||
exit 0;
|
61
test/bug.495.t
Executable file
61
test/bug.495.t
Executable file
|
@ -0,0 +1,61 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 6;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Bug #495 - double hyphen mishandled for annotations.
|
||||
qx{../task rc:bug.rc add foo};
|
||||
qx{../task rc:bug.rc 1 annotate "This -- is -- a -- test"};
|
||||
my $output = qx{../task rc:bug.rc list};
|
||||
like ($output, qr/This -- is -- a -- test/, 'Double hyphens preserved.');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bug.rc';
|
||||
ok (!-r 'bug.rc', 'Removed bug.rc');
|
||||
|
||||
exit 0;
|
59
test/bug.555.t
Executable file
59
test/bug.555.t
Executable file
|
@ -0,0 +1,59 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 6;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
|
||||
close $fh;
|
||||
ok (-r 'bug.rc', 'Created bug.rc');
|
||||
}
|
||||
|
||||
# Bug #555 - log with a project segfaults.
|
||||
my $output = qx{../task rc:bug.rc log description project:p};
|
||||
unlike ($output, qr/Segmentation fault/, 'no segfault from log with project');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bug.rc';
|
||||
ok (!-r 'bug.rc', 'Removed bug.rc');
|
||||
|
||||
exit 0;
|
108
test/bug.580.t
Executable file
108
test/bug.580.t
Executable file
|
@ -0,0 +1,108 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 16;
|
||||
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.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{../task rc:remote.rc add remote task};
|
||||
|
||||
# add a local task
|
||||
qx(../task rc:local.rc add local task);
|
||||
|
||||
# merge and autopush
|
||||
qx{../task rc:local.rc merge};
|
||||
|
||||
my $output = qx{../task rc:remote.rc ls};
|
||||
like ($output, qr/local task/, "autopush failed");
|
||||
|
||||
# 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/undo.save';
|
||||
ok (!-r 'local/undo.save', 'Removed local/undo.save');
|
||||
|
||||
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;
|
64
test/bug.annotate.t
Executable file
64
test/bug.annotate.t
Executable file
|
@ -0,0 +1,64 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug_annotate.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'bug_annotate.rc', 'Created bug_annotate.rc');
|
||||
}
|
||||
|
||||
# Attempt a blank annotation.
|
||||
qx{../task rc:bug_annotate.rc add foo};
|
||||
my $output = qx{../task rc:bug_annotate.rc 1 annotate};
|
||||
like ($output, qr/Cannot apply a blank annotation./, 'failed on blank annotation');
|
||||
|
||||
# Attempt an annotation without ID
|
||||
$output = qx{../task rc:bug_annotate.rc annotate bar};
|
||||
like ($output, qr/ID needed to apply an annotation./, 'failed on annotation without ID');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bug_annotate.rc';
|
||||
ok (!-r 'bug_annotate.rc', 'Removed bug_annotate.rc');
|
||||
|
||||
exit 0;
|
||||
|
85
test/bug.annual.t
Executable file
85
test/bug.annual.t
Executable file
|
@ -0,0 +1,85 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 15;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'annual.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'annual.rc', 'Created annual.rc');
|
||||
}
|
||||
|
||||
# If a task is added with a due date ten years ago, with an annual recurrence,
|
||||
# then the synthetic tasks in between then and now have a due date that creeps.
|
||||
#
|
||||
# ID Project Pri Due Active Age Description
|
||||
# -- ------- --- ---------- ------ --- -----------
|
||||
# 1 1/1/2000 - foo
|
||||
# 2 12/31/2000 - foo
|
||||
# 3 12/31/2001 - foo
|
||||
# 4 12/31/2002 - foo
|
||||
# 5 12/31/2003 - foo
|
||||
# 6 12/30/2004 - foo
|
||||
# 7 12/30/2005 - foo
|
||||
# 8 12/30/2006 - foo
|
||||
# 9 12/30/2007 - foo
|
||||
# 10 12/29/2008 - foo
|
||||
# 11 12/29/2009 - foo
|
||||
|
||||
qx{../task rc:annual.rc add foo due:1/1/2000 recur:annual until:1/1/2009};
|
||||
my $output = qx{../task rc:annual.rc list};
|
||||
like ($output, qr/1\s+1\/1\/2000\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 1 no creep');
|
||||
like ($output, qr/2\s+1\/1\/2001\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 2 no creep');
|
||||
like ($output, qr/3\s+1\/1\/2002\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 3 no creep');
|
||||
like ($output, qr/4\s+1\/1\/2003\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 4 no creep');
|
||||
like ($output, qr/5\s+1\/1\/2004\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 5 no creep');
|
||||
like ($output, qr/6\s+1\/1\/2005\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 6 no creep');
|
||||
like ($output, qr/7\s+1\/1\/2006\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 7 no creep');
|
||||
like ($output, qr/8\s+1\/1\/2007\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 8 no creep');
|
||||
like ($output, qr/9\s+1\/1\/2008\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 9 no creep');
|
||||
like ($output, qr/10\s+1\/1\/2009\s+(?:-|\d+\ssecs?)\s+foo/, 'synthetic 10 no creep');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'annual.rc';
|
||||
ok (!-r 'annual.rc', 'Removed annual.rc');
|
||||
|
||||
exit 0;
|
||||
|
97
test/bug.before.t
Executable file
97
test/bug.before.t
Executable file
|
@ -0,0 +1,97 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 20;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'before.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n",
|
||||
"dateformat=m/d/Y\n";
|
||||
close $fh;
|
||||
ok (-r 'before.rc', 'Created before.rc');
|
||||
}
|
||||
|
||||
# Create some exampel data directly.
|
||||
if (open my $fh, '>', 'pending.data')
|
||||
{
|
||||
# 1229947200 = 12/22/2008
|
||||
# 1240000000 = 4/17/2009
|
||||
print $fh <<EOF;
|
||||
[description:"foo" entry:"1229947200" start:"1229947200" status:"pending" uuid:"27097693-91c2-4cbe-ba89-ddcc87e5582c"]
|
||||
[description:"bar" entry:"1240000000" start:"1240000000" status:"pending" uuid:"08f72d91-964c-424b-8fd5-556434648b6b"]
|
||||
EOF
|
||||
|
||||
close $fh;
|
||||
ok (-r 'pending.data', 'Created pending.data');
|
||||
}
|
||||
|
||||
# Verify data is readable and just as expected.
|
||||
my $output = qx{../task rc:before.rc 1 info};
|
||||
like ($output, qr/Start\s+12\/22\/2008/, 'task 1 start date as expected');
|
||||
|
||||
$output = qx{../task rc:before.rc 2 info};
|
||||
like ($output, qr/Start\s+4\/17\/2009/, 'task 2 start date as expected');
|
||||
|
||||
$output = qx{../task rc:before.rc ls start.before:12/1/2008};
|
||||
unlike ($output, qr/foo/, 'no foo before 12/1/2008');
|
||||
unlike ($output, qr/bar/, 'no bar before 12/1/2008');
|
||||
$output = qx{../task rc:before.rc ls start.before:1/1/2009};
|
||||
like ($output, qr/foo/, 'foo before 1/1/2009');
|
||||
unlike ($output, qr/bar/, 'no bar before 1/1/2009');
|
||||
$output = qx{../task rc:before.rc ls start.before:5/1/2009};
|
||||
like ($output, qr/foo/, 'foo before 5/1/2009');
|
||||
like ($output, qr/bar/, 'bar before 5/1/2009');
|
||||
$output = qx{../task rc:before.rc ls start.after:12/1/2008};
|
||||
like ($output, qr/foo/, 'foo after 12/1/2008');
|
||||
like ($output, qr/bar/, 'bar after 12/1/2008');
|
||||
$output = qx{../task rc:before.rc ls start.after:1/1/2009};
|
||||
unlike ($output, qr/foo/, 'no foo after 1/1/2009');
|
||||
like ($output, qr/bar/, 'bar after 1/1/2009');
|
||||
$output = qx{../task rc:before.rc ls start.after:5/1/2009};
|
||||
unlike ($output, qr/foo/, 'no foo after 5/1/2009');
|
||||
unlike ($output, qr/bar/, 'no bar after 5/1/2009');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'before.rc';
|
||||
ok (!-r 'before.rc', 'Removed before.rc');
|
||||
|
||||
exit 0;
|
||||
|
86
test/bug.bulk.t
Executable file
86
test/bug.bulk.t
Executable file
|
@ -0,0 +1,86 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 15;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bulk.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=yes\n",
|
||||
"bulk=2\n";
|
||||
close $fh;
|
||||
ok (-r 'bulk.rc', 'Created bulk.rc');
|
||||
}
|
||||
|
||||
# Add some tasks with project, prioriy and due date, some with only due date.
|
||||
# Bulk add a project and priority to the tasks that were without.
|
||||
qx{../task rc:bulk.rc add t1 pro:p1 pri:H due:monday};
|
||||
qx{../task rc:bulk.rc add t2 pro:p1 pri:M due:tuesday};
|
||||
qx{../task rc:bulk.rc add t3 pro:p1 pri:L due:wednesday};
|
||||
qx{../task rc:bulk.rc add t4 due:thursday};
|
||||
qx{../task rc:bulk.rc add t5 due:friday};
|
||||
qx{../task rc:bulk.rc add t6 due:saturday};
|
||||
|
||||
my $output = qx{echo "quit"|../task rc:bulk.rc pro:p1 pri:M 4 5 6};
|
||||
like ($output, qr/Modified 0 tasks/, '"quit" prevents any further modifications');
|
||||
|
||||
$output = qx{echo "All"|../task rc:bulk.rc pro:p1 pri:M 4 5 6};
|
||||
unlike ($output, qr/Task 4 "t4"\n - No changes were made/, 'Task 4 modified');
|
||||
unlike ($output, qr/Task 5 "t5"\n - No changes were made/, 'Task 5 modified');
|
||||
unlike ($output, qr/Task 6 "t6"\n - No changes were made/, 'Task 6 modified');
|
||||
|
||||
$output = qx{../task rc:bulk.rc info 4};
|
||||
like ($output, qr/Project\s+p1/, 'project applied to 4');
|
||||
like ($output, qr/Priority\s+M/, 'priority applied to 4');
|
||||
|
||||
$output = qx{../task rc:bulk.rc info 5};
|
||||
like ($output, qr/Project\s+p1/, 'project applied to 5');
|
||||
like ($output, qr/Priority\s+M/, 'priority applied to 5');
|
||||
|
||||
$output = qx{../task rc:bulk.rc info 6};
|
||||
like ($output, qr/Project\s+p1/, 'project applied to 6');
|
||||
like ($output, qr/Priority\s+M/, 'priority applied to 6');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bulk.rc';
|
||||
ok (!-r 'bulk.rc', 'Removed bulk.rc');
|
||||
|
||||
exit 0;
|
||||
|
119
test/bug.cal.t
Executable file
119
test/bug.cal.t
Executable file
|
@ -0,0 +1,119 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 32;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'cal.rc')
|
||||
{
|
||||
print $fh "data.location=.";
|
||||
|
||||
close $fh;
|
||||
ok (-r 'cal.rc', 'Created cal.rc');
|
||||
}
|
||||
|
||||
# Bug: The 'cal' command can fail when provided with challenging arguments.
|
||||
|
||||
# Should not fail (because they are correct):
|
||||
my $output = qx{../task rc:cal.rc cal 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal');
|
||||
|
||||
# y due 2010 donkey 8
|
||||
$output = qx{../task rc:cal.rc cal y 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal y');
|
||||
$output = qx{../task rc:cal.rc cal 8 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal 8');
|
||||
$output = qx{../task rc:cal.rc cal due 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal due');
|
||||
$output = qx{../task rc:cal.rc cal 2010 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal 2010');
|
||||
$output = qx{../task rc:cal.rc cal donkey 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal donkey');
|
||||
|
||||
# y due 2010 donkey 8
|
||||
$output = qx{../task rc:cal.rc cal y due 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal y due');
|
||||
$output = qx{../task rc:cal.rc cal y 8 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal y 8');
|
||||
$output = qx{../task rc:cal.rc cal y 2010 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal y 2010');
|
||||
$output = qx{../task rc:cal.rc cal y donkey 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal y donkey');
|
||||
$output = qx{../task rc:cal.rc cal 8 due 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal 8 due');
|
||||
$output = qx{../task rc:cal.rc cal 8 2010 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal 8 2010');
|
||||
$output = qx{../task rc:cal.rc cal 8 donkey 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal 8 donkey');
|
||||
$output = qx{../task rc:cal.rc cal due 2010 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal due 2010');
|
||||
$output = qx{../task rc:cal.rc cal due donkey 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal due donkey');
|
||||
$output = qx{../task rc:cal.rc cal 2010 donkey 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal 2010 donkey');
|
||||
|
||||
# y 8 due 2010 donkey
|
||||
$output = qx{../task rc:cal.rc cal y 8 due 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal y 8 due');
|
||||
$output = qx{../task rc:cal.rc cal y 8 2010 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal y 8 2010');
|
||||
$output = qx{../task rc:cal.rc cal y 8 donkey 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal y 8 donkey');
|
||||
$output = qx{../task rc:cal.rc cal y due 2010 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal y due 2010');
|
||||
$output = qx{../task rc:cal.rc cal y due donkey 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal y due donkey');
|
||||
$output = qx{../task rc:cal.rc cal y 2010 donkey 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal y 2010 donkey');
|
||||
$output = qx{../task rc:cal.rc cal 8 due 2010 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal 8 due 2010');
|
||||
$output = qx{../task rc:cal.rc cal 8 due donkey 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal 8 due donkey');
|
||||
$output = qx{../task rc:cal.rc cal 8 2010 donkey 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal 8 2010 donkey');
|
||||
$output = qx{../task rc:cal.rc cal due 2010 8 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal due 2010 8');
|
||||
$output = qx{../task rc:cal.rc cal due 2010 donkey 2>&1};
|
||||
unlike ($output, qr/(?:Assertion failed|Could note recognize|not a valid)/, 'cal due 2010 donkey');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'cal.rc';
|
||||
ok (!-r 'cal.rc', 'Removed cal.rc');
|
||||
|
||||
exit 0;
|
84
test/bug.concat.t
Executable file
84
test/bug.concat.t
Executable file
|
@ -0,0 +1,84 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 8;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug_concat.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'bug_concat.rc', 'Created bug_concat.rc');
|
||||
}
|
||||
|
||||
# When a task is modified like this:
|
||||
#
|
||||
# % task 1 This is a new description
|
||||
#
|
||||
# The arguments are concatenated thus:
|
||||
#
|
||||
# Thisisanewdescription
|
||||
|
||||
qx{../task rc:bug_concat.rc add This is the original text};
|
||||
my $output = qx{../task rc:bug_concat.rc info 1};
|
||||
like ($output, qr/Description\s+This is the original text\n/, 'original correct');
|
||||
|
||||
qx{../task rc:bug_concat.rc 1 This is the modified text};
|
||||
$output = qx{../task rc:bug_concat.rc info 1};
|
||||
like ($output, qr/Description\s+This is the modified text\n/, 'modified correct');
|
||||
|
||||
# When a task is added like this:
|
||||
#
|
||||
# % task add aaa bbb:ccc ddd
|
||||
#
|
||||
# The description is concatenated thus:
|
||||
#
|
||||
# aaabbb:ccc ddd
|
||||
|
||||
qx{../task rc:bug_concat.rc add aaa bbb:ccc ddd};
|
||||
$output = qx{../task rc:bug_concat.rc info 2};
|
||||
like ($output, qr/Description\s+aaa bbb:ccc ddd\n/, 'properly concatenated');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bug_concat.rc';
|
||||
ok (!-r 'bug_concat.rc', 'Removed bug_concat.rc');
|
||||
|
||||
exit 0;
|
||||
|
89
test/bug.hang.t
Executable file
89
test/bug.hang.t
Executable file
|
@ -0,0 +1,89 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'hang.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"shadow.file=shadow.txt\n",
|
||||
"shadow.command=list\n";
|
||||
close $fh;
|
||||
ok (-r 'hang.rc', 'Created hang.rc');
|
||||
}
|
||||
|
||||
=pod
|
||||
I found a bug in the current version of task. Using recur and a shadow file will
|
||||
lead to an infinite loop. To reproduce it, define a shadow file in the .taskrc,
|
||||
set a command for it that rebuilds the database, e.g. "list", and then add a
|
||||
task with a recurrence set, e.g. "task add due:today recur:1d infinite loop".
|
||||
Task will then loop forever and add the same recurring task until it runs out of
|
||||
memory. So I checked the source and I believe I found the cause.
|
||||
handleRecurrence() in task.cpp will modify the mask, but writes it only after it
|
||||
has added all new tasks. Adding the task will, however, invoke onChangeCallback,
|
||||
which starts the same process all over again.
|
||||
=cut
|
||||
|
||||
eval
|
||||
{
|
||||
$SIG{'ALRM'} = sub {die "alarm\n"};
|
||||
alarm 10;
|
||||
my $output = qx{../task rc:hang.rc list;
|
||||
../task rc:hang.rc add due:today recur:1d infinite loop;
|
||||
../task rc:hang.rc info 1};
|
||||
alarm 0;
|
||||
|
||||
like ($output, qr/^Description\s+infinite loop\n/m, 'no hang');
|
||||
};
|
||||
|
||||
if ($@ eq "alarm\n")
|
||||
{
|
||||
fail ('task hang on add or recurring task, with shadow file, for 10s');
|
||||
}
|
||||
|
||||
# Cleanup.
|
||||
unlink 'shadow.txt';
|
||||
ok (!-r 'shadow.txt', 'Removed shadow.txt');
|
||||
|
||||
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');
|
||||
|
||||
unlink 'hang.rc';
|
||||
ok (!-r 'hang.rc', 'Removed hang.rc');
|
||||
|
||||
exit 0;
|
||||
|
107
test/bug.hasnt.t
Executable file
107
test/bug.hasnt.t
Executable file
|
@ -0,0 +1,107 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 19;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'hasnt.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'hasnt.rc', 'Created hasnt.rc');
|
||||
}
|
||||
|
||||
# 1
|
||||
qx{../task rc:hasnt.rc add foo};
|
||||
|
||||
# 2
|
||||
qx{../task rc:hasnt.rc add foo};
|
||||
qx{../task rc:hasnt.rc 2 annotate bar};
|
||||
|
||||
# 3
|
||||
qx{../task rc:hasnt.rc add foo};
|
||||
qx{../task rc:hasnt.rc 3 annotate bar};
|
||||
diag ("3 second delay");
|
||||
sleep 1;
|
||||
qx{../task rc:hasnt.rc 3 annotate baz};
|
||||
|
||||
# 4
|
||||
qx{../task rc:hasnt.rc add bar};
|
||||
|
||||
# 5
|
||||
qx{../task rc:hasnt.rc add bar};
|
||||
qx{../task rc:hasnt.rc 5 annotate foo};
|
||||
|
||||
# 6
|
||||
qx{../task rc:hasnt.rc add bar};
|
||||
qx{../task rc:hasnt.rc 6 annotate foo};
|
||||
sleep 1;
|
||||
qx{../task rc:hasnt.rc 6 annotate baz};
|
||||
|
||||
#7
|
||||
qx{../task rc:hasnt.rc add one};
|
||||
qx{../task rc:hasnt.rc 7 annotate two};
|
||||
sleep 1;
|
||||
qx{../task rc:hasnt.rc 7 annotate three};
|
||||
|
||||
my $output = qx{../task rc:hasnt.rc ls description.has:foo};
|
||||
like ($output, qr/\n 1/, '1 has foo -> yes');
|
||||
like ($output, qr/\n 2/, '2 has foo -> yes');
|
||||
like ($output, qr/\n 3/, '3 has foo -> yes');
|
||||
unlike ($output, qr/\n 4/, '4 has foo -> no');
|
||||
like ($output, qr/\n 5/, '5 has foo -> yes');
|
||||
like ($output, qr/\n 6/, '6 has foo -> yes');
|
||||
unlike ($output, qr/\n 7/, '7 has foo -> no');
|
||||
|
||||
$output = qx{../task rc:hasnt.rc ls description.hasnt:foo};
|
||||
unlike ($output, qr/\n 1/, '1 hasnt foo -> no');
|
||||
unlike ($output, qr/\n 2/, '2 hasnt foo -> no');
|
||||
unlike ($output, qr/\n 3/, '3 hasnt foo -> no');
|
||||
like ($output, qr/\n 4/, '4 hasnt foo -> yes');
|
||||
unlike ($output, qr/\n 5/, '5 hasnt foo -> no');
|
||||
unlike ($output, qr/\n 6/, '6 hasnt foo -> no');
|
||||
like ($output, qr/\n 7/, '7 hasnt foo -> yes');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'hasnt.rc';
|
||||
ok (!-r 'hasnt.rc', 'Removed hasnt.rc');
|
||||
|
||||
exit 0;
|
||||
|
170
test/bug.period.t
Executable file
170
test/bug.period.t
Executable file
|
@ -0,0 +1,170 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 43;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'period.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'period.rc', 'Created period.rc');
|
||||
}
|
||||
|
||||
=pod
|
||||
http://github.com/pbeckingham/task/blob/857f813a24f7ce15fea9f2c28aadad84cb5c8847/src/task.cpp
|
||||
619 // If the period is an 'easy' one, add it to current, and we're done.
|
||||
620 int days = convertDuration (period);
|
||||
|
||||
Date getNextRecurrence (Date& current, std::string& period)
|
||||
|
||||
starting at line 509 special cases several possibilities for period, '\d\s?m'
|
||||
'monthly', 'quarterly', 'semiannual', 'bimonthly', 'biannual', 'biyearly'.
|
||||
Everything else falls through with period being passed to convertDuration.
|
||||
convertDuration doesn't know about 'daily' though so it seems to be returning 0.
|
||||
|
||||
Confirmed:
|
||||
getNextRecurrence convertDuration
|
||||
----------------- ---------------
|
||||
daily
|
||||
day
|
||||
weekly
|
||||
sennight
|
||||
biweekly
|
||||
fortnight
|
||||
monthly monthly
|
||||
quarterly quarterly
|
||||
semiannual semiannual
|
||||
bimonthly bimonthly
|
||||
biannual biannual
|
||||
biyearly biyearly
|
||||
annual
|
||||
yearly
|
||||
*m *m
|
||||
*q *q
|
||||
*d
|
||||
*w
|
||||
*y
|
||||
=cut
|
||||
|
||||
my $output = qx{../task rc:period.rc add daily due:tomorrow recur:daily};
|
||||
unlike ($output, qr/was not recognized/, 'recur:daily');
|
||||
|
||||
$output = qx{../task rc:period.rc add day due:tomorrow recur:day};
|
||||
unlike ($output, qr/was not recognized/, 'recur:day');
|
||||
|
||||
$output = qx{../task rc:period.rc add weekly due:tomorrow recur:weekly};
|
||||
unlike ($output, qr/was not recognized/, 'recur:weekly');
|
||||
|
||||
$output = qx{../task rc:period.rc add sennight due:tomorrow recur:sennight};
|
||||
unlike ($output, qr/was not recognized/, 'recur:sennight');
|
||||
|
||||
$output = qx{../task rc:period.rc add biweekly due:tomorrow recur:biweekly};
|
||||
unlike ($output, qr/was not recognized/, 'recur:biweekly');
|
||||
|
||||
$output = qx{../task rc:period.rc add fortnight due:tomorrow recur:fortnight};
|
||||
unlike ($output, qr/was not recognized/, 'recur:fortnight');
|
||||
|
||||
$output = qx{../task rc:period.rc add monthly due:tomorrow recur:monthly};
|
||||
unlike ($output, qr/was not recognized/, 'recur:monthly');
|
||||
|
||||
$output = qx{../task rc:period.rc add quarterly due:tomorrow recur:quarterly};
|
||||
unlike ($output, qr/was not recognized/, 'recur:quarterly');
|
||||
|
||||
$output = qx{../task rc:period.rc add semiannual due:tomorrow recur:semiannual};
|
||||
unlike ($output, qr/was not recognized/, 'recur:semiannual');
|
||||
|
||||
$output = qx{../task rc:period.rc add bimonthly due:tomorrow recur:bimonthly};
|
||||
unlike ($output, qr/was not recognized/, 'recur:bimonthly');
|
||||
|
||||
$output = qx{../task rc:period.rc add biannual due:tomorrow recur:biannual};
|
||||
unlike ($output, qr/was not recognized/, 'recur:biannual');
|
||||
|
||||
$output = qx{../task rc:period.rc add biyearly due:tomorrow recur:biyearly};
|
||||
unlike ($output, qr/was not recognized/, 'recur:biyearly');
|
||||
|
||||
$output = qx{../task rc:period.rc add annual due:tomorrow recur:annual};
|
||||
unlike ($output, qr/was not recognized/, 'recur:annual');
|
||||
|
||||
$output = qx{../task rc:period.rc add yearly due:tomorrow recur:yearly};
|
||||
unlike ($output, qr/was not recognized/, 'recur:yearly');
|
||||
|
||||
$output = qx{../task rc:period.rc add 2d due:tomorrow recur:2d};
|
||||
unlike ($output, qr/was not recognized/, 'recur:2d');
|
||||
|
||||
$output = qx{../task rc:period.rc add 2w due:tomorrow recur:2w};
|
||||
unlike ($output, qr/was not recognized/, 'recur:2w');
|
||||
|
||||
$output = qx{../task rc:period.rc add 2m due:tomorrow recur:2mo};
|
||||
unlike ($output, qr/was not recognized/, 'recur:2m');
|
||||
|
||||
$output = qx{../task rc:period.rc add 2q due:tomorrow recur:2q};
|
||||
unlike ($output, qr/was not recognized/, 'recur:2q');
|
||||
|
||||
$output = qx{../task rc:period.rc add 2y due:tomorrow recur:2y};
|
||||
unlike ($output, qr/was not recognized/, 'recur:2y');
|
||||
|
||||
# Verify that the recurring task instances get created. One of each.
|
||||
$output = qx{../task rc:period.rc list};
|
||||
like ($output, qr/\bdaily\b/, 'verify daily');
|
||||
like ($output, qr/\bday\b/, 'verify day');
|
||||
like ($output, qr/\bweekly\b/, 'verify weekly');
|
||||
like ($output, qr/\bsennight\b/, 'verify sennight');
|
||||
like ($output, qr/\bbiweekly\b/, 'verify biweekly');
|
||||
like ($output, qr/\bfortnight\b/, 'verify fortnight');
|
||||
like ($output, qr/\bmonthly\b/, 'verify monthly');
|
||||
like ($output, qr/\bquarterly\b/, 'verify quarterly');
|
||||
like ($output, qr/\bsemiannual\b/, 'verify semiannual');
|
||||
like ($output, qr/\bbimonthly\b/, 'verify bimonthly');
|
||||
like ($output, qr/\bbiannual\b/, 'verify biannual');
|
||||
like ($output, qr/\bbiyearly\b/, 'verify biyearly');
|
||||
like ($output, qr/\bannual\b/, 'verify annual');
|
||||
like ($output, qr/\byearly\b/, 'verify yearly');
|
||||
like ($output, qr/\b2d\b/, 'verify 2d');
|
||||
like ($output, qr/\b2w\b/, 'verify 2w');
|
||||
like ($output, qr/\b2m\b/, 'verify 2m');
|
||||
like ($output, qr/\b2q\b/, 'verify 2q');
|
||||
like ($output, qr/\b2y\b/, 'verify 2y');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'period.rc';
|
||||
ok (!-r 'period.rc', 'Removed period.rc');
|
||||
|
||||
exit 0;
|
||||
|
65
test/bug.range.t
Executable file
65
test/bug.range.t
Executable file
|
@ -0,0 +1,65 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 8;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'range.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'range.rc', 'Created range.rc');
|
||||
}
|
||||
|
||||
# Add three tasks, and attempt to list the middle one within a range.
|
||||
qx{../task rc:range.rc add one due:8/1/2009};
|
||||
qx{../task rc:range.rc add two due:8/3/2009};
|
||||
qx{../task rc:range.rc add three due:8/5/2009};
|
||||
my $output = qx{../task rc:range.rc ls due.after:8/2/2009 due.before:8/4/2009};
|
||||
unlike ($output, qr/one/, 'Missing prior to range');
|
||||
like ($output, qr/two/, 'Found within range');
|
||||
unlike ($output, qr/three/, 'Missing after range');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'range.rc';
|
||||
ok (!-r 'range.rc', 'Removed range.rc');
|
||||
|
||||
exit 0;
|
||||
|
61
test/bug.recur.t
Executable file
61
test/bug.recur.t
Executable file
|
@ -0,0 +1,61 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 6;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'recur.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'recur.rc', 'Created recur.rc');
|
||||
}
|
||||
|
||||
# Add a recurring task with no due date, look for expected error.
|
||||
qx{../task rc:recur.rc add foo recur:daily};
|
||||
my $output = qx{../task rc:recur.rc info 1};
|
||||
unlike ($output, qr/Description\s+foo/, 'task not created - missing due date');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'recur.rc';
|
||||
ok (!-r 'recur.rc', 'Removed recur.rc');
|
||||
|
||||
exit 0;
|
||||
|
67
test/bug.sort.t
Executable file
67
test/bug.sort.t
Executable file
|
@ -0,0 +1,67 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'bug_sort.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'bug_sort.rc', 'Created bug_sort.rc');
|
||||
}
|
||||
|
||||
my $setup = "../task rc:bug_sort.rc add one;"
|
||||
. "../task rc:bug_sort.rc add two;"
|
||||
. "../task rc:bug_sort.rc add three recur:daily due:eom;";
|
||||
qx{$setup};
|
||||
|
||||
my $output = qx{../task rc:bug_sort.rc list};
|
||||
like ($output, qr/three.*(?:one.*two|two.*one)/msi, 'list did not hang');
|
||||
|
||||
qx{../task rc:bug_sort.rc 1 priority:H};
|
||||
$output = qx{../task rc:bug_sort.rc list};
|
||||
like ($output, qr/three.*one.*two/msi, 'list did not hang after pri:H on 1');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'bug_sort.rc';
|
||||
ok (!-r 'bug_sort.rc', 'Removed bug_sort.rc');
|
||||
|
||||
exit 0;
|
||||
|
62
test/bug.start.extra.t
Executable file
62
test/bug.start.extra.t
Executable file
|
@ -0,0 +1,62 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'extra.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'extra.rc', 'Created extra.rc');
|
||||
}
|
||||
|
||||
qx{../task rc:extra.rc add foo};
|
||||
my $output = qx{../task rc:extra.rc 1 start pri:L};
|
||||
like ($output, qr/The 'start' command does not allow further modification of a task\./, 'no modifications allowed for start');
|
||||
$output = qx{../task rc:extra.rc 1 stop pro:bar};
|
||||
like ($output, qr/The 'stop' command does not allow further modification of a task\./, 'no modifications allowed for stop');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'extra.rc';
|
||||
ok (!-r 'extra.rc', 'Removed extra.rc');
|
||||
|
||||
exit 0;
|
||||
|
70
test/bug.summary.t
Executable file
70
test/bug.summary.t
Executable file
|
@ -0,0 +1,70 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'summary.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'summary.rc', 'Created summary.rc');
|
||||
}
|
||||
|
||||
# Add three tasks. Do 1, delete 1, leave 1 pending. Summary should depict a
|
||||
# 50% completion.
|
||||
qx{../task rc:summary.rc add project:A one};
|
||||
qx{../task rc:summary.rc add project:A two};
|
||||
qx{../task rc:summary.rc add project:A three};
|
||||
qx{../task rc:summary.rc do 1};
|
||||
qx{../task rc:summary.rc delete 2};
|
||||
my $output = qx{../task rc:summary.rc summary};
|
||||
like ($output, qr/A\s+1\s+(?:-|\d\ssecs?)\s+50%/, 'summary correctly shows 50% before report');
|
||||
|
||||
qx{../task rc:summary.rc list};
|
||||
$output = qx{../task rc:summary.rc summary};
|
||||
like ($output, qr/A\s+1\s+(?:-|\d\ssecs?)\s+50%/, 'summary correctly shows 50% after report');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'summary.rc';
|
||||
ok (!-r 'summary.rc', 'Removed summary.rc');
|
||||
|
||||
exit 0;
|
||||
|
98
test/bug.uuid.t
Executable file
98
test/bug.uuid.t
Executable file
|
@ -0,0 +1,98 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'uuid.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'uuid.rc', 'Created uuid.rc');
|
||||
}
|
||||
|
||||
# Add a task, dup it, add a recurring task, list. Then make sure they all have
|
||||
# unique UUID values.
|
||||
qx{../task rc:uuid.rc add simple};
|
||||
qx{../task rc:uuid.rc 1 duplicate};
|
||||
qx{../task rc:uuid.rc add periodic recur:daily due:yesterday};
|
||||
my $output = qx{../task rc:uuid.rc stats};
|
||||
|
||||
my @all_uuids;
|
||||
my %unique_uuids;
|
||||
$output = qx{../task rc:uuid.rc 1 info};
|
||||
my ($uuid) = $output =~ /UUID\s+(\S+)/;
|
||||
push @all_uuids, $uuid;
|
||||
$unique_uuids{$uuid} = undef;
|
||||
|
||||
$output = qx{../task rc:uuid.rc 2 info};
|
||||
($uuid) = $output =~ /UUID\s+(\S+)/;
|
||||
push @all_uuids, $uuid;
|
||||
$unique_uuids{$uuid} = undef;
|
||||
|
||||
$output = qx{../task rc:uuid.rc 3 info};
|
||||
($uuid) = $output =~ /UUID\s+(\S+)/;
|
||||
push @all_uuids, $uuid;
|
||||
$unique_uuids{$uuid} = undef;
|
||||
|
||||
$output = qx{../task rc:uuid.rc 4 info};
|
||||
($uuid) = $output =~ /UUID\s+(\S+)/;
|
||||
push @all_uuids, $uuid;
|
||||
$unique_uuids{$uuid} = undef;
|
||||
|
||||
$output = qx{../task rc:uuid.rc 5 info};
|
||||
($uuid) = $output =~ /UUID\s+(\S+)/;
|
||||
push @all_uuids, $uuid;
|
||||
$unique_uuids{$uuid} = undef;
|
||||
|
||||
$output = qx{../task rc:uuid.rc 6 info};
|
||||
($uuid) = $output =~ /UUID\s+(\S+)/;
|
||||
push @all_uuids, $uuid;
|
||||
$unique_uuids{$uuid} = undef;
|
||||
|
||||
is (scalar (@all_uuids), 6, '6 tasks created');
|
||||
is (scalar (keys %unique_uuids), 6, '6 unique UUIDs');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'uuid.rc';
|
||||
ok (!-r 'uuid.rc', 'Removed uuid.rc');
|
||||
|
||||
exit 0;
|
||||
|
273
test/cal.t
Executable file
273
test/cal.t
Executable file
|
@ -0,0 +1,273 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## Unit test cal.t originally writen by Federico Hernandez
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 87;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'cal.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"dateformat=YMD\n",
|
||||
"color=on\n",
|
||||
"color.calendar.today=black on cyan\n",
|
||||
"color.calendar.due=black on green\n",
|
||||
"color.calendar.weeknumber=black on white\n",
|
||||
"color.calendar.overdue=black on red\n",
|
||||
"color.calendar.weekend=white on bright black\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'cal.rc', 'Created cal.rc');
|
||||
}
|
||||
|
||||
my @months = qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
|
||||
my ($nday, $nmon, $nyear, $wday) = (localtime)[3,4,5,6];
|
||||
my $day = $nday;
|
||||
my $prevmonth = $months[($nmon-1) % 12];
|
||||
my $month = $months[($nmon) % 12];
|
||||
my $nextmonth = $months[($nmon+1) % 12];
|
||||
my $prevyear = $nyear + 1899;
|
||||
my $year = $nyear + 1900;
|
||||
my $nextyear = $nyear + 1901;
|
||||
|
||||
if ($day <= 9)
|
||||
{
|
||||
$day = " ".$day;
|
||||
}
|
||||
|
||||
# task cal and task cal y
|
||||
my $output = qx{../task rc:cal.rc rc._forcecolor:on cal};
|
||||
if ($wday == 6 || $wday == 0)
|
||||
{
|
||||
like ($output, qr/\[30;106m$day/, 'Current day is highlighted');
|
||||
}
|
||||
else
|
||||
{
|
||||
like ($output, qr/\[30;46m$day/, 'Current day is highlighted');
|
||||
}
|
||||
like ($output, qr/$month\S*?\s+?$year/, 'Current month and year are displayed');
|
||||
$output = qx{../task rc:cal.rc add zero};
|
||||
unlike ($output, qr/\[41m\d+/, 'No overdue tasks are present');
|
||||
unlike ($output, qr/\[43m\d+/, 'No due tasks are present');
|
||||
$output = qx{../task rc:cal.rc rc.weekstart:Sunday cal};
|
||||
like ($output, qr/Su Mo Tu/, 'Week starts on Sunday');
|
||||
$output = qx{../task rc:cal.rc rc.weekstart:Monday cal};
|
||||
like ($output, qr/Fr Sa Su/, 'Week starts on Monday');
|
||||
$output = qx{../task rc:cal.rc cal y};
|
||||
like ($output, qr/$month\S*?\s+?$year/, 'Current month and year are displayed');
|
||||
if ($month eq "Jan")
|
||||
{
|
||||
$nextyear = $nextyear - 1;
|
||||
}
|
||||
like ($output, qr/$prevmonth\S*?\s+?$nextyear/, 'Month and year one year ahead are displayed');
|
||||
if ($month eq "Jan")
|
||||
{
|
||||
$nextyear = $nextyear + 1;
|
||||
}
|
||||
unlike ($output, qr/$month\S*?\s+?$nextyear/, 'Current month and year ahead are not displayed');
|
||||
|
||||
# task cal due and task cal due y
|
||||
qx{../task rc:cal.rc add due:20190515 one};
|
||||
qx{../task rc:cal.rc add due:20200123 two};
|
||||
$output = qx{../task rc:cal.rc rc._forcecolor:on cal due};
|
||||
unlike ($output, qr/April 2019/, 'April 2019 is not displayed');
|
||||
like ($output, qr/May 2019/, 'May 2019 is displayed');
|
||||
unlike ($output, qr/January 2020/, 'January 2020 is not displayed');
|
||||
like ($output, qr/30;42m15/, 'Task 1 is color-coded due');
|
||||
$output = qx{../task rc:cal.rc rc._forcecolor:on cal due y};
|
||||
like ($output, qr/30;42m23/, 'Task 2 is color-coded due');
|
||||
like ($output, qr/April 2020/, 'April 2020 is displayed');
|
||||
unlike ($output, qr/May 2020/, 'May 2020 is not displayed');
|
||||
qx{../task rc:cal.rc ls};
|
||||
qx{../task rc:cal.rc del 1-3};
|
||||
qx{../task rc:cal.rc add due:20080408 three};
|
||||
$output = qx{../task rc:cal.rc rc._forcecolor:on cal due};
|
||||
like ($output, qr/April 2008/, 'April 2008 is displayed');
|
||||
like ($output, qr/41m 8/, 'Task 3 is color-coded overdue');
|
||||
like ($output, qr/37;100m19/, 'Saturday April 19, 2008 is color-coded');
|
||||
like ($output, qr/37;100m20/, 'Sunday April 20, 2008 is color-coded');
|
||||
like ($output, qr/30;47m 1/, 'Weeknumbers are color-coded');
|
||||
|
||||
# task cal 2016
|
||||
$output = qx{../task rc:cal.rc rc.weekstart:Monday cal 2016};
|
||||
unlike ($output, qr/2015/, 'Year 2015 is not displayed');
|
||||
unlike ($output, qr/2017/, 'Year 2017 is not displayed');
|
||||
like ($output, qr/January 2016/, 'January 2016 is displayed');
|
||||
like ($output, qr/December 2016/, 'December 2016 is displayed');
|
||||
like ($output, qr/53 +1/, '2015 has 53 weeks (ISO)');
|
||||
like ($output, qr/1 +4/, 'First week in 2016 starts with Mon Jan 4 (ISO)');
|
||||
like ($output, qr/52 +26/, 'Last week in 2016 starts with Mon Dec 26 (ISO)');
|
||||
like ($output, qr/9 +29/, 'Leap year - Feb 29 is Monday in week 9 (ISO)');
|
||||
$output = qx{../task rc:cal.rc rc.weekstart:Sunday cal 2016};
|
||||
like ($output, qr/1 +1/, 'First week in 2016 starts with Fri Jan 1 (US)');
|
||||
like ($output, qr/53 +25/, 'Last week in 2016 starts with Sun Dec 25 (US)');
|
||||
$output = qx{../task rc:cal.rc rc.weekstart:Monday rc.displayweeknumber:off cal 2016};
|
||||
unlike ($output, qr/53/, 'Weeknumbers are not displayed');
|
||||
|
||||
# task cal 4 2010
|
||||
$output = qx{../task rc:cal.rc rc.monthsperline:1 cal 4 2010};
|
||||
unlike ($output, qr/March 2010/, 'March 2010 is not displayed');
|
||||
like ($output, qr/April 2010/, 'April 2010 is displayed');
|
||||
unlike ($output, qr/May 2010/, 'May 2010 is not displayed');
|
||||
|
||||
# calendar offsets
|
||||
$output = qx{../task rc:cal.rc rc.calendar.offset:on rc.monthsperline:1 cal 1 2011};
|
||||
unlike ($output, qr/November 2010/, 'November 2010 is not displayed');
|
||||
like ($output, qr/December 2010/, 'December 2010 is displayed');
|
||||
unlike ($output, qr/January 2011/, 'January 2011 is not displayed');
|
||||
$output = qx{../task rc:cal.rc rc.calendar.offset:on rc.calendar.offset.value:2 rc.monthsperline:1 cal 1 2011};
|
||||
unlike ($output, qr/January 2011/, 'January 2011 is not displayed');
|
||||
unlike ($output, qr/February 2011/, 'February 2011 is not displayed');
|
||||
like ($output, qr/March 2011/, 'March 2011 is displayed');
|
||||
unlike ($output, qr/April 2011/, 'April 2011 is not displayed');
|
||||
$output = qx{../task rc:cal.rc rc.calendar.offset:on rc.calendar.offset.value:-12 rc.monthsperline:1 cal};
|
||||
like ($output, qr/$month\S*?\s+?$prevyear/, 'Current month and year ahead are displayed');
|
||||
unlike ($output, qr/$month\S*?\s+?$year/, 'Current month and year are not displayed');
|
||||
$output = qx{../task rc:cal.rc rc.calendar.offset:on rc.calendar.offset.value:12 rc.monthsperline:1 cal};
|
||||
unlike ($output, qr/$month\S*?\s+?$year/, 'Current month and year are not displayed');
|
||||
like ($output, qr/$month\S*?\s+?$nextyear/, 'Current month and year ahead are displayed');
|
||||
|
||||
# Cleanup.
|
||||
unlink 'pending.data';
|
||||
ok (!-r 'pending.data', 'Removed pending.data');
|
||||
unlink 'undo.data';
|
||||
ok (!-r 'undo.data', 'Removed undo.data');
|
||||
unlink 'cal.rc';
|
||||
ok (!-r 'cal.rc', 'Removed cal.rc');
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'details.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"dateformat=YMD\n",
|
||||
"dateformat.holiday=YMD\n",
|
||||
"dateformat.report=YMD\n",
|
||||
"calendar.details=full\n",
|
||||
"calendar.details.report=list\n",
|
||||
"calendar.holidays=full\n",
|
||||
"color=on\n",
|
||||
"color.alternate=\n",
|
||||
"color.calendar.weekend=\n",
|
||||
"color.calendar.holiday=black on bright yellow\n",
|
||||
"confirmation=no\n",
|
||||
"holiday.AAAA.name=AAAA\n",
|
||||
"holiday.AAAA.date=20150101\n",
|
||||
"holiday.BBBBBB.name=BBBBBB\n",
|
||||
"holiday.BBBBBB.date=20150115\n",
|
||||
"holiday.åäö.name=åäö\n",
|
||||
"holiday.åäö.date=20150125\n";
|
||||
close $fh;
|
||||
ok (-r 'details.rc', 'Created details.rc');
|
||||
}
|
||||
|
||||
# task calendar details
|
||||
qx{../task rc:details.rc add due:20150105 one};
|
||||
qx{../task rc:details.rc add due:20150110 two};
|
||||
qx{../task rc:details.rc add due:20150210 three};
|
||||
qx{../task rc:details.rc add due:20150410 four};
|
||||
qx{../task rc:details.rc add due:20151225 five};
|
||||
qx{../task rc:details.rc add due:20141231 six};
|
||||
qx{../task rc:details.rc add due:20160101 seven};
|
||||
qx{../task rc:details.rc add due:20081231 eight};
|
||||
|
||||
$output = qx{../task rc:details.rc rc.calendar.legend:no cal};
|
||||
unlike ($output, qr/Legend:/, 'Legend is not displayed');
|
||||
|
||||
$output = qx{../task rc:details.rc cal rc.monthsperline:3 1 2015};
|
||||
like ($output, qr/January 2015/, 'January 2015 is displayed');
|
||||
like ($output, qr/20150105/, 'Due date 20150105 is displayed');
|
||||
like ($output, qr/20150110/, 'Due date 20150110 is displayed');
|
||||
like ($output, qr/20150210/, 'Due date 20150210 is displayed');
|
||||
unlike ($output, qr/20141231/, 'Due date 20141231 is not displayed');
|
||||
unlike ($output, qr/20150410/, 'Due date 20150410 is not displayed');
|
||||
like ($output, qr/3 tasks/, '3 due tasks are displayed');
|
||||
|
||||
$output = qx{../task rc:details.rc cal due};
|
||||
like ($output, qr/December 2008/, 'December 2008 is displayed');
|
||||
like ($output, qr/20081231/, 'Due date 20081231 is displayed');
|
||||
like ($output, qr/1 task/, '1 due task is displayed');
|
||||
|
||||
$output = qx{../task rc:details.rc cal 2015};
|
||||
like ($output, qr/January 2015/, 'January 2015 is displayed');
|
||||
like ($output, qr/December 2015/, 'December 2015 is displayed');
|
||||
unlike ($output, qr/20141231/, 'Due date 20141231 is not displayed');
|
||||
unlike ($output, qr/20160101/, 'Due date 20160101 is not displayed');
|
||||
like ($output, qr/5 tasks/, '5 due tasks are displayed');
|
||||
|
||||
$day = $nday;
|
||||
if ( $day <= 9)
|
||||
{
|
||||
$day = "0".$day;
|
||||
}
|
||||
my $mon = $nmon + 1;
|
||||
if ( $mon <= 9)
|
||||
{
|
||||
$mon = "0".$mon;
|
||||
}
|
||||
my $duedate = $year.$mon.$day;
|
||||
|
||||
qx{../task rc:details.rc add due:$duedate rc.monthsperline:1 nine};
|
||||
$output = qx{../task rc:details.rc cal};
|
||||
like ($output, qr/$month\S*?\s+?$year/, 'Current month and year are displayed');
|
||||
like ($output, qr/$duedate/, 'Due date on current day is displayed');
|
||||
like ($output, qr/1 task/, '1 due task is displayed');
|
||||
|
||||
$output = qx{../task rc:details.rc cal rc.monthsperline:1 1 2015};
|
||||
like ($output, qr/Date/, 'Word Date is displayed');
|
||||
like ($output, qr/Holiday/, 'Word Holiday is displayed');
|
||||
like ($output, qr/20150101/, 'Holiday 20150101 is displayed');
|
||||
like ($output, qr/20150115/, 'Holiday 20150115 is displayed');
|
||||
like ($output, qr/20150125/, 'Holiday 20150125 is displayed');
|
||||
like ($output, qr/AAAA/, 'Holiday name AAAA is displayed');
|
||||
like ($output, qr/BBBBBB/, 'Holiday name BBBBBB is displayed');
|
||||
like ($output, qr/åäö/, 'Holiday name åäö is displayed');
|
||||
|
||||
$output = qx{../task rc:details.rc cal rc._forcecolor:on rc.monthsperline:1 rc.calendar.details:sparse rc.calendar.holidays:sparse 1 2015};
|
||||
unlike ($output, qr/Date/, 'Word Date is not displayed');
|
||||
unlike ($output, qr/Holiday/, 'Word Holiday is not displayed');
|
||||
like ($output, qr/30;103m 1/, 'Holiday AAAA is color-coded');
|
||||
like ($output, qr/30;103m15/, 'Holiday BBBBBB is color-coded');
|
||||
like ($output, qr/30;103m25/, 'Holiday åäö is color-coded');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'details.rc';
|
||||
ok (!-r 'details.rc', 'Removed details.rc');
|
||||
|
||||
exit 0;
|
136
test/caseless.t
Executable file
136
test/caseless.t
Executable file
|
@ -0,0 +1,136 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 21;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'caseless.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'caseless.rc', 'Created caseless.rc');
|
||||
}
|
||||
|
||||
# Attempt case-sensitive and case-insensitive substitutions and filters.
|
||||
qx{../task rc:caseless.rc add one two three};
|
||||
qx{../task rc:caseless.rc 1 annotate four five six};
|
||||
my $output;
|
||||
|
||||
# Description substitution.
|
||||
# 2
|
||||
qx{../task rc:caseless.rc rc.search.case.sensitive:yes 1 /One/ONE/};
|
||||
$output = qx{../task rc:caseless.rc info 1};
|
||||
unlike ($output, qr/One two three/, 'one two three\nfour five six -> /One/ONE/ = fail');
|
||||
|
||||
# 3
|
||||
qx{../task rc:caseless.rc rc.search.case.sensitive:no 1 /One/ONE/};
|
||||
$output = qx{../task rc:caseless.rc info 1};
|
||||
like ($output, qr/ONE two three/, 'one two three\nfour five six -> /One/ONE/ = caseless succeed');
|
||||
|
||||
# 4
|
||||
qx{../task rc:caseless.rc rc.search.case.sensitive:yes 1 /one/One/};
|
||||
$output = qx{../task rc:caseless.rc info 1};
|
||||
unlike ($output, qr/One two three/, 'ONE two three\nfour five six -> /one/ONE/ = fail');
|
||||
|
||||
# 5
|
||||
qx{../task rc:caseless.rc rc.search.case.sensitive:no 1 /one/one/};
|
||||
$output = qx{../task rc:caseless.rc info 1};
|
||||
like ($output, qr/one two three/, 'ONE two three\nfour five six -> /one/one/ = caseless succeed');
|
||||
|
||||
# Annotation substitution.
|
||||
# 6
|
||||
qx{../task rc:caseless.rc rc.search.case.sensitive:yes 1 /Five/FIVE/};
|
||||
$output = qx{../task rc:caseless.rc info 1};
|
||||
unlike ($output, qr/four FIVE six/, 'one two three\nfour five six -> /Five/FIVE/ = fail');
|
||||
|
||||
# 7
|
||||
qx{../task rc:caseless.rc rc.search.case.sensitive:no 1 /Five/FIVE/};
|
||||
$output = qx{../task rc:caseless.rc info 1};
|
||||
like ($output, qr/four FIVE six/, 'one two three\nfour five six -> /Five/FIVE/ = caseless succeed');
|
||||
|
||||
# 8
|
||||
qx{../task rc:caseless.rc rc.search.case.sensitive:yes 1 /five/Five/};
|
||||
$output = qx{../task rc:caseless.rc info 1};
|
||||
unlike ($output, qr/four Five six/, 'one two three\nfour FIVE six -> /five/Five/ = fail');
|
||||
|
||||
# 9
|
||||
qx{../task rc:caseless.rc rc.search.case.sensitive:no 1 /five/five/};
|
||||
$output = qx{../task rc:caseless.rc info 1};
|
||||
like ($output, qr/four five six/, 'one two three\nfour FIVE six -> /five/five/ = caseless succeed');
|
||||
|
||||
# Description filter.
|
||||
# 10
|
||||
$output = qx{../task rc:caseless.rc rc.search.case.sensitive:yes ls One};
|
||||
unlike ($output, qr/one two three/, 'one two three\nfour five six -> ls One = fail');
|
||||
|
||||
# 11
|
||||
$output = qx{../task rc:caseless.rc rc.search.case.sensitive:no ls One};
|
||||
like ($output, qr/one two three/, 'one two three\nfour five six -> ls One caseless = succeed');
|
||||
|
||||
# 12
|
||||
$output = qx{../task rc:caseless.rc rc.search.case.sensitive:yes ls Five};
|
||||
unlike ($output, qr/four five six/, 'one two three\nfour five six -> ls Five = fail');
|
||||
|
||||
# 13
|
||||
$output = qx{../task rc:caseless.rc rc.search.case.sensitive:no ls Five};
|
||||
like ($output, qr/four five six/, 'one two three\nfour five six -> ls Five caseless = succeed');
|
||||
|
||||
# Annotation filter.
|
||||
# 14
|
||||
$output = qx{../task rc:caseless.rc rc.search.case.sensitive:yes ls description.contains:Three};
|
||||
unlike ($output, qr/one two three/, 'one two three\nfour five six -> ls description.contains:Three = fail');
|
||||
|
||||
# 15
|
||||
$output = qx{../task rc:caseless.rc rc.search.case.sensitive:no ls description.contains:Three};
|
||||
like ($output, qr/one two three/, 'one two three\nfour five six -> ls description.contains:Three caseless = succeed');
|
||||
|
||||
# 16
|
||||
$output = qx{../task rc:caseless.rc rc.search.case.sensitive:yes ls description.contains:Six};
|
||||
unlike ($output, qr/four five six/, 'one two three\nfour five six -> ls description.contains:Six = fail');
|
||||
|
||||
# 17
|
||||
$output = qx{../task rc:caseless.rc rc.search.case.sensitive:no ls description.contains:Six};
|
||||
like ($output, qr/four five six/, 'one two three\nfour five six -> ls description.contains:Six caseless = succeed');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'caseless.rc';
|
||||
ok (!-r 'caseless.rc', 'Removed caseless.rc');
|
||||
|
||||
exit 0;
|
||||
|
210
test/cmd.t.cpp
Normal file
210
test/cmd.t.cpp
Normal file
|
@ -0,0 +1,210 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free Software
|
||||
// Foundation; either version 2 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program; if not, write to the
|
||||
//
|
||||
// Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor,
|
||||
// Boston, MA
|
||||
// 02110-1301
|
||||
// USA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include <Context.h>
|
||||
#include <Cmd.h>
|
||||
#include <test.h>
|
||||
|
||||
Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest t (86);
|
||||
|
||||
// Without Context::initialize, there is no set of defaults loaded into
|
||||
// Context::Config.
|
||||
context.initialize ();
|
||||
context.config.set ("report.foo.columns", "id");
|
||||
|
||||
Cmd cmd;
|
||||
cmd.command = "active";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand active");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand active");
|
||||
|
||||
cmd.command = "calendar";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand calendar");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand calendar");
|
||||
|
||||
cmd.command = "colors";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand colors");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand colors");
|
||||
|
||||
cmd.command = "completed";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand completed");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand completed");
|
||||
|
||||
cmd.command = "export.csv";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand export.csv");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand export.csv");
|
||||
|
||||
cmd.command = "export.ical";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand export.ical");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand export.ical");
|
||||
|
||||
cmd.command = "help";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand help");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand help");
|
||||
|
||||
cmd.command = "history.monthly";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand history.monthly");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand history.monthly");
|
||||
|
||||
cmd.command = "history.annual";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand history.annual");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand history.annual");
|
||||
|
||||
cmd.command = "ghistory.monthly";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand ghistory.monthly");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand ghistory.monthly");
|
||||
|
||||
cmd.command = "ghistory.annual";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand ghistory.annual");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand ghistory.annual");
|
||||
|
||||
cmd.command = "info";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand info");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand info");
|
||||
|
||||
cmd.command = "next";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand next");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand next");
|
||||
|
||||
cmd.command = "overdue";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand overdue");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand overdue");
|
||||
|
||||
cmd.command = "projects";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand projects");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand projects");
|
||||
|
||||
cmd.command = "stats";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand stats");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand stats");
|
||||
|
||||
cmd.command = "summary";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand summary");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand summary");
|
||||
|
||||
cmd.command = "tags";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand tags");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand tags");
|
||||
|
||||
cmd.command = "timesheet";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand timesheet");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand timesheet");
|
||||
|
||||
cmd.command = "version";
|
||||
t.ok (cmd.isReadOnlyCommand (), "isReadOnlyCommand version");
|
||||
t.notok (cmd.isWriteCommand (), "not isWriteCommand version");
|
||||
|
||||
cmd.command = "_projects";
|
||||
t.ok (cmd.isReadOnlyCommand (), "not isReadOnlyCommand _projects");
|
||||
t.notok (cmd.isWriteCommand (), "isWriteCommand _projects");
|
||||
|
||||
cmd.command = "_tags";
|
||||
t.ok (cmd.isReadOnlyCommand (), "not isReadOnlyCommand _tags");
|
||||
t.notok (cmd.isWriteCommand (), "isWriteCommand _tags");
|
||||
|
||||
cmd.command = "add";
|
||||
t.notok (cmd.isReadOnlyCommand (), "not isReadOnlyCommand add");
|
||||
t.ok (cmd.isWriteCommand (), "isWriteCommand add");
|
||||
|
||||
cmd.command = "log";
|
||||
t.notok (cmd.isReadOnlyCommand (), "not isReadOnlyCommand log");
|
||||
t.ok (cmd.isWriteCommand (), "isWriteCommand log");
|
||||
|
||||
cmd.command = "append";
|
||||
t.notok (cmd.isReadOnlyCommand (), "not isReadOnlyCommand append");
|
||||
t.ok (cmd.isWriteCommand (), "isWriteCommand append");
|
||||
|
||||
cmd.command = "annotate";
|
||||
t.notok (cmd.isReadOnlyCommand (), "not isReadOnlyCommand annotate");
|
||||
t.ok (cmd.isWriteCommand (), "isWriteCommand annotate");
|
||||
|
||||
cmd.command = "delete";
|
||||
t.notok (cmd.isReadOnlyCommand (), "not isReadOnlyCommand delete");
|
||||
t.ok (cmd.isWriteCommand (), "isWriteCommand delete");
|
||||
|
||||
cmd.command = "done";
|
||||
t.notok (cmd.isReadOnlyCommand (), "not isReadOnlyCommand done");
|
||||
t.ok (cmd.isWriteCommand (), "isWriteCommand done");
|
||||
|
||||
cmd.command = "duplicate";
|
||||
t.notok (cmd.isReadOnlyCommand (), "not isReadOnlyCommand duplicate");
|
||||
t.ok (cmd.isWriteCommand (), "isWriteCommand duplicate");
|
||||
|
||||
cmd.command = "edit";
|
||||
t.notok (cmd.isReadOnlyCommand (), "not isReadOnlyCommand edit");
|
||||
t.ok (cmd.isWriteCommand (), "isWriteCommand edit");
|
||||
|
||||
cmd.command = "import";
|
||||
t.notok (cmd.isReadOnlyCommand (), "not isReadOnlyCommand import");
|
||||
t.ok (cmd.isWriteCommand (), "isWriteCommand import");
|
||||
|
||||
cmd.command = "start";
|
||||
t.notok (cmd.isReadOnlyCommand (), "not isReadOnlyCommand start");
|
||||
t.ok (cmd.isWriteCommand (), "isWriteCommand start");
|
||||
|
||||
cmd.command = "stop";
|
||||
t.notok (cmd.isReadOnlyCommand (), "not isReadOnlyCommand stop");
|
||||
t.ok (cmd.isWriteCommand (), "isWriteCommand stop");
|
||||
|
||||
cmd.command = "undo";
|
||||
t.notok (cmd.isReadOnlyCommand (), "not isReadOnlyCommand undo");
|
||||
t.ok (cmd.isWriteCommand (), "isWriteCommand undo");
|
||||
|
||||
t.ok (cmd.valid ("annotate"), "Cmd::valid annotate");
|
||||
t.ok (cmd.valid ("annotat"), "Cmd::valid annotat");
|
||||
t.ok (cmd.valid ("annota"), "Cmd::valid annota");
|
||||
t.ok (cmd.valid ("annot"), "Cmd::valid annot");
|
||||
t.ok (cmd.valid ("anno"), "Cmd::valid anno");
|
||||
t.ok (cmd.valid ("ann"), "Cmd::valid ann");
|
||||
t.ok (cmd.valid ("an"), "Cmd::valid an");
|
||||
|
||||
t.ok (cmd.valid ("ANNOTATE"), "Cmd::valid ANNOTATE");
|
||||
t.ok (cmd.valid ("ANNOTAT"), "Cmd::valid ANNOTAT");
|
||||
t.ok (cmd.valid ("ANNOTA"), "Cmd::valid ANNOTA");
|
||||
t.ok (cmd.valid ("ANNOT"), "Cmd::valid ANNOT");
|
||||
t.ok (cmd.valid ("ANNO"), "Cmd::valid ANNO");
|
||||
t.ok (cmd.valid ("ANN"), "Cmd::valid ANN");
|
||||
t.ok (cmd.valid ("AN"), "Cmd::valid AN");
|
||||
|
||||
t.ok (cmd.validCustom ("foo"), "Cmd::validCustom foo");
|
||||
t.notok (cmd.validCustom ("bar"), "Cmd::validCustom bar -> fail");
|
||||
|
||||
bool good = true;
|
||||
try { cmd.parse ("a"); } catch (...) { good = false; }
|
||||
t.notok (good, "Cmd::parse a -> fail");
|
||||
|
||||
good = true;
|
||||
try { cmd.parse ("add"); } catch (...) { good = false; }
|
||||
t.ok (good, "Cmd::parse add");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
66
test/color.active.t
Executable file
66
test/color.active.t
Executable file
|
@ -0,0 +1,66 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'color.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"color.active=red\n",
|
||||
"_forcecolor=1\n";
|
||||
close $fh;
|
||||
ok (-r 'color.rc', 'Created color.rc');
|
||||
}
|
||||
|
||||
# Test the add command.
|
||||
qx{../task rc:color.rc add nothing};
|
||||
qx{../task rc:color.rc add red};
|
||||
qx{../task rc:color.rc start 2};
|
||||
my $output = qx{../task rc:color.rc list};
|
||||
|
||||
like ($output, qr/ (?!<\033\[\d\dm) .* nothing .* (?!>\033\[0m) /x, 'none');
|
||||
like ($output, qr/ \033\[31m .* red .* \033\[0m /x, 'color.active');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'color.rc';
|
||||
ok (!-r 'color.rc', 'Removed color.rc');
|
||||
|
||||
exit 0;
|
||||
|
67
test/color.blocked.t
Executable file
67
test/color.blocked.t
Executable file
|
@ -0,0 +1,67 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'color.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"color.blocked=red\n",
|
||||
"color.alternate=\n",
|
||||
"_forcecolor=1\n";
|
||||
close $fh;
|
||||
ok (-r 'color.rc', 'Created color.rc');
|
||||
}
|
||||
|
||||
# Test the add command.
|
||||
qx{../task rc:color.rc add red};
|
||||
qx{../task rc:color.rc add nothing};
|
||||
qx{../task rc:color.rc 1 depends:2};
|
||||
my $output = qx{../task rc:color.rc list};
|
||||
|
||||
like ($output, qr/ (?!<\033\[\d\dm) .* nothing .* (?!>\033\[0m) /x, 'none');
|
||||
like ($output, qr/ \033\[31m .* red .* \033\[0m /x, 'color.blocked');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'color.rc';
|
||||
ok (!-r 'color.rc', 'Removed color.rc');
|
||||
|
||||
exit 0;
|
||||
|
58
test/color.deprecated.t
Executable file
58
test/color.deprecated.t
Executable file
|
@ -0,0 +1,58 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 5;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'color.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"color.pri.H=red on black\n",
|
||||
"color.pri.M=red on_black\n";
|
||||
close $fh;
|
||||
ok (-r 'color.rc', 'Created color.rc');
|
||||
}
|
||||
|
||||
# Test the add command.
|
||||
my $output = qx{../task rc:color.rc show};
|
||||
like ($output, qr/that use deprecated underscores/ms, 'Deprecated color detected');
|
||||
|
||||
# Cleanup.
|
||||
unlink 'pending.data';
|
||||
ok (!-r 'pending.data', 'Removed pending.data');
|
||||
|
||||
unlink 'undo.data';
|
||||
ok (!-r 'undo.data', 'Removed undo.data');
|
||||
|
||||
unlink 'color.rc';
|
||||
ok (!-r 'color.rc', 'Removed color.rc');
|
||||
|
||||
exit 0;
|
||||
|
64
test/color.disable.t
Executable file
64
test/color.disable.t
Executable file
|
@ -0,0 +1,64 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 8;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'color.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"color.pri.H=red\n";
|
||||
close $fh;
|
||||
ok (-r 'color.rc', 'Created color.rc');
|
||||
}
|
||||
|
||||
# Test the add command.
|
||||
qx{../task rc:color.rc add priority:H red};
|
||||
my $output = qx{../task rc:color.rc list};
|
||||
|
||||
like ($output, qr/red/, 'color.disable - found red');
|
||||
unlike ($output, qr/\033\[31m/, 'color.disable - no color red');
|
||||
unlike ($output, qr/\033\[0m/, 'color.disable - no color reset');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'color.rc';
|
||||
ok (!-r 'color.rc', 'Removed color.rc');
|
||||
|
||||
exit 0;
|
||||
|
65
test/color.due.t
Executable file
65
test/color.due.t
Executable file
|
@ -0,0 +1,65 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'color.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"color.due=red\n",
|
||||
"_forcecolor=1\n";
|
||||
close $fh;
|
||||
ok (-r 'color.rc', 'Created color.rc');
|
||||
}
|
||||
|
||||
# Test the add command.
|
||||
qx{../task rc:color.rc add due:12/31/2037 nothing};
|
||||
qx{../task rc:color.rc add due:tomorrow red};
|
||||
my $output = qx{../task rc:color.rc list};
|
||||
|
||||
like ($output, qr/ (?!<\033\[\d\dm) \d{1,2}\/\d{1,2}\/\d{4} (?!>\033\[0m) .* nothing /x, 'none');
|
||||
like ($output, qr/ \033\[31m .* red .* \033\[0m/x, 'color.due');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'color.rc';
|
||||
ok (!-r 'color.rc', 'Removed color.rc');
|
||||
|
||||
exit 0;
|
||||
|
65
test/color.duetoday.t
Executable file
65
test/color.duetoday.t
Executable file
|
@ -0,0 +1,65 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'color.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"color.due.today=red\n",
|
||||
"_forcecolor=1\n";
|
||||
close $fh;
|
||||
ok (-r 'color.rc', 'Created color.rc');
|
||||
}
|
||||
|
||||
# Test the add command.
|
||||
qx{../task rc:color.rc add due:12/31/2037 nothing};
|
||||
qx{../task rc:color.rc add due:1hr red};
|
||||
my $output = qx{../task rc:color.rc list};
|
||||
|
||||
like ($output, qr/ (?!<\033\[\d\dm) \d{1,2}\/\d{1,2}\/\d{4} (?!>\033\[0m) .* nothing /x, 'none');
|
||||
like ($output, qr/ (?:\033\[31m|\033\[38;5;9m) .* red .* \033\[0m/x, 'color.due.today');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'color.rc';
|
||||
ok (!-r 'color.rc', 'Removed color.rc');
|
||||
|
||||
exit 0;
|
||||
|
75
test/color.keyword.t
Executable file
75
test/color.keyword.t
Executable file
|
@ -0,0 +1,75 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 9;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'color.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"search.case.sensitive=yes\n",
|
||||
"color=on\n",
|
||||
"color.alternate=\n",
|
||||
"color.keyword.red=red\n",
|
||||
"color.keyword.green=green\n",
|
||||
"color.keyword.yellow=yellow\n",
|
||||
"_forcecolor=1\n";
|
||||
close $fh;
|
||||
ok (-r 'color.rc', 'Created color.rc');
|
||||
}
|
||||
|
||||
# Test the add command.
|
||||
qx{../task rc:color.rc add nothing};
|
||||
qx{../task rc:color.rc add red};
|
||||
qx{../task rc:color.rc add green};
|
||||
qx{../task rc:color.rc add -- annotation};
|
||||
qx{../task rc:color.rc 4 annotate yellow};
|
||||
my $output = qx{../task rc:color.rc list};
|
||||
|
||||
like ($output, qr/ (?!<\033\[\d\dm) .* nothing .* (?!>\033\[0m) /x, 'none');
|
||||
like ($output, qr/ \033\[31m .* red .* \033\[0m /x, 'color.keyword.red');
|
||||
like ($output, qr/ \033\[32m .* green .* \033\[0m /x, 'color.keyword.green');
|
||||
like ($output, qr/ \033\[33m .* annotation .* \033\[0m /x, 'color.keyword.yellow (annotation)');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'color.rc';
|
||||
ok (!-r 'color.rc', 'Removed color.rc');
|
||||
|
||||
exit 0;
|
||||
|
65
test/color.overdue.t
Executable file
65
test/color.overdue.t
Executable file
|
@ -0,0 +1,65 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'color.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"color.overdue=red\n",
|
||||
"_forcecolor=1\n";
|
||||
close $fh;
|
||||
ok (-r 'color.rc', 'Created color.rc');
|
||||
}
|
||||
|
||||
# Test the add command.
|
||||
qx{../task rc:color.rc add due:tomorrow nothing};
|
||||
qx{../task rc:color.rc add due:yesterday red};
|
||||
my $output = qx{../task rc:color.rc list};
|
||||
|
||||
like ($output, qr/ (?!<\033\[\d\dm) \d{1,2}\/\d{1,2}\/\d{4} (?!>\033\[0m) .* nothing /x, 'none');
|
||||
like ($output, qr/ \033\[31m .* red .* \033\[0m/x, 'color.overdue');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'color.rc';
|
||||
ok (!-r 'color.rc', 'Removed color.rc');
|
||||
|
||||
exit 0;
|
||||
|
73
test/color.pri.t
Executable file
73
test/color.pri.t
Executable file
|
@ -0,0 +1,73 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 9;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'color.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"color.pri.H=red\n",
|
||||
"color.pri.M=green\n",
|
||||
"color.pri.L=blue\n",
|
||||
"color.pri.none=yellow\n",
|
||||
"color.alternate=\n",
|
||||
"_forcecolor=1\n";
|
||||
close $fh;
|
||||
ok (-r 'color.rc', 'Created color.rc');
|
||||
}
|
||||
|
||||
# Test the add command.
|
||||
qx{../task rc:color.rc add priority:H red};
|
||||
qx{../task rc:color.rc add priority:M green};
|
||||
qx{../task rc:color.rc add priority:L blue};
|
||||
qx{../task rc:color.rc add yellow};
|
||||
my $output = qx{../task rc:color.rc list};
|
||||
|
||||
like ($output, qr/ \033\[31m .* red .* \033\[0m /x, 'color.pri.H');
|
||||
like ($output, qr/ \033\[32m .* green .* \033\[0m /x, 'color.pri.M');
|
||||
like ($output, qr/ \033\[34m .* blue .* \033\[0m /x, 'color.pri.L');
|
||||
like ($output, qr/ \033\[33m .* yellow .* \033\[0m /x, 'color.pri.none');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'color.rc';
|
||||
ok (!-r 'color.rc', 'Removed color.rc');
|
||||
|
||||
exit 0;
|
||||
|
67
test/color.project.t
Executable file
67
test/color.project.t
Executable file
|
@ -0,0 +1,67 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'color.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"color.project.x=red\n",
|
||||
"color.project.none=green\n",
|
||||
"color.alternate=\n",
|
||||
"_forcecolor=1\n";
|
||||
close $fh;
|
||||
ok (-r 'color.rc', 'Created color.rc');
|
||||
}
|
||||
|
||||
# Test the add command.
|
||||
qx{../task rc:color.rc add nothing};
|
||||
qx{../task rc:color.rc add project:x red};
|
||||
my $output = qx{../task rc:color.rc list};
|
||||
|
||||
like ($output, qr/ \033\[32m .* nothing .* \033\[0m /x, 'color.project.none');
|
||||
like ($output, qr/ \033\[31m .* red .* \033\[0m /x, 'color.project.red');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'color.rc';
|
||||
ok (!-r 'color.rc', 'Removed color.rc');
|
||||
|
||||
exit 0;
|
||||
|
66
test/color.recurring.t
Executable file
66
test/color.recurring.t
Executable file
|
@ -0,0 +1,66 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'color.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"color.recurring=red\n",
|
||||
"color.due=\n",
|
||||
"_forcecolor=1\n";
|
||||
close $fh;
|
||||
ok (-r 'color.rc', 'Created color.rc');
|
||||
}
|
||||
|
||||
# Test the add command.
|
||||
qx{../task rc:color.rc add nothing};
|
||||
qx{../task rc:color.rc add due:tomorrow recur:1w red};
|
||||
my $output = qx{../task rc:color.rc list};
|
||||
|
||||
like ($output, qr/ (?!<\033\[\d\dm) .* nothing .* (?!>\033\[0m) /x, 'none');
|
||||
like ($output, qr/ \033\[31m .* red .* \033\[0m /x, 'color.recurring');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'color.rc';
|
||||
ok (!-r 'color.rc', 'Removed color.rc');
|
||||
|
||||
exit 0;
|
||||
|
188
test/color.t.cpp
Normal file
188
test/color.t.cpp
Normal file
|
@ -0,0 +1,188 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free Software
|
||||
// Foundation; either version 2 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program; if not, write to the
|
||||
//
|
||||
// Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor,
|
||||
// Boston, MA
|
||||
// 02110-1301
|
||||
// USA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include <iostream>
|
||||
#include <Context.h>
|
||||
#include <Color.h>
|
||||
#include <test.h>
|
||||
|
||||
Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest t (1033);
|
||||
|
||||
// Names matched to values.
|
||||
t.is ((int) Color (""), (int) Color (Color::nocolor), "'' == Color::nocolor");
|
||||
t.is ((int) Color ("black"), (int) Color (Color::black), "'black' == Color::black");
|
||||
t.is ((int) Color ("red"), (int) Color (Color::red), "'red' == Color::red");
|
||||
t.is ((int) Color ("green"), (int) Color (Color::green), "'green' == Color::green");
|
||||
t.is ((int) Color ("yellow"), (int) Color (Color::yellow), "'yellow' == Color::yellow");
|
||||
t.is ((int) Color ("blue"), (int) Color (Color::blue), "'blue' == Color::blue");
|
||||
t.is ((int) Color ("magenta"), (int) Color (Color::magenta), "'magenta' == Color::magenta");
|
||||
t.is ((int) Color ("cyan"), (int) Color (Color::cyan), "'cyan' == Color::cyan");
|
||||
t.is ((int) Color ("white"), (int) Color (Color::white), "'white' == Color::white");
|
||||
|
||||
// Auto upgrades.
|
||||
Color c ("red on color0");
|
||||
t.is ((std::string) c, "color1 on color0", "upgrade red on color0 -> color1 on color0");
|
||||
|
||||
c = Color ("color1 on black");
|
||||
t.is ((std::string) c, "color1 on color0", "upgrade color1 on black -> color1 on color0");
|
||||
|
||||
c = Color ("bold red on color0");
|
||||
t.is ((std::string) c, "color9 on color0", "upgrade bold red on color0 -> color9 on color0");
|
||||
|
||||
c = Color ("color1 on bright black");
|
||||
t.is ((std::string) c, "color1 on color8", "upgrade color1 on bright black -> color1 on color8");
|
||||
|
||||
// Simple blending.
|
||||
c = Color ("red");
|
||||
c.blend (Color ("on white"));
|
||||
t.is ((std::string) c, "red on white", "red + on white -> red on white");
|
||||
|
||||
c = Color ("bold underline red");
|
||||
c.blend (Color ("on bright white"));
|
||||
t.is ((std::string) c, "bold underline red on bright white", "bold underline red + on bright white -> bold underline red on bright white");
|
||||
|
||||
// Blending with conflicts.
|
||||
c = Color ("red on white");
|
||||
c.blend (Color ("on blue"));
|
||||
t.is ((std::string) c, "red on blue", "red on white + on blue -> red on blue");
|
||||
|
||||
c = Color ("red on white");
|
||||
c.blend (Color ("blue on magenta"));
|
||||
t.is ((std::string) c, "blue on magenta", "red on white + blue on magenta -> blue on magenta");
|
||||
|
||||
// Blending with upgrades.
|
||||
c = Color ("color1 on color0");
|
||||
c.blend (Color ("blue"));
|
||||
t.is ((std::string) c, "color4 on color0", "color1 on color0 + blue -> color4 on color0");
|
||||
|
||||
// Now the dumb show of every color and its code.
|
||||
t.is (Color::colorize ("foo", "red"), std::string ("\033[31mfoo\033[0m"), "red -> ^[[31m");
|
||||
t.is (Color::colorize ("foo", "bold red"), std::string ("\033[1;31mfoo\033[0m"), "bold red -> ^[[1;31m");
|
||||
t.is (Color::colorize ("foo", "underline red"), std::string ("\033[4;31mfoo\033[0m"), "underline red -> ^[[4;31m");
|
||||
t.is (Color::colorize ("foo", "underline bold red"), std::string ("\033[1;4;31mfoo\033[0m"), "underline bold red -> ^[[1;4;31m");
|
||||
|
||||
// 16-color foregrounds.
|
||||
t.is (Color::colorize ("foo", ""), std::string ("foo"), "'' -> ''");
|
||||
|
||||
t.is (Color::colorize ("foo", "black"), std::string ("\033[30mfoo\033[0m"), "black -> ^[[30m");
|
||||
t.is (Color::colorize ("foo", "red"), std::string ("\033[31mfoo\033[0m"), "red -> ^[[31m");
|
||||
t.is (Color::colorize ("foo", "green"), std::string ("\033[32mfoo\033[0m"), "green -> ^[[32m");
|
||||
t.is (Color::colorize ("foo", "yellow"), std::string ("\033[33mfoo\033[0m"), "yellow -> ^[[33m");
|
||||
t.is (Color::colorize ("foo", "blue"), std::string ("\033[34mfoo\033[0m"), "blue -> ^[[34m");
|
||||
t.is (Color::colorize ("foo", "magenta"), std::string ("\033[35mfoo\033[0m"), "magenta -> ^[[35m");
|
||||
t.is (Color::colorize ("foo", "cyan"), std::string ("\033[36mfoo\033[0m"), "cyan -> ^[[36m");
|
||||
t.is (Color::colorize ("foo", "white"), std::string ("\033[37mfoo\033[0m"), "white -> ^[[37m");
|
||||
|
||||
// 16-color backgrounds.
|
||||
t.is (Color::colorize ("foo", "on bright black"), std::string ("\033[100mfoo\033[0m"), "on bright black -> ^[[100m");
|
||||
|
||||
t.is (Color::colorize ("foo", "on black"), std::string ("\033[40mfoo\033[0m"), "on black -> ^[[40m");
|
||||
t.is (Color::colorize ("foo", "on red"), std::string ("\033[41mfoo\033[0m"), "on red -> ^[[41m");
|
||||
t.is (Color::colorize ("foo", "on green"), std::string ("\033[42mfoo\033[0m"), "on green -> ^[[42m");
|
||||
t.is (Color::colorize ("foo", "on yellow"), std::string ("\033[43mfoo\033[0m"), "on yellow -> ^[[43m");
|
||||
t.is (Color::colorize ("foo", "on blue"), std::string ("\033[44mfoo\033[0m"), "on blue -> ^[[44m");
|
||||
t.is (Color::colorize ("foo", "on magenta"), std::string ("\033[45mfoo\033[0m"), "on magenta -> ^[[45m");
|
||||
t.is (Color::colorize ("foo", "on cyan"), std::string ("\033[46mfoo\033[0m"), "on cyan -> ^[[46m");
|
||||
t.is (Color::colorize ("foo", "on white"), std::string ("\033[47mfoo\033[0m"), "on white -> ^[[47m");
|
||||
|
||||
// 256-color, basic colors.
|
||||
char color [24];
|
||||
char codes [64];
|
||||
char description [64];
|
||||
for (int i = 0; i < 256; ++i)
|
||||
{
|
||||
sprintf (color, "color%d", i);
|
||||
sprintf (codes, "\033[38;5;%dmfoo\033[0m", i);
|
||||
sprintf (description, "color%d -> ^[[38;5;%dm", i, i);
|
||||
|
||||
t.is (Color::colorize ("foo", color), std::string (codes), description);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 256; ++i)
|
||||
{
|
||||
sprintf (color, "on color%d", i);
|
||||
sprintf (codes, "\033[48;5;%dmfoo\033[0m", i);
|
||||
sprintf (description, "on color%d -> ^[[48;5;%dm", i, i);
|
||||
|
||||
t.is (Color::colorize ("foo", color), std::string (codes), description);
|
||||
}
|
||||
|
||||
// RGB Color Cube.
|
||||
for (int r = 0; r < 6; ++r)
|
||||
for (int g = 0; g < 6; ++g)
|
||||
for (int b = 0; b < 6; ++b)
|
||||
{
|
||||
int code = 16 + (r*36 + g*6 + b);
|
||||
sprintf (color, "rgb%d%d%d", r, g, b);
|
||||
sprintf (codes, "\033[38;5;%dmfoo\033[0m", code);
|
||||
sprintf (description, "rgb%d%d%d -> ^[[38;5;%dm", r, g, b, code);
|
||||
|
||||
t.is (Color::colorize ("foo", color), std::string (codes), description);
|
||||
}
|
||||
|
||||
for (int r = 0; r < 6; ++r)
|
||||
for (int g = 0; g < 6; ++g)
|
||||
for (int b = 0; b < 6; ++b)
|
||||
{
|
||||
int code = 16 + (r*36 + g*6 + b);
|
||||
sprintf (color, "on rgb%d%d%d", r, g, b);
|
||||
sprintf (codes, "\033[48;5;%dmfoo\033[0m", code);
|
||||
sprintf (description, "on rgb%d%d%d -> ^[[48;5;%dm", r, g, b, code);
|
||||
|
||||
t.is (Color::colorize ("foo", color), std::string (codes), description);
|
||||
}
|
||||
|
||||
// 256-color, grays.
|
||||
// grey == gray.
|
||||
t.is (Color::colorize ("foo", "grey0"), std::string ("\033[38;5;232mfoo\033[0m"), "grey0 -> ^[[38;5;232m");
|
||||
|
||||
for (int i = 0; i < 24; ++i)
|
||||
{
|
||||
sprintf (color, "gray%d", i);
|
||||
sprintf (codes, "\033[38;5;%dmfoo\033[0m", i + 232);
|
||||
sprintf (description, "gray%d -> ^[[38;5;%dm", i + 232, i + 232);
|
||||
|
||||
t.is (Color::colorize ("foo", color), std::string (codes), description);
|
||||
}
|
||||
|
||||
for (int i = 0; i < 24; ++i)
|
||||
{
|
||||
sprintf (color, "on gray%d", i);
|
||||
sprintf (codes, "\033[48;5;%dmfoo\033[0m", i + 232);
|
||||
sprintf (description, "on gray%d -> ^[[48;5;%dm", i + 232, i + 232);
|
||||
|
||||
t.is (Color::colorize ("foo", color), std::string (codes), description);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
71
test/color.tag.t
Executable file
71
test/color.tag.t
Executable file
|
@ -0,0 +1,71 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 8;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'color.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"color.tagged=\n",
|
||||
"color.alternate=\n",
|
||||
"color.tag.none=yellow\n",
|
||||
"color.tag.red=red\n",
|
||||
"color.tag.green=green\n",
|
||||
"_forcecolor=1\n";
|
||||
close $fh;
|
||||
ok (-r 'color.rc', 'Created color.rc');
|
||||
}
|
||||
|
||||
# Test the add command.
|
||||
qx{../task rc:color.rc add nothing};
|
||||
qx{../task rc:color.rc add +red red};
|
||||
qx{../task rc:color.rc add +green green};
|
||||
my $output = qx{../task rc:color.rc list};
|
||||
|
||||
like ($output, qr/ \033\[33m .* nothing .* \033\[0m /x, 'color.tag.none');
|
||||
like ($output, qr/ \033\[31m .* red .* \033\[0m /x, 'color.tag.red');
|
||||
like ($output, qr/ \033\[32m .* green .* \033\[0m /x, 'color.tag.green');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'color.rc';
|
||||
ok (!-r 'color.rc', 'Removed color.rc');
|
||||
|
||||
exit 0;
|
||||
|
69
test/color.tagged.t
Executable file
69
test/color.tagged.t
Executable file
|
@ -0,0 +1,69 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 8;
|
||||
unlink 'pending.data';
|
||||
ok (!-r 'pending.data', 'Removed pending.data');
|
||||
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'color.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"color.tagged=red\n",
|
||||
"color.alternate=\n",
|
||||
"_forcecolor=1\n";
|
||||
close $fh;
|
||||
ok (-r 'color.rc', 'Created color.rc');
|
||||
}
|
||||
|
||||
# Test the add command.
|
||||
qx{../task rc:color.rc add nothing};
|
||||
qx{../task rc:color.rc add +tag red};
|
||||
my $output = qx{../task rc:color.rc list};
|
||||
|
||||
like ($output, qr/ (?!<\033\[\d\dm) .* nothing .* (?!>\033\[0m) /x, 'none');
|
||||
like ($output, qr/ \033\[31m .* red .* \033\[0m /x, 'color.tagged');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'color.rc';
|
||||
ok (!-r 'color.rc', 'Removed color.rc');
|
||||
|
||||
exit 0;
|
||||
|
67
test/completed.t
Executable file
67
test/completed.t
Executable file
|
@ -0,0 +1,67 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'completed.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'completed.rc', 'Created completed.rc');
|
||||
}
|
||||
|
||||
# Add two tasks, mark 1 as done, the other as deleted.
|
||||
qx{../task rc:completed.rc add one};
|
||||
qx{../task rc:completed.rc add two};
|
||||
qx{../task rc:completed.rc 1 done};
|
||||
qx{../task rc:completed.rc 2 delete};
|
||||
|
||||
# Generate completed report.
|
||||
my $output = qx{../task rc:completed.rc completed};
|
||||
like ($output, qr/one/, 'one -> completed');
|
||||
unlike ($output, qr/two/, 'two -> deleted');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'completed.rc';
|
||||
ok (!-r 'completed.rc', 'Removed completed.rc');
|
||||
|
||||
exit 0;
|
||||
|
63
test/config.obsolete.t
Executable file
63
test/config.obsolete.t
Executable file
|
@ -0,0 +1,63 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'obsolete.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"foo=1\n";
|
||||
close $fh;
|
||||
ok (-r 'obsolete.rc', 'Created obsolete.rc');
|
||||
}
|
||||
|
||||
# Test the add command.
|
||||
my $output = qx{../task rc:obsolete.rc show};
|
||||
|
||||
like ($output, qr/Your .taskrc file contains these unrecognized variables:\n/,
|
||||
'unsupported configuration variable');
|
||||
like ($output, qr/ foo\n/, 'unsupported configuration variable');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'obsolete.rc';
|
||||
ok (!-r 'obsolete.rc', 'Removed obsolete.rc');
|
||||
|
||||
exit 0;
|
||||
|
94
test/config.t.cpp
Normal file
94
test/config.t.cpp
Normal file
|
@ -0,0 +1,94 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free Software
|
||||
// Foundation; either version 2 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program; if not, write to the
|
||||
//
|
||||
// Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor,
|
||||
// Boston, MA
|
||||
// 02110-1301
|
||||
// USA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include <iostream>
|
||||
#include <Context.h>
|
||||
#include <test.h>
|
||||
|
||||
Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest t (11);
|
||||
|
||||
Config c;
|
||||
|
||||
// void set (const std::string&, const std::string&);
|
||||
// const std::string get (const std::string&);
|
||||
c.set ("str1", "one");
|
||||
t.is (c.get ("str1"), "one", "Config::set/get std::string");
|
||||
|
||||
c.set ("str1", "");
|
||||
t.is (c.get ("str1"), "", "Config::set/get std::string");
|
||||
|
||||
// void set (const std::string&, const int);
|
||||
// const int getInteger (const std::string&);
|
||||
c.set ("int1", 1);
|
||||
t.is (c.getInteger ("int1"), 1, "Config::set/get int");
|
||||
|
||||
c.set ("int2", 3);
|
||||
t.is (c.getInteger ("int2"), 3, "Config::set/get int");
|
||||
|
||||
c.set ("int3", -9);
|
||||
t.is (c.getInteger ("int3"), -9, "Config::set/get int");
|
||||
|
||||
// void set (const std::string&, const double);
|
||||
// const double getReal (const std::string&);
|
||||
c.set ("double1", 1.0);
|
||||
t.is (c.getReal ("double1"), 1.0, "Config::set/get double");
|
||||
|
||||
c.set ("double2", 3.0);
|
||||
t.is (c.getReal ("double2"), 3.0, "Config::set/get double");
|
||||
|
||||
c.set ("double3", -9.0);
|
||||
t.is (c.getReal ("double3"), -9.0, "Config::set/get double");
|
||||
|
||||
// void set (const std::string&, const bool);
|
||||
// const bool getBoolean (const std::string&);
|
||||
c.set ("bool1", false);
|
||||
t.is (c.getBoolean ("bool1"), false, "Config::set/get bool");
|
||||
|
||||
c.set ("bool1", true);
|
||||
t.is (c.getBoolean ("bool1"), true, "Config::set/get bool");
|
||||
|
||||
// void all (std::vector <std::string>&);
|
||||
std::vector <std::string> all;
|
||||
c.all (all);
|
||||
|
||||
// 8 created in this test program.
|
||||
// 22 default report setting created in Config::Config.
|
||||
t.ok (all.size () >= 8, "Config::all");
|
||||
|
||||
// TODO Test includes
|
||||
// TODO Test included nesting limit
|
||||
// TODO Test included absolute vs relative
|
||||
// TODO Test included missing file
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
147
test/confirmation.t
Executable file
147
test/confirmation.t
Executable file
|
@ -0,0 +1,147 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 48;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'confirm.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=yes\n";
|
||||
close $fh;
|
||||
ok (-r 'confirm.rc', 'Created confirm.rc');
|
||||
}
|
||||
|
||||
# Create the response file.
|
||||
if (open my $fh, '>', 'response.txt')
|
||||
{
|
||||
print $fh "\n\nn\n";
|
||||
close $fh;
|
||||
ok (-r 'response.txt', 'Created response.txt');
|
||||
}
|
||||
|
||||
qx{../task rc:confirm.rc add foo} for 1..10;
|
||||
|
||||
# Test the various forms of "Yes".
|
||||
my $output = qx{echo "Yes" | ../task rc:confirm.rc del 1};
|
||||
like ($output, qr/Permanently delete task 1 'foo'\? \(y\/n\)/, 'confirmation - Yes works');
|
||||
unlike ($output, qr/Task not deleted\./, 'confirmation - Yes works');
|
||||
|
||||
$output = qx{echo "ye" | ../task rc:confirm.rc del 2};
|
||||
like ($output, qr/Permanently delete task 2 'foo'\? \(y\/n\)/, 'confirmation - ye works');
|
||||
unlike ($output, qr/Task not deleted\./, 'confirmation - ye works');
|
||||
|
||||
$output = qx{echo "y" | ../task rc:confirm.rc del 3};
|
||||
like ($output, qr/Permanently delete task 3 'foo'\? \(y\/n\)/, 'confirmation - y works');
|
||||
unlike ($output, qr/Task not deleted\./, 'confirmation - y works');
|
||||
|
||||
$output = qx{echo "YES" | ../task rc:confirm.rc del 4};
|
||||
like ($output, qr/Permanently delete task 4 'foo'\? \(y\/n\)/, 'confirmation - YES works');
|
||||
unlike ($output, qr/Task not deleted\./, 'confirmation - YES works');
|
||||
|
||||
$output = qx{echo "YE" | ../task rc:confirm.rc del 5};
|
||||
like ($output, qr/Permanently delete task 5 'foo'\? \(y\/n\)/, 'confirmation - YE works');
|
||||
unlike ($output, qr/Task not deleted\./, 'confirmation - YE works');
|
||||
|
||||
$output = qx{echo "Y" | ../task rc:confirm.rc del 6};
|
||||
like ($output, qr/Permanently delete task 6 'foo'\? \(y\/n\)/, 'confirmation - Y works');
|
||||
unlike ($output, qr/Task not deleted\./, 'confirmation - Y works');
|
||||
|
||||
# Test the various forms of "no".
|
||||
$output = qx{echo "no" | ../task rc:confirm.rc del 7};
|
||||
like ($output, qr/Permanently delete task 7 'foo'\? \(y\/n\)/, 'confirmation - no works');
|
||||
like ($output, qr/Task not deleted\./, 'confirmation - no works');
|
||||
|
||||
$output = qx{echo "n" | ../task rc:confirm.rc del 7};
|
||||
like ($output, qr/Permanently delete task 7 'foo'\? \(y\/n\)/, 'confirmation - n works');
|
||||
like ($output, qr/Task not deleted\./, 'confirmation - n works');
|
||||
|
||||
$output = qx{echo "NO" | ../task rc:confirm.rc del 7};
|
||||
like ($output, qr/Permanently delete task 7 'foo'\? \(y\/n\)/, 'confirmation - NO works');
|
||||
like ($output, qr/Task not deleted\./, 'confirmation - NO works');
|
||||
|
||||
$output = qx{echo "N" | ../task rc:confirm.rc del 7};
|
||||
like ($output, qr/Permanently delete task 7 'foo'\? \(y\/n\)/, 'confirmation - N works');
|
||||
like ($output, qr/Task not deleted\./, 'confirmation - N works');
|
||||
|
||||
# Test Yes for multiple changes
|
||||
$output = qx{echo -e "y\nY\nY\nY\nY" | ../task rc:confirm.rc 7-10 +bar};
|
||||
like ($output, qr/Proceed with change\? \(Yes\/no\/All\/quit\)/, 'multiple confirmations - Y works');
|
||||
like ($output, qr/Task 7 "foo"/, 'multiple confirmations - Y works');
|
||||
like ($output, qr/Task 8 "foo"/, 'multiple confirmations - Y works');
|
||||
like ($output, qr/Task 9 "foo"/, 'multiple confirmations - Y works');
|
||||
like ($output, qr/Task 10 "foo"/, 'multiple confirmations - Y works');
|
||||
like ($output, qr/Modified 4 tasks/, 'multiple confirmations - Y works');
|
||||
|
||||
# Test no for multiple changes
|
||||
$output = qx{echo -e "N\nn\nn\nn\nn" | ../task rc:confirm.rc 7-10 -bar};
|
||||
like ($output, qr/Proceed with change\? \(Yes\/no\/All\/quit\)/, 'multiple confirmations - n works');
|
||||
like ($output, qr/Task 7 "foo"/, 'multiple confirmations - n works');
|
||||
like ($output, qr/Task 8 "foo"/, 'multiple confirmations - n works');
|
||||
like ($output, qr/Task 9 "foo"/, 'multiple confirmations - n works');
|
||||
like ($output, qr/Task 10 "foo"/, 'multiple confirmations - n works');
|
||||
like ($output, qr/Modified 0 tasks/, 'multiple confirmations - n works');
|
||||
|
||||
# Test All for multiple changes
|
||||
$output = qx{echo -e "a\nA" | ../task rc:confirm.rc 7-10 -bar};
|
||||
like ($output, qr/Proceed with change\? \(Yes\/no\/All\/quit\)/, 'multiple confirmations - A works');
|
||||
like ($output, qr/Task 7 "foo"/, 'multiple confirmations - A works');
|
||||
unlike ($output, qr/Task 8 "foo"/, 'multiple confirmations - A works');
|
||||
like ($output, qr/Modified 4 tasks/, 'multiple confirmations - A works');
|
||||
|
||||
# Test quit for multiple changes
|
||||
$output = qx{echo "q" | ../task rc:confirm.rc 7-10 +bar};
|
||||
like ($output, qr/Proceed with change\? \(Yes\/no\/All\/quit\)/, 'multiple confirmations - q works');
|
||||
like ($output, qr/Task 7 "foo"/, 'multiple confirmations - q works');
|
||||
unlike ($output, qr/Task 8 "foo"/, 'multiple confirmations - q works');
|
||||
like ($output, qr/Modified 0 tasks/, 'multiple confirmations - q works');
|
||||
|
||||
# Test newlines.
|
||||
$output = qx{cat response.txt | ../task rc:confirm.rc del 7};
|
||||
like ($output, qr/(Permanently delete task 7 'foo'\? \(y\/n\)) \1 \1/, 'confirmation - \n re-prompt works');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'response.txt';
|
||||
ok (!-r 'response.txt', 'Removed response.txt');
|
||||
|
||||
unlink 'confirm.rc';
|
||||
ok (!-r 'confirm.rc', 'Removed confirm.rc');
|
||||
|
||||
exit 0;
|
||||
|
79
test/count.t
Executable file
79
test/count.t
Executable file
|
@ -0,0 +1,79 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 10;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'count.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=off\n";
|
||||
close $fh;
|
||||
ok (-r 'count.rc', 'Created count.rc');
|
||||
}
|
||||
|
||||
# Test the count command.
|
||||
qx{../task rc:count.rc add one};
|
||||
qx{../task rc:count.rc log two};
|
||||
qx{../task rc:count.rc add three};
|
||||
qx{../task rc:count.rc delete 3};
|
||||
qx{../task rc:count.rc add four wait:eom};
|
||||
qx{../task rc:count.rc add five due:eom recur:monthly};
|
||||
|
||||
my $output = qx{../task rc:count.rc count};
|
||||
like ($output, qr/^5$/ms, 'count');
|
||||
|
||||
$output = qx{../task rc:count.rc count status:deleted};
|
||||
like ($output, qr/^1$/ms, 'count status:deleted');
|
||||
|
||||
$output = qx{../task rc:count.rc count e};
|
||||
like ($output, qr/^3$/ms, 'count e');
|
||||
|
||||
$output = qx{../task rc:count.rc count description.startswith:f};
|
||||
like ($output, qr/^2$/ms, 'count description.startswith:f');
|
||||
|
||||
$output = qx{../task rc:count.rc count due.any:};
|
||||
like ($output, qr/^1$/ms, 'count due.any:');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'count.rc';
|
||||
ok (!-r 'count.rc', 'Removed count.rc');
|
||||
|
||||
exit 0;
|
||||
|
190
test/countdown.t
Executable file
190
test/countdown.t
Executable file
|
@ -0,0 +1,190 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 85;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'countdown.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
print $fh "report.up.description=countdown+ report\n";
|
||||
print $fh "report.up.columns=id,countdown,description\n";
|
||||
print $fh "report.up.labels=ID,Countdown,Description\n";
|
||||
print $fh "report.up.filter=status:pending\n";
|
||||
print $fh "report.up.sort=countdown+\n";
|
||||
|
||||
print $fh "report.down.description=countdown- report\n";
|
||||
print $fh "report.down.columns=id,countdown,description\n";
|
||||
print $fh "report.down.labels=ID,Countdown,Description\n";
|
||||
print $fh "report.down.filter=status:pending\n";
|
||||
print $fh "report.down.sort=countdown-\n";
|
||||
|
||||
print $fh "report.upc.description=countdown_compact+ report\n";
|
||||
print $fh "report.upc.columns=id,countdown_compact,description\n";
|
||||
print $fh "report.upc.labels=ID,Countdown,Description\n";
|
||||
print $fh "report.upc.filter=status:pending\n";
|
||||
print $fh "report.upc.sort=countdown_compact+\n";
|
||||
|
||||
print $fh "report.downc.description=countdown_compact- report\n";
|
||||
print $fh "report.downc.columns=id,countdown_compact,description\n";
|
||||
print $fh "report.downc.labels=ID,Countdown,Description\n";
|
||||
print $fh "report.downc.filter=status:pending\n";
|
||||
print $fh "report.downc.sort=countdown_compact-\n";
|
||||
|
||||
close $fh;
|
||||
ok (-r 'countdown.rc', 'Created countdown.rc');
|
||||
}
|
||||
|
||||
# Create a variety of pending tasks with increasingly higher due dates
|
||||
# to ensure proper sort order.
|
||||
qx{../task rc:countdown.rc add one due:-1.2y};
|
||||
qx{../task rc:countdown.rc add two due:-9mo};
|
||||
qx{../task rc:countdown.rc add three due:-2mo};
|
||||
qx{../task rc:countdown.rc add four due:-3wk};
|
||||
qx{../task rc:countdown.rc add five due:-7d};
|
||||
qx{../task rc:countdown.rc add six due:-2d};
|
||||
qx{../task rc:countdown.rc add seven due:-1d};
|
||||
qx{../task rc:countdown.rc add eight due:-12h};
|
||||
qx{../task rc:countdown.rc add nine due:-6h};
|
||||
qx{../task rc:countdown.rc add ten due:-1h};
|
||||
qx{../task rc:countdown.rc add eleven due:-30s};
|
||||
qx{../task rc:countdown.rc add twelve due:1h};
|
||||
qx{../task rc:countdown.rc add thirteen due:6h};
|
||||
qx{../task rc:countdown.rc add fourteen due:12h};
|
||||
qx{../task rc:countdown.rc add fifteen due:1d};
|
||||
qx{../task rc:countdown.rc add sixteen due:2d};
|
||||
qx{../task rc:countdown.rc add seventeen due:7d};
|
||||
qx{../task rc:countdown.rc add eighteen due:3wk};
|
||||
qx{../task rc:countdown.rc add nineteen due:2mo};
|
||||
qx{../task rc:countdown.rc add twenty due:9mo};
|
||||
qx{../task rc:countdown.rc add twentyone due:1.2y};
|
||||
|
||||
my $output = qx{../task rc:countdown.rc up};
|
||||
like ($output, qr/\bone\b.+\btwo\b/ms, 'up: one < two');
|
||||
like ($output, qr/\btwo\b.+\bthree/ms, 'up: two < three');
|
||||
like ($output, qr/\bthree\b.+\bfour/ms, 'up: three < four');
|
||||
like ($output, qr/\bfour\b.+\bfive/ms, 'up: four < five');
|
||||
like ($output, qr/\bfive\b.+\bsix/ms, 'up: five < six');
|
||||
like ($output, qr/\bsix\b.+\bseven/ms, 'up: six < seven');
|
||||
like ($output, qr/\bseven\b.+\beight/ms, 'up: seven < eight');
|
||||
like ($output, qr/\beight\b.+\bnine/ms, 'up: eight < nine');
|
||||
like ($output, qr/\bnine\b.+\bten/ms, 'up: nine < ten');
|
||||
like ($output, qr/\bten\b.+\beleven/ms, 'up: ten < eleven');
|
||||
like ($output, qr/\beleven\b.+\btwelve/ms, 'up: eleven < twelve');
|
||||
like ($output, qr/\btwelve\b.+\bthirteen/ms, 'up: twelve < thirteen');
|
||||
like ($output, qr/\bthirteen\b.+\bfourteen/ms, 'up: thirteen < fourteen');
|
||||
like ($output, qr/\bfourteen\b.+\bfifteen/ms, 'up: fourteen < fifteen');
|
||||
like ($output, qr/\bfifteen\b.+\bsixteen/ms, 'up: fifteen < sixteen');
|
||||
like ($output, qr/\bsixteen\b.+\bseventeen/ms, 'up: sixteen < seventeen');
|
||||
like ($output, qr/\bseventeen\b.+\beighteen/ms, 'up: seventeen < eighteen');
|
||||
like ($output, qr/\beighteen\b.+\bnineteen/ms, 'up: eighteen < nineteen');
|
||||
like ($output, qr/\bnineteen\b.+\btwenty/ms, 'up: nineteen < twenty');
|
||||
like ($output, qr/\btwenty\b.+\btwentyone/ms, 'up: twenty < twentyone');
|
||||
|
||||
$output = qx{../task rc:countdown.rc down};
|
||||
like ($output, qr/\btwentyone\b.+\btwenty/ms, 'down: twentyone < twenty');
|
||||
like ($output, qr/\btwenty\b.+\bnineteen/ms, 'down: twenty < nineteen');
|
||||
like ($output, qr/\bnineteen\b.+\beighteen/ms, 'down: nineteen < eighteen');
|
||||
like ($output, qr/\beighteen\b.+\bseventeen/ms, 'down: eighteen < seventeen');
|
||||
like ($output, qr/\bseventeen\b.+\bsixteen/ms, 'down: seventeen < sixteen');
|
||||
like ($output, qr/\bsixteen\b.+\bfifteen/ms, 'down: sixteen < fifteen');
|
||||
like ($output, qr/\bfifteen\b.+\bfourteen/ms, 'down: fifteen < fourteen');
|
||||
like ($output, qr/\bfourteen\b.+\bthirteen/ms, 'down: fourteen < thirteen');
|
||||
like ($output, qr/\bthirteen\b.+\btwelve/ms, 'down: thirteen < twelve');
|
||||
like ($output, qr/\btwelve\b.+\beleven/ms, 'down: twelve < eleven');
|
||||
like ($output, qr/\beleven\b.+\bten/ms, 'down: eleven < ten');
|
||||
like ($output, qr/\bten\b.+\bnine/ms, 'down: ten < nine');
|
||||
like ($output, qr/\bnine\b.+\beight/ms, 'down: nine < eight');
|
||||
like ($output, qr/\beight\b.+\bseven/ms, 'down: eight < seven');
|
||||
like ($output, qr/\bseven\b.+\bsix/ms, 'down: seven < six');
|
||||
like ($output, qr/\bsix\b.+\bfive/ms, 'down: six < five');
|
||||
like ($output, qr/\bfive\b.+\bfour/ms, 'down: five < four');
|
||||
like ($output, qr/\bfour\b.+\bthree/ms, 'down: four < three');
|
||||
like ($output, qr/\bthree\b.+\btwo/ms, 'down: three < two');
|
||||
like ($output, qr/\btwo\b.+\bone\b/ms, 'down: two < one');
|
||||
|
||||
$output = qx{../task rc:countdown.rc upc};
|
||||
like ($output, qr/\bone\b.+\btwo\b/ms, 'upc: one < two');
|
||||
like ($output, qr/\btwo\b.+\bthree/ms, 'upc: two < three');
|
||||
like ($output, qr/\bthree\b.+\bfour/ms, 'upc: three < four');
|
||||
like ($output, qr/\bfour\b.+\bfive/ms, 'upc: four < five');
|
||||
like ($output, qr/\bfive\b.+\bsix/ms, 'upc: five < six');
|
||||
like ($output, qr/\bsix\b.+\bseven/ms, 'upc: six < seven');
|
||||
like ($output, qr/\bseven\b.+\beight/ms, 'upc: seven < eight');
|
||||
like ($output, qr/\beight\b.+\bnine/ms, 'upc: eight < nine');
|
||||
like ($output, qr/\bnine\b.+\bten/ms, 'upc: nine < ten');
|
||||
like ($output, qr/\bten\b.+\beleven/ms, 'upc: ten < eleven');
|
||||
like ($output, qr/\beleven\b.+\btwelve/ms, 'upc: eleven < twelve');
|
||||
like ($output, qr/\btwelve\b.+\bthirteen/ms, 'upc: twelve < thirteen');
|
||||
like ($output, qr/\bthirteen\b.+\bfourteen/ms, 'upc: thirteen < fourteen');
|
||||
like ($output, qr/\bfourteen\b.+\bfifteen/ms, 'upc: fourteen < fifteen');
|
||||
like ($output, qr/\bfifteen\b.+\bsixteen/ms, 'upc: fifteen < sixteen');
|
||||
like ($output, qr/\bsixteen\b.+\bseventeen/ms, 'upc: sixteen < seventeen');
|
||||
like ($output, qr/\bseventeen\b.+\beighteen/ms, 'upc: seventeen < eighteen');
|
||||
like ($output, qr/\beighteen\b.+\bnineteen/ms, 'upc: eighteen < nineteen');
|
||||
like ($output, qr/\bnineteen\b.+\btwenty/ms, 'upc: nineteen < twenty');
|
||||
like ($output, qr/\btwenty\b.+\btwentyone/ms, 'upc: twenty < twentyone');
|
||||
|
||||
$output = qx{../task rc:countdown.rc downc};
|
||||
like ($output, qr/\btwentyone\b.+\btwenty/ms, 'downc: twentyone < twenty');
|
||||
like ($output, qr/\btwenty\b.+\bnineteen/ms, 'downc: twenty < nineteen');
|
||||
like ($output, qr/\bnineteen\b.+\beighteen/ms, 'downc: nineteen < eighteen');
|
||||
like ($output, qr/\beighteen\b.+\bseventeen/ms, 'downc: eighteen < seventeen');
|
||||
like ($output, qr/\bseventeen\b.+\bsixteen/ms, 'downc: seventeen < sixteen');
|
||||
like ($output, qr/\bsixteen\b.+\bfifteen/ms, 'downc: sixteen < fifteen');
|
||||
like ($output, qr/\bfifteen\b.+\bfourteen/ms, 'downc: fifteen < fourteen');
|
||||
like ($output, qr/\bfourteen\b.+\bthirteen/ms, 'downc: fourteen < thirteen');
|
||||
like ($output, qr/\bthirteen\b.+\btwelve/ms, 'downc: thirteen < twelve');
|
||||
like ($output, qr/\btwelve\b.+\beleven/ms, 'downc: twelve < eleven');
|
||||
like ($output, qr/\beleven\b.+\bten/ms, 'downc: eleven < ten');
|
||||
like ($output, qr/\bten\b.+\bnine/ms, 'downc: ten < nine');
|
||||
like ($output, qr/\bnine\b.+\beight/ms, 'downc: nine < eight');
|
||||
like ($output, qr/\beight\b.+\bseven/ms, 'downc: eight < seven');
|
||||
like ($output, qr/\bseven\b.+\bsix/ms, 'downc: seven < six');
|
||||
like ($output, qr/\bsix\b.+\bfive/ms, 'downc: six < five');
|
||||
like ($output, qr/\bfive\b.+\bfour/ms, 'downc: five < four');
|
||||
like ($output, qr/\bfour\b.+\bthree/ms, 'downc: four < three');
|
||||
like ($output, qr/\bthree\b.+\btwo/ms, 'downc: three < two');
|
||||
like ($output, qr/\btwo\b.+\bone\b/ms, 'downc: two < one');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'countdown.rc';
|
||||
ok (!-r 'countdown.rc', 'Removed countdown.rc');
|
||||
|
||||
exit 0;
|
63
test/custom.columns.t
Executable file
63
test/custom.columns.t
Executable file
|
@ -0,0 +1,63 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 6;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'custom.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"report.foo.description=DESC\n",
|
||||
"report.foo.columns=id,foo,description\n",
|
||||
"report.foo.sort=id+\n",
|
||||
"report.foo.filter=project:A\n";
|
||||
close $fh;
|
||||
ok (-r 'custom.rc', 'Created custom.rc');
|
||||
}
|
||||
|
||||
# Generate the usage screen, and locate the custom report on it.
|
||||
my $output = qx{../task rc:custom.rc foo 2>&1};
|
||||
like ($output, qr/Unrecognized column name: foo\.\n/, 'custom report spotted invalid column');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'custom.rc';
|
||||
ok (!-r 'custom.rc', 'Removed custom.rc');
|
||||
|
||||
exit 0;
|
||||
|
72
test/custom.priority_long.t
Executable file
72
test/custom.priority_long.t
Executable file
|
@ -0,0 +1,72 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 10;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'pri.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"report.foo.description=DESC\n",
|
||||
"report.foo.columns=id,priority_long\n",
|
||||
"report.foo.labels=ID,P\n",
|
||||
"report.foo.sort=id+\n";
|
||||
close $fh;
|
||||
ok (-r 'pri.rc', 'Created pri.rc');
|
||||
}
|
||||
|
||||
# Generate the usage screen, and locate the custom report on it.
|
||||
qx{../task rc:pri.rc add one pri:H};
|
||||
qx{../task rc:pri.rc add two pri:M};
|
||||
qx{../task rc:pri.rc add three pri:L};
|
||||
qx{../task rc:pri.rc add four pri:};
|
||||
|
||||
my $output = qx{../task rc:pri.rc foo 2>&1};
|
||||
like ($output, qr/ID P/, 'priority_long indicator heading');
|
||||
like ($output, qr/1\s+High/, 'priority_long High');
|
||||
like ($output, qr/2\s+Medium/, 'priority_long Medium');
|
||||
like ($output, qr/3\s+Low/, 'priority_long Low');
|
||||
like ($output, qr/4\s*\n/, 'priority_long None');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'pri.rc';
|
||||
ok (!-r 'pri.rc', 'Removed pri.rc');
|
||||
|
||||
exit 0;
|
||||
|
71
test/custom.recur_ind.t
Executable file
71
test/custom.recur_ind.t
Executable file
|
@ -0,0 +1,71 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 10;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'custom.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"report.foo.description=DESC\n",
|
||||
"report.foo.columns=id,recurrence_indicator\n",
|
||||
"report.foo.labels=ID,R\n",
|
||||
"report.foo.sort=id+\n";
|
||||
close $fh;
|
||||
ok (-r 'custom.rc', 'Created custom.rc');
|
||||
}
|
||||
|
||||
# Add a recurring and non-recurring task, look for the indicator.
|
||||
qx{../task rc:custom.rc add foo due:tomorrow recur:weekly};
|
||||
qx{../task rc:custom.rc add bar};
|
||||
my $output = qx{../task rc:custom.rc foo 2>&1};
|
||||
like ($output, qr/ID R/, 'Recurrence indicator heading');
|
||||
like ($output, qr/2\s+R/, 'Recurrence indicator t1');
|
||||
unlike ($output, qr/1\s+R/, 'No recurrence indicator t2');
|
||||
|
||||
$output = qx{../task rc:custom.rc foo rc.recurrence.indicator=RE 2>&1};
|
||||
like ($output, qr/2\s+RE/, 'Custom recurrence indicator t1');
|
||||
unlike ($output, qr/1\s+RE/, 'No custom recurrence indicator t2');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'custom.rc';
|
||||
ok (!-r 'custom.rc', 'Removed custom.rc');
|
||||
|
||||
exit 0;
|
||||
|
69
test/custom.t
Executable file
69
test/custom.t
Executable file
|
@ -0,0 +1,69 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 8;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'custom.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"report.foo.description=DESC\n",
|
||||
"report.foo.columns=id,description\n",
|
||||
"report.foo.sort=id+\n",
|
||||
"report.foo.filter=project:A\n";
|
||||
close $fh;
|
||||
ok (-r 'custom.rc', 'Created custom.rc');
|
||||
}
|
||||
|
||||
# Generate the usage screen, and locate the custom report on it.
|
||||
my $output = qx{../task rc:custom.rc usage};
|
||||
like ($output, qr/task foo \[tags\] \[attrs\] desc\.\.\.\s+DESC\n/m, 'report.foo');
|
||||
|
||||
qx{../task rc:custom.rc add project:A one};
|
||||
qx{../task rc:custom.rc add two};
|
||||
$output = qx{../task rc:custom.rc foo};
|
||||
like ($output, qr/one/, 'custom filter included');
|
||||
unlike ($output, qr/two/, 'custom filter excluded');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'custom.rc';
|
||||
ok (!-r 'custom.rc', 'Removed custom.rc');
|
||||
|
||||
exit 0;
|
||||
|
71
test/custom.tag_ind.t
Executable file
71
test/custom.tag_ind.t
Executable file
|
@ -0,0 +1,71 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 10;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'custom.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"report.foo.description=DESC\n",
|
||||
"report.foo.columns=id,tag_indicator\n",
|
||||
"report.foo.labels=ID,T\n",
|
||||
"report.foo.sort=id+\n";
|
||||
close $fh;
|
||||
ok (-r 'custom.rc', 'Created custom.rc');
|
||||
}
|
||||
|
||||
# Generate the usage screen, and locate the custom report on it.
|
||||
qx{../task rc:custom.rc add foo +tag};
|
||||
qx{../task rc:custom.rc add bar};
|
||||
my $output = qx{../task rc:custom.rc foo 2>&1};
|
||||
like ($output, qr/ID T/, 'Tag indicator heading');
|
||||
like ($output, qr/1\s+\+/, 'Tag indicator t1');
|
||||
unlike ($output, qr/2\s+\+/, 'No tag indicator t2');
|
||||
|
||||
$output = qx{../task rc:custom.rc foo rc.tag.indicator=TAG 2>&1};
|
||||
like ($output, qr/1\s+TAG/, 'Custom ag indicator t1');
|
||||
unlike ($output, qr/2\s+TAG/, 'No custom tag indicator t2');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'custom.rc';
|
||||
ok (!-r 'custom.rc', 'Removed custom.rc');
|
||||
|
||||
exit 0;
|
||||
|
379
test/date.t.cpp
Normal file
379
test/date.t.cpp
Normal file
|
@ -0,0 +1,379 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free Software
|
||||
// Foundation; either version 2 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program; if not, write to the
|
||||
//
|
||||
// Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor,
|
||||
// Boston, MA
|
||||
// 02110-1301
|
||||
// USA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include <iostream>
|
||||
#include <Context.h>
|
||||
#include <Date.h>
|
||||
#include <test.h>
|
||||
|
||||
Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest t (162);
|
||||
|
||||
try
|
||||
{
|
||||
Date now;
|
||||
Date yesterday;
|
||||
yesterday -= 1;
|
||||
|
||||
t.ok (yesterday <= now, "yesterday <= now");
|
||||
t.ok (yesterday < now, "yesterday < now");
|
||||
t.notok (yesterday == now, "!(yesterday == now)");
|
||||
t.ok (yesterday != now, "yesterday != now");
|
||||
t.ok (now >= yesterday, "now >= yesterday");
|
||||
t.ok (now > yesterday, "now > yesterday");
|
||||
|
||||
// Date::Date ("now")
|
||||
Date relative_now ("now");
|
||||
t.ok (relative_now.sameHour (now), "Date ().sameHour (Date (now))");
|
||||
t.ok (relative_now.sameDay (now), "Date ().sameDay (Date (now))");
|
||||
t.ok (relative_now.sameMonth (now), "Date ().sameMonth (Date (now))");
|
||||
t.ok (relative_now.sameYear (now), "Date ().sameYear (Date (now))");
|
||||
|
||||
// Loose comparisons.
|
||||
Date left ("7/4/2008");
|
||||
Date comp1 ("7/4/2008");
|
||||
t.ok (left.sameDay (comp1), "7/4/2008 is on the same day as 7/4/2008");
|
||||
t.ok (left.sameMonth (comp1), "7/4/2008 is in the same month as 7/4/2008");
|
||||
t.ok (left.sameYear (comp1), "7/4/2008 is in the same year as 7/4/2008");
|
||||
|
||||
Date comp2 ("7/5/2008");
|
||||
t.notok (left.sameDay (comp2), "7/4/2008 is not on the same day as 7/5/2008");
|
||||
t.ok (left.sameMonth (comp2), "7/4/2008 is in the same month as 7/5/2008");
|
||||
t.ok (left.sameYear (comp2), "7/4/2008 is in the same year as 7/5/2008");
|
||||
|
||||
Date comp3 ("8/4/2008");
|
||||
t.notok (left.sameDay (comp3), "7/4/2008 is not on the same day as 8/4/2008");
|
||||
t.notok (left.sameMonth (comp3), "7/4/2008 is not in the same month as 8/4/2008");
|
||||
t.ok (left.sameYear (comp3), "7/4/2008 is in the same year as 8/4/2008");
|
||||
|
||||
Date comp4 ("7/4/2009");
|
||||
t.notok (left.sameDay (comp4), "7/4/2008 is not on the same day as 7/4/2009");
|
||||
t.notok (left.sameMonth (comp4), "7/4/2008 is not in the same month as 7/4/2009");
|
||||
t.notok (left.sameYear (comp4), "7/4/2008 is not in the same year as 7/4/2009");
|
||||
|
||||
// Validity.
|
||||
t.ok (Date::valid (2, 29, 2008), "valid: 2/29/2008");
|
||||
t.notok (Date::valid (2, 29, 2007), "invalid: 2/29/2007");
|
||||
|
||||
t.ok (Date::valid ("2/29/2008"), "valid: 2/29/2008");
|
||||
t.notok (Date::valid ("2/29/2007"), "invalid: 2/29/2007");
|
||||
|
||||
// Time validity.
|
||||
t.ok (Date::valid (2, 28, 2010, 0, 0, 0), "valid 2/28/2010 0:00:00");
|
||||
t.ok (Date::valid (2, 28, 2010, 23, 59, 59), "valid 2/28/2010 23:59:59");
|
||||
t.notok (Date::valid (2, 28, 2010, 24, 59, 59), "valid 2/28/2010 24:59:59");
|
||||
t.notok (Date::valid (2, 28, 2010, -1, 0, 0), "valid 2/28/2010 -1:00:00");
|
||||
|
||||
// Leap year.
|
||||
t.ok (Date::leapYear (2008), "2008 is a leap year");
|
||||
t.notok (Date::leapYear (2007), "2007 is not a leap year");
|
||||
t.ok (Date::leapYear (2000), "2000 is a leap year");
|
||||
t.notok (Date::leapYear (1900), "1900 is not a leap year");
|
||||
|
||||
// Days in month.
|
||||
t.is (Date::daysInMonth (2, 2008), 29, "29 days in February 2008");
|
||||
t.is (Date::daysInMonth (2, 2007), 28, "28 days in February 2007");
|
||||
|
||||
// Names.
|
||||
t.is (Date::monthName (1), "January", "1 = January");
|
||||
t.is (Date::monthName (2), "February", "2 = February");
|
||||
t.is (Date::monthName (3), "March", "3 = March");
|
||||
t.is (Date::monthName (4), "April", "4 = April");
|
||||
t.is (Date::monthName (5), "May", "5 = May");
|
||||
t.is (Date::monthName (6), "June", "6 = June");
|
||||
t.is (Date::monthName (7), "July", "7 = July");
|
||||
t.is (Date::monthName (8), "August", "8 = August");
|
||||
t.is (Date::monthName (9), "September", "9 = September");
|
||||
t.is (Date::monthName (10), "October", "10 = October");
|
||||
t.is (Date::monthName (11), "November", "11 = November");
|
||||
t.is (Date::monthName (12), "December", "12 = December");
|
||||
|
||||
t.is (Date::dayName (0), "Sunday", "0 == Sunday");
|
||||
t.is (Date::dayName (1), "Monday", "1 == Monday");
|
||||
t.is (Date::dayName (2), "Tuesday", "2 == Tuesday");
|
||||
t.is (Date::dayName (3), "Wednesday", "3 == Wednesday");
|
||||
t.is (Date::dayName (4), "Thursday", "4 == Thursday");
|
||||
t.is (Date::dayName (5), "Friday", "5 == Friday");
|
||||
t.is (Date::dayName (6), "Saturday", "6 == Saturday");
|
||||
|
||||
t.is (Date::dayOfWeek ("SUNDAY"), 0, "SUNDAY == 0");
|
||||
t.is (Date::dayOfWeek ("sunday"), 0, "sunday == 0");
|
||||
t.is (Date::dayOfWeek ("Sunday"), 0, "Sunday == 0");
|
||||
t.is (Date::dayOfWeek ("Monday"), 1, "Monday == 1");
|
||||
t.is (Date::dayOfWeek ("Tuesday"), 2, "Tuesday == 2");
|
||||
t.is (Date::dayOfWeek ("Wednesday"), 3, "Wednesday == 3");
|
||||
t.is (Date::dayOfWeek ("Thursday"), 4, "Thursday == 4");
|
||||
t.is (Date::dayOfWeek ("Friday"), 5, "Friday == 5");
|
||||
t.is (Date::dayOfWeek ("Saturday"), 6, "Saturday == 6");
|
||||
|
||||
Date happyNewYear (1, 1, 2008);
|
||||
t.is (happyNewYear.dayOfWeek (), 2, "1/1/2008 == Tuesday");
|
||||
t.is (happyNewYear.month (), 1, "1/1/2008 == January");
|
||||
t.is (happyNewYear.day (), 1, "1/1/2008 == 1");
|
||||
t.is (happyNewYear.year (), 2008, "1/1/2008 == 2008");
|
||||
|
||||
t.is (now - yesterday, 1, "today - yesterday == 1");
|
||||
|
||||
t.is (happyNewYear.toString (), "1/1/2008", "toString 1/1/2008");
|
||||
|
||||
int m, d, y;
|
||||
happyNewYear.toMDY (m, d, y);
|
||||
t.is (m, 1, "1/1/2008 == January");
|
||||
t.is (d, 1, "1/1/2008 == 1");
|
||||
t.is (y, 2008, "1/1/2008 == 2008");
|
||||
|
||||
Date epoch (9, 8, 2001);
|
||||
t.ok ((int)epoch.toEpoch () < 1000000000, "9/8/2001 < 1,000,000,000");
|
||||
epoch += 172800;
|
||||
t.ok ((int)epoch.toEpoch () > 1000000000, "9/10/2001 > 1,000,000,000");
|
||||
|
||||
Date fromEpoch (epoch.toEpoch ());
|
||||
t.is (fromEpoch.toString (), epoch.toString (), "ctor (time_t)");
|
||||
|
||||
Date iso (1000000000);
|
||||
t.is (iso.toISO (), "20010909T014640Z", "1,000,000,000 -> 20010909T014640Z");
|
||||
|
||||
// Quantization.
|
||||
Date quant (1234567890);
|
||||
t.is (quant.startOfDay ().toString ("YMDHNS"), "20090213000000", "1234567890 -> 2/13/2009 18:31:30 -> 2/13/2009 0:00:00");
|
||||
t.is (quant.startOfWeek ().toString ("YMDHNS"), "20090208000000", "1234567890 -> 2/13/2009 18:31:30 -> 2/8/2009 0:00:00");
|
||||
t.is (quant.startOfMonth ().toString ("YMDHNS"), "20090201000000", "1234567890 -> 2/13/2009 18:31:30 -> 2/1/2009 0:00:00");
|
||||
t.is (quant.startOfYear ().toString ("YMDHNS"), "20090101000000", "1234567890 -> 2/13/2009 18:31:30 -> 1/1/2009 0:00:00");
|
||||
|
||||
// Date parsing.
|
||||
Date fromString1 ("1/1/2008");
|
||||
t.is (fromString1.month (), 1, "ctor (std::string) -> m");
|
||||
t.is (fromString1.day (), 1, "ctor (std::string) -> d");
|
||||
t.is (fromString1.year (), 2008, "ctor (std::string) -> y");
|
||||
|
||||
Date fromString2 ("1/1/2008", "m/d/Y");
|
||||
t.is (fromString2.month (), 1, "ctor (std::string) -> m");
|
||||
t.is (fromString2.day (), 1, "ctor (std::string) -> d");
|
||||
t.is (fromString2.year (), 2008, "ctor (std::string) -> y");
|
||||
|
||||
Date fromString3 ("20080101", "YMD");
|
||||
t.is (fromString3.month (), 1, "ctor (std::string) -> m");
|
||||
t.is (fromString3.day (), 1, "ctor (std::string) -> d");
|
||||
t.is (fromString3.year (), 2008, "ctor (std::string) -> y");
|
||||
|
||||
Date fromString4 ("12/31/2007");
|
||||
t.is (fromString4.month (), 12, "ctor (std::string) -> m");
|
||||
t.is (fromString4.day (), 31, "ctor (std::string) -> d");
|
||||
t.is (fromString4.year (), 2007, "ctor (std::string) -> y");
|
||||
|
||||
Date fromString5 ("12/31/2007", "m/d/Y");
|
||||
t.is (fromString5.month (), 12, "ctor (std::string) -> m");
|
||||
t.is (fromString5.day (), 31, "ctor (std::string) -> d");
|
||||
t.is (fromString5.year (), 2007, "ctor (std::string) -> y");
|
||||
|
||||
Date fromString6 ("20071231", "YMD");
|
||||
t.is (fromString6.month (), 12, "ctor (std::string) -> m");
|
||||
t.is (fromString6.day (), 31, "ctor (std::string) -> d");
|
||||
t.is (fromString6.year (), 2007, "ctor (std::string) -> y");
|
||||
|
||||
Date fromString7 ("01/01/2008", "m/d/Y");
|
||||
t.is (fromString7.month (), 1, "ctor (std::string) -> m");
|
||||
t.is (fromString7.day (), 1, "ctor (std::string) -> d");
|
||||
t.is (fromString7.year (), 2008, "ctor (std::string) -> y");
|
||||
|
||||
Date fromString8 ("Tue 01 Jan 2008 (01)", "a D b Y (V)");
|
||||
t.is (fromString8.month (), 1, "ctor (std::string) -> m");
|
||||
t.is (fromString8.day (), 1, "ctor (std::string) -> d");
|
||||
t.is (fromString8.year (), 2008, "ctor (std::string) -> y");
|
||||
|
||||
Date fromString9 ("Tuesday, January 1, 2008", "A, B d, Y");
|
||||
t.is (fromString9.month (), 1, "ctor (std::string) -> m");
|
||||
t.is (fromString9.day (), 1, "ctor (std::string) -> d");
|
||||
t.is (fromString9.year (), 2008, "ctor (std::string) -> y");
|
||||
|
||||
Date fromString10 ("v01 Tue 2008-01-01", "vV a Y-M-D");
|
||||
t.is (fromString10.month (), 1, "ctor (std::string) -> m");
|
||||
t.is (fromString10.day (), 1, "ctor (std::string) -> d");
|
||||
t.is (fromString10.year (), 2008, "ctor (std::string) -> y");
|
||||
|
||||
Date fromString11 ("6/7/2010 1:23:45", "m/d/Y h:N:S");
|
||||
t.is (fromString11.month (), 6, "ctor (std::string) -> m");
|
||||
t.is (fromString11.day (), 7, "ctor (std::string) -> d");
|
||||
t.is (fromString11.year (), 2010, "ctor (std::string) -> Y");
|
||||
t.is (fromString11.hour (), 1, "ctor (std::string) -> h");
|
||||
t.is (fromString11.minute (), 23, "ctor (std::string) -> N");
|
||||
t.is (fromString11.second (), 45, "ctor (std::string) -> S");
|
||||
|
||||
Date fromString12 ("6/7/2010 01:23:45", "m/d/Y H:N:S");
|
||||
t.is (fromString12.month (), 6, "ctor (std::string) -> m");
|
||||
t.is (fromString12.day (), 7, "ctor (std::string) -> d");
|
||||
t.is (fromString12.year (), 2010, "ctor (std::string) -> Y");
|
||||
t.is (fromString12.hour (), 1, "ctor (std::string) -> h");
|
||||
t.is (fromString12.minute (), 23, "ctor (std::string) -> N");
|
||||
t.is (fromString12.second (), 45, "ctor (std::string) -> S");
|
||||
|
||||
Date fromString13 ("6/7/2010 12:34:56", "m/d/Y H:N:S");
|
||||
t.is (fromString13.month (), 6, "ctor (std::string) -> m");
|
||||
t.is (fromString13.day (), 7, "ctor (std::string) -> d");
|
||||
t.is (fromString13.year (), 2010, "ctor (std::string) -> Y");
|
||||
t.is (fromString13.hour (), 12, "ctor (std::string) -> h");
|
||||
t.is (fromString13.minute (), 34, "ctor (std::string) -> N");
|
||||
t.is (fromString13.second (), 56, "ctor (std::string) -> S");
|
||||
|
||||
// Easter
|
||||
Date e1 (Date::easter(1980));
|
||||
t.is (e1.toString (), "4/6/1980", "Easter 4/6/1980");
|
||||
Date e2 (Date::easter(1995));
|
||||
t.is (e2.toString (), "4/16/1995", "Easter 4/16/1995");
|
||||
Date e3 (Date::easter(2000));
|
||||
t.is (e3.toString (), "4/23/2000", "Easter 4/23/2000");
|
||||
Date e4 (Date::easter(2009));
|
||||
t.is (e4.toString (), "4/12/2009", "Easter 4/12/2009");
|
||||
Date e5 (Date::easter(2010));
|
||||
t.is (e5.toString (), "4/4/2010", "Easter 4/4/2010");
|
||||
Date e6 (Date::easter(2011));
|
||||
t.is (e6.toString (), "4/24/2011", "Easter 4/24/2011");
|
||||
Date e7 (Date::easter(2012));
|
||||
t.is (e7.toString (), "4/8/2012", "Easter 4/8/2012");
|
||||
Date e8 (Date::easter(2020));
|
||||
t.is (e8.toString (), "4/12/2020", "Easter 4/12/2020");
|
||||
|
||||
// Relative dates.
|
||||
Date r1 ("today");
|
||||
t.ok (r1.sameDay (now), "today = now");
|
||||
|
||||
Date r2 ("tomorrow");
|
||||
t.ok (r2.sameDay (now + 86400), "tomorrow = now + 1d");
|
||||
|
||||
Date r3 ("yesterday");
|
||||
t.ok (r3.sameDay (now - 86400), "yesterday = now - 1d");
|
||||
|
||||
Date r4 ("sunday");
|
||||
if (now.dayOfWeek () >= 0)
|
||||
t.ok (r4.sameDay (now + (0 - now.dayOfWeek () + 7) * 86400), "next sunday");
|
||||
else
|
||||
t.ok (r4.sameDay (now + (0 - now.dayOfWeek ()) * 86400), "next sunday");;
|
||||
|
||||
Date r5 ("monday");
|
||||
if (now.dayOfWeek () >= 1)
|
||||
t.ok (r5.sameDay (now + (1 - now.dayOfWeek () + 7) * 86400), "next monday");
|
||||
else
|
||||
t.ok (r5.sameDay (now + (1 - now.dayOfWeek ()) * 86400), "next monday");;
|
||||
|
||||
Date r6 ("tuesday");
|
||||
if (now.dayOfWeek () >= 2)
|
||||
t.ok (r6.sameDay (now + (2 - now.dayOfWeek () + 7) * 86400), "next tuesday");
|
||||
else
|
||||
t.ok (r6.sameDay (now + (2 - now.dayOfWeek ()) * 86400), "next tuesday");;
|
||||
|
||||
Date r7 ("wednesday");
|
||||
if (now.dayOfWeek () >= 3)
|
||||
t.ok (r7.sameDay (now + (3 - now.dayOfWeek () + 7) * 86400), "next wednesday");
|
||||
else
|
||||
t.ok (r7.sameDay (now + (3 - now.dayOfWeek ()) * 86400), "next wednesday");;
|
||||
|
||||
Date r8 ("thursday");
|
||||
if (now.dayOfWeek () >= 4)
|
||||
t.ok (r8.sameDay (now + (4 - now.dayOfWeek () + 7) * 86400), "next thursday");
|
||||
else
|
||||
t.ok (r8.sameDay (now + (4 - now.dayOfWeek ()) * 86400), "next thursday");;
|
||||
|
||||
Date r9 ("friday");
|
||||
if (now.dayOfWeek () >= 5)
|
||||
t.ok (r9.sameDay (now + (5 - now.dayOfWeek () + 7) * 86400), "next friday");
|
||||
else
|
||||
t.ok (r9.sameDay (now + (5 - now.dayOfWeek ()) * 86400), "next friday");;
|
||||
|
||||
Date r10 ("saturday");
|
||||
if (now.dayOfWeek () >= 6)
|
||||
t.ok (r10.sameDay (now + (6 - now.dayOfWeek () + 7) * 86400), "next saturday");
|
||||
else
|
||||
t.ok (r10.sameDay (now + (6 - now.dayOfWeek ()) * 86400), "next saturday");;
|
||||
|
||||
Date r11 ("eow");
|
||||
t.ok (r11 < now + (8 * 86400), "eow < 7 days away");
|
||||
|
||||
Date r20 ("eocw");
|
||||
t.ok (r20 < now + (8 * 86400), "eocw < 7 days away");
|
||||
|
||||
Date r12 ("eom");
|
||||
t.ok (r12.sameMonth (now), "eom in same month as now");
|
||||
|
||||
Date r13 ("eoy");
|
||||
t.ok (r13.sameYear (now), "eoy in same year as now");
|
||||
|
||||
Date r14 ("sow");
|
||||
t.ok (r14 < now + (8 * 86400), "sow < 7 days away");
|
||||
|
||||
Date r21 ("socw");
|
||||
t.ok (r21 < now + (8 * 86400), "sow < 7 days away");
|
||||
|
||||
Date r15 ("som");
|
||||
t.notok (r15.sameMonth (now), "som not in same month as now");
|
||||
|
||||
Date r16 ("soy");
|
||||
t.notok (r16.sameYear (now), "soy not in same year as now");
|
||||
|
||||
// Date::sameHour
|
||||
Date r17 ("6/7/2010 01:00:00", "m/d/Y H:N:S");
|
||||
Date r18 ("6/7/2010 01:59:59", "m/d/Y H:N:S");
|
||||
t.ok (r17.sameHour (r18), "two dates within the same hour");
|
||||
|
||||
Date r19 ("6/7/2010 00:59:59", "m/d/Y H:N:S");
|
||||
t.notok (r17.sameHour (r19), "two dates not within the same hour");
|
||||
|
||||
// Date::operator-
|
||||
Date r22 (1234567890);
|
||||
t.is ((r22 - 1).toEpoch (), 1234567889, "1234567890 - 1 = 1234567889");
|
||||
|
||||
// Date::operator--
|
||||
Date r23 (11, 7, 2010, 23, 59, 59);
|
||||
r23--;
|
||||
t.is (r23.toString ("YMDHNS"), "20101106235959", "decrement across fall DST boundary");
|
||||
|
||||
Date r24 (3, 14, 2010, 23, 59, 59);
|
||||
r24--;
|
||||
t.is (r24.toString ("YMDHNS"), "20100313235959", "decrement across spring DST boundary");
|
||||
|
||||
// Date::operator++
|
||||
Date r25 (11, 6, 2010, 23, 59, 59);
|
||||
r25++;
|
||||
t.is (r25.toString ("YMDHNS"), "20101107235959", "increment across fall DST boundary");
|
||||
|
||||
Date r26 (3, 13, 2010, 23, 59, 59);
|
||||
r26++;
|
||||
t.is (r26.toString ("YMDHNS"), "20100314235959", "increment across spring DST boundary");
|
||||
}
|
||||
|
||||
catch (std::string& e)
|
||||
{
|
||||
t.fail ("Exception thrown.");
|
||||
t.diag (e);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
103
test/dateformat.t
Executable file
103
test/dateformat.t
Executable file
|
@ -0,0 +1,103 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 15;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'date1.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"dateformat=YMD\n",
|
||||
"dateformat.report=YMD\n";
|
||||
close $fh;
|
||||
ok (-r 'date1.rc', 'Created date1.rc');
|
||||
}
|
||||
|
||||
if (open my $fh, '>', 'date2.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"dateformat=m/d/y\n",
|
||||
"dateformat.report=m/d/y\n";
|
||||
close $fh;
|
||||
ok (-r 'date2.rc', 'Created date2.rc');
|
||||
}
|
||||
|
||||
if (open my $fh, '>', 'date3.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"dateformat=m/d/y\n",
|
||||
"dateformat=m/d/y\n",
|
||||
"weekstart=Monday\n",
|
||||
"dateformat.report=A D B Y (vV)\n";
|
||||
close $fh;
|
||||
ok (-r 'date3.rc', 'Created date3.rc');
|
||||
}
|
||||
|
||||
qx{../task rc:date1.rc add foo due:20091231};
|
||||
my $output = qx{../task rc:date1.rc info 1};
|
||||
like ($output, qr/\b20091231\b/, 'date format YMD parsed');
|
||||
|
||||
unlink 'pending.data';
|
||||
ok (!-r 'pending.data', 'Removed pending.data');
|
||||
|
||||
qx{../task rc:date2.rc add foo due:12/1/09};
|
||||
$output = qx{../task rc:date2.rc info 1};
|
||||
like ($output, qr/\b12\/1\/09\b/, 'date format m/d/y parsed');
|
||||
|
||||
unlink 'pending.data';
|
||||
ok (!-r 'pending.data', 'Removed pending.data');
|
||||
|
||||
qx{../task rc:date3.rc add foo due:4/8/10};
|
||||
$output = qx{../task rc:date3.rc list};
|
||||
like ($output, qr/Thursday 08 April 2010 \(v14\)/, 'date format A D B Y (vV) parsed');
|
||||
$output = qx{../task rc:date3.rc rc.dateformat.report:"D b Y - a" list};
|
||||
like ($output, qr/08 Apr 2010 - Thu/, 'date format D b Y - a parsed');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'date1.rc';
|
||||
ok (!-r 'date1.rc', 'Removed date1.rc');
|
||||
|
||||
unlink 'date2.rc';
|
||||
ok (!-r 'date2.rc', 'Removed date2.rc');
|
||||
|
||||
unlink 'date3.rc';
|
||||
ok (!-r 'date3.rc', 'Removed date3.rc');
|
||||
|
||||
exit 0;
|
||||
|
73
test/datesort.t
Executable file
73
test/datesort.t
Executable file
|
@ -0,0 +1,73 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'datesort.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"dateformat=YMD\n",
|
||||
"report.small_list.description=Small list\n",
|
||||
"report.small_list.columns=due,description\n",
|
||||
"report.small_list.labels=Due,Description\n",
|
||||
"report.small_list.sort=due+\n",
|
||||
"report.small_list.filter=status:pending\n",
|
||||
"report.small_list.dateformat=MD\n";
|
||||
|
||||
close $fh;
|
||||
ok (-r 'datesort.rc', 'Created datesort.rc');
|
||||
}
|
||||
|
||||
qx{../task rc:datesort.rc add two due:20100201};
|
||||
qx{../task rc:datesort.rc add one due:20100101};
|
||||
qx{../task rc:datesort.rc add three due:20100301};
|
||||
|
||||
my $output = qx{../task rc:datesort.rc small_list};
|
||||
like ($output, qr/one.+two.+three/ms, 'Sorting by due+ with format MD works');
|
||||
|
||||
$output = qx{../task rc:datesort.rc rc.report.small_list.sort=due- small_list};
|
||||
like ($output, qr/three.+two.+one/ms, 'Sorting by due- with format MD works');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'datesort.rc';
|
||||
ok (!-r 'datesort.rc', 'Removed datesort.rc');
|
||||
|
||||
exit 0;
|
||||
|
94
test/default.t
Executable file
94
test/default.t
Executable file
|
@ -0,0 +1,94 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 22;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'default.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"default.command=list\n",
|
||||
"default.project=PROJECT\n",
|
||||
"default.priority=M\n",
|
||||
"default.due=eom\n";
|
||||
close $fh;
|
||||
ok (-r 'default.rc', 'Created default.rc');
|
||||
}
|
||||
|
||||
# Set up a default command, project and priority.
|
||||
qx{../task rc:default.rc add all defaults};
|
||||
my $output = qx{../task rc:default.rc list};
|
||||
like ($output, qr/ all defaults/, 'task added');
|
||||
like ($output, qr/ PROJECT /, 'default project added');
|
||||
like ($output, qr/ M /, 'default priority added');
|
||||
like ($output, qr/\//, 'default due added');
|
||||
unlink 'pending.data';
|
||||
|
||||
qx{../task rc:default.rc add project:specific priority:L due:eoy all specified};
|
||||
$output = qx{../task rc:default.rc list};
|
||||
like ($output, qr/ all specified/, 'task added');
|
||||
like ($output, qr/ specific /, 'project specified');
|
||||
like ($output, qr/ L /, 'priority specified');
|
||||
like ($output, qr/\//, 'due specified');
|
||||
unlink 'pending.data';
|
||||
|
||||
qx{../task rc:default.rc add project:specific project specified};
|
||||
$output = qx{../task rc:default.rc list};
|
||||
like ($output, qr/ project specified/, 'task added');
|
||||
like ($output, qr/ specific /, 'project specified');
|
||||
like ($output, qr/ M /, 'default priority added');
|
||||
like ($output, qr/\//, 'default due added');
|
||||
unlink 'pending.data';
|
||||
|
||||
qx{../task rc:default.rc add priority:L priority specified};
|
||||
$output = qx{../task rc:default.rc list};
|
||||
like ($output, qr/ priority specified/, 'task added');
|
||||
like ($output, qr/ PROJECT /, 'default project added');
|
||||
like ($output, qr/ L /, 'priority specified');
|
||||
like ($output, qr/\//, 'default due added');
|
||||
|
||||
$output = qx{../task rc:default.rc};
|
||||
like ($output, qr/1 PROJECT L .+ priority specified/, 'default command worked');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'default.rc';
|
||||
ok (!-r 'default.rc', 'Removed default.rc');
|
||||
|
||||
exit 0;
|
||||
|
80
test/delete.t
Executable file
80
test/delete.t
Executable file
|
@ -0,0 +1,80 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 17;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'delete.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n",
|
||||
"echo.command=no\n";
|
||||
close $fh;
|
||||
ok (-r 'delete.rc', 'Created delete.rc');
|
||||
}
|
||||
|
||||
# Add a task, delete it, undelete it.
|
||||
my $output = qx{../task rc:delete.rc add one; ../task rc:delete.rc info 1};
|
||||
ok (-r 'pending.data', 'pending.data created');
|
||||
like ($output, qr/Status\s+Pending\n/, 'Pending');
|
||||
|
||||
$output = qx{../task rc:delete.rc delete 1; ../task rc:delete.rc info 1};
|
||||
like ($output, qr/Status\s+Deleted\n/, 'Deleted');
|
||||
ok (-r 'completed.data', 'completed.data created');
|
||||
|
||||
$output = qx{echo 'y' | ../task rc:delete.rc undo; ../task rc:delete.rc info 1};
|
||||
like ($output, qr/Status\s+Pending\n/, 'Pending');
|
||||
ok (-r 'completed.data', 'completed.data created');
|
||||
|
||||
$output = qx{../task rc:delete.rc delete 1; ../task rc:delete.rc list};
|
||||
like ($output, qr/No matches./, 'No matches');
|
||||
ok (-r 'completed.data', 'completed.data created');
|
||||
|
||||
$output = qx{../task rc:delete.rc info 1};
|
||||
like ($output, qr/Task 1 not found/, 'No matches');
|
||||
|
||||
# Cleanup.
|
||||
ok (-r 'pending.data', 'Need to remove pending.data');
|
||||
unlink 'pending.data';
|
||||
ok (!-r 'pending.data', 'Removed pending.data');
|
||||
|
||||
ok (-r 'completed.data', 'Need to remove completed.data');
|
||||
unlink 'completed.data';
|
||||
ok (!-r 'completed.data', 'Removed completed.data');
|
||||
|
||||
ok (-r 'undo.data', 'Need to remove undo.data');
|
||||
unlink 'undo.data';
|
||||
ok (!-r 'undo.data', 'Removed undo.data');
|
||||
|
||||
unlink 'delete.rc';
|
||||
ok (!-r 'delete.rc', 'Removed delete.rc');
|
||||
|
||||
exit 0;
|
||||
|
123
test/denotate.t
Executable file
123
test/denotate.t
Executable file
|
@ -0,0 +1,123 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 30;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'denotate.rc')
|
||||
{
|
||||
# Note: Use 'rrr' to guarantee a unique report name. Using 'r' conflicts
|
||||
# with 'recurring'.
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=off\n",
|
||||
"report.rrr.description=rrr\n",
|
||||
"report.rrr.columns=id,description\n",
|
||||
"report.rrr.sort=id+\n";
|
||||
close $fh;
|
||||
ok (-r 'denotate.rc', 'Created denotate.rc');
|
||||
}
|
||||
|
||||
# Add four tasks, annotate one three times, one twice, one just once and one none.
|
||||
qx{../task rc:denotate.rc add one};
|
||||
qx{../task rc:denotate.rc annotate 1 Ernie};
|
||||
diag ("6 second delay");
|
||||
sleep 1;
|
||||
qx{../task rc:denotate.rc annotate 1 Bert};
|
||||
sleep 1;
|
||||
qx{../task rc:denotate.rc annotate 1 Bibo};
|
||||
sleep 1;
|
||||
qx{../task rc:denotate.rc annotate 1 Kermit the frog};
|
||||
sleep 1;
|
||||
qx{../task rc:denotate.rc annotate 1 Kermit the frog};
|
||||
sleep 1;
|
||||
qx{../task rc:denotate.rc annotate 1 Kermit};
|
||||
sleep 1;
|
||||
qx{../task rc:denotate.rc annotate 1 Kermit and Miss Piggy};
|
||||
|
||||
my $output = qx{../task rc:denotate.rc rrr};
|
||||
|
||||
like ($output, qr/1 one/, 'task 1');
|
||||
like ($output, qr/one.+\d{1,2}\/\d{1,2}\/\d{4} Ernie/ms, 'first annotation');
|
||||
like ($output, qr/Ernie.+\d{1,2}\/\d{1,2}\/\d{4} Bert/ms, 'second annotation');
|
||||
like ($output, qr/Bert.+\d{1,2}\/\d{1,2}\/\d{4} Bibo/ms, 'third annotation');
|
||||
like ($output, qr/Bibo.+\d{1,2}\/\d{1,2}\/\d{4} Kermit the frog/ms, 'fourth annotation');
|
||||
like ($output, qr/frog.+\d{1,2}\/\d{1,2}\/\d{4} Kermit the frog/ms, 'fifth annotation');
|
||||
like ($output, qr/frog.+\d{1,2}\/\d{1,2}\/\d{4} Kermit/ms, 'sixth annotation');
|
||||
like ($output, qr/Kermit.+\d{1,2}\/\d{1,2}\/\d{4} Kermit and Miss Piggy/ms, 'seventh annotation');
|
||||
like ($output, qr/1 task/, 'count');
|
||||
|
||||
qx{../task rc:denotate.rc denotate 1 Ernie};
|
||||
$output = qx{../task rc:denotate.rc rrr};
|
||||
unlike ($output, qr/one.+\d{1,2}\/\d{1,2}\/\d{4} Ernie/ms, 'Delete annotation');
|
||||
like ($output, qr/one.+\d{1,2}\/\d{1,2}\/\d{4} Bert/ms, 'Bert now first annotationt');
|
||||
|
||||
qx{../task rc:denotate.rc denotate 1 Bi};
|
||||
$output = qx{../task rc:denotate.rc rrr};
|
||||
unlike ($output, qr/Bert.+\d{1,2}\/\d{1,2}\/\d{4} Bibo/ms, 'Delete partial match');
|
||||
like ($output, qr/Bert.+\d{1,2}\/\d{1,2}\/\d{4} Kermit the frog/ms, 'Kermit the frog now second annotation');
|
||||
|
||||
qx{../task rc:denotate.rc denotate 1 BErt};
|
||||
$output = qx{../task rc:denotate.rc rrr};
|
||||
like ($output, qr/one.+\d{1,2}\/\d{1,2}\/\d{4} Bert/ms, 'Denotate is case sensitive');
|
||||
like ($output, qr/Bert.+\d{1,2}\/\d{1,2}\/\d{4} Kermit the frog/ms, 'Kermit the frog still second annoation');
|
||||
|
||||
qx{../task rc:denotate.rc denotate 1 Kermit};
|
||||
$output = qx{../task rc:denotate.rc rrr};
|
||||
like ($output, qr/one.+\d{1,2}\/\d{1,2}\/\d{4} Bert/ms, 'Exact match deletion - Bert');
|
||||
like ($output, qr/Bert.+\d{1,2}\/\d{1,2}\/\d{4} Kermit the frog/ms, 'Exact match deletion - Kermit the frog');
|
||||
like ($output, qr/frog.+\d{1,2}\/\d{1,2}\/\d{4} Kermit the frog/ms, 'Exact match deletion - Kermit the frog');
|
||||
like ($output, qr/frog.+\d{1,2}\/\d{1,2}\/\d{4} Kermit and Miss Piggy/ms, 'Exact match deletion - Kermit and Miss Piggy');
|
||||
|
||||
qx{../task rc:denotate.rc denotate 1 Kermit the};
|
||||
$output = qx{../task rc:denotate.rc rrr};
|
||||
like ($output, qr/one.+\d{1,2}\/\d{1,2}\/\d{4} Bert/ms, 'Delete just one annotation - Bert');
|
||||
like ($output, qr/Bert.+\d{1,2}\/\d{1,2}\/\d{4} Kermit the frog/ms, 'Delete just one annotation - Kermit the frog');
|
||||
like ($output, qr/frog.+\d{1,2}\/\d{1,2}\/\d{4} Kermit and Miss Piggy/ms, 'Delete just one annotation - Kermit and Miss Piggy');
|
||||
|
||||
qx{../task rc:denotate.rc denotate 1 Kermit a};
|
||||
$output = qx{../task rc:denotate.rc rrr};
|
||||
like ($output, qr/one.+\d{1,2}\/\d{1,2}\/\d{4} Bert/ms, 'Delete partial match - Bert');
|
||||
like ($output, qr/Bert.+\d{1,2}\/\d{1,2}\/\d{4} Kermit the frog/ms, 'Delete partial match - Kermit the frog');
|
||||
unlike ($output, qr/frog.+\d{1,2}\/\d{1,2}\/\d{4} Kermit and Miss Piggy/ms, 'Delete partial match - Kermit and Miss Piggy');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'denotate.rc';
|
||||
ok (!-r 'denotate.rc', 'Removed denotate.rc');
|
||||
|
||||
exit 0;
|
240
test/dependencies.t
Executable file
240
test/dependencies.t
Executable file
|
@ -0,0 +1,240 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 41;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'dep.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
print $fh "dependency.confirmation=yes\n";
|
||||
print $fh "report.depreport.columns=id,depends,description\n";
|
||||
print $fh "report.depreport.labels=ID,Depends,Description\n";
|
||||
print $fh "report.depreport.filter=status:pending\n";
|
||||
print $fh "report.depreport.sort=depends+\n";
|
||||
close $fh;
|
||||
|
||||
# [1]
|
||||
ok (-r 'dep.rc', 'Created dep.rc');
|
||||
}
|
||||
|
||||
qx{../task rc:dep.rc add One};
|
||||
qx{../task rc:dep.rc add Two};
|
||||
|
||||
# [2]
|
||||
my $output = qx{../task rc:dep.rc 1 dep:-2};
|
||||
like ($output, qr/Modified 0 tasks\./, 'dependencies - remove nonexistent dependency');
|
||||
|
||||
# [3]
|
||||
$output = qx{../task rc:dep.rc 1 dep:99};
|
||||
like ($output, qr/Could not create a dependency on task 99 - not found\./, 'dependencies - add dependency for nonexistent task');
|
||||
|
||||
# [4]
|
||||
$output = qx{../task rc:dep.rc 99 dep:1};
|
||||
like ($output, qr/Task 99 not found\./, 'dependencies - add dependency to nonexistent task');
|
||||
|
||||
# [5,6] t 1 dep:2; t info 1 => blocked by 2
|
||||
$output = qx{../task rc:dep.rc 1 dep:2; ../task rc:dep.rc info 1};
|
||||
like ($output, qr/This task blocked by\s+2 Two\nUUID/, 'dependencies - trivial blocked');
|
||||
unlike ($output, qr/This task is blocking\n/, 'dependencies - trivial blocked');
|
||||
|
||||
# [7,8] t info 2 => blocking 1
|
||||
$output = qx{../task rc:dep.rc info 2};
|
||||
unlike ($output, qr/This task blocked by/, 'dependencies - trivial blocking');
|
||||
like ($output, qr/This task is blocking\s+1 One\nUUID/, 'dependencies - trivial blocking');
|
||||
|
||||
# [9] t 1 dep:2 (again)
|
||||
$output = qx{../task rc:dep.rc 1 dep:2};
|
||||
like ($output, qr/Task 1 already depends on task 2\./, 'dependencies - add already existing dependency');
|
||||
|
||||
# [10,11] t 1 dep:1 => error
|
||||
$output = qx{../task rc:dep.rc 1 dep:1};
|
||||
like ($output, qr/A task cannot be dependent on itself\./, 'dependencies - cannot depend on self');
|
||||
unlike ($output, qr/Modified 1 task\./, 'dependencies - cannot depend on self');
|
||||
|
||||
# [12,13] t 1 dep:2; t 2 dep:1 => error
|
||||
$output = qx{../task rc:dep.rc 2 dep:1};
|
||||
like ($output, qr/Circular dependency detected and disallowed\./, 'dependencies - trivial circular');
|
||||
unlike ($output, qr/Modified 1 task\./, 'dependencies - trivial circular');
|
||||
|
||||
# [14,15] t 1 dep:2; t 2 dep:3; t 1 dep:3 => not circular
|
||||
qx{../task rc:dep.rc 1 dep:2};
|
||||
qx{../task rc:dep.rc add Three};
|
||||
qx{../task rc:dep.rc 2 dep:3};
|
||||
$output = qx{../task rc:dep.rc 1 dep:3};
|
||||
unlike ($output, qr/Circular dependency detected and disallowed\./, 'dependencies - diamond, non-circular');
|
||||
like ($output, qr/Modified 1 task\./, 'dependencies - diamond, non-circular');
|
||||
|
||||
# [16]
|
||||
unlink 'pending.data';
|
||||
ok (!-r 'pending.data', 'Removed pending.data for a fresh start');
|
||||
|
||||
qx{../task rc:dep.rc add One};
|
||||
qx{../task rc:dep.rc add Two};
|
||||
qx{../task rc:dep.rc add Three};
|
||||
qx{../task rc:dep.rc add Four};
|
||||
qx{../task rc:dep.rc add Five};
|
||||
|
||||
qx{../task rc:dep.rc 5 dep:4; ../task rc:dep.rc 4 dep:3; ../task rc:dep.rc 3 dep:2; ../task rc:dep.rc 2 dep:1};
|
||||
|
||||
# [17,18] 5 dep 4 dep 3 dep 2 dep 1 dep 5 => error
|
||||
$output = qx{../task rc:dep.rc 1 dep:5};
|
||||
like ($output, qr/Circular dependency detected and disallowed\./, 'dependencies - nontrivial circular');
|
||||
unlike ($output, qr/Modified 1 task\./, 'dependencies - nontrivial circular');
|
||||
|
||||
# [19]
|
||||
unlink 'pending.data';
|
||||
ok (!-r 'pending.data', 'Removed pending.data for a fresh start');
|
||||
|
||||
qx{../task rc:dep.rc add One};
|
||||
qx{../task rc:dep.rc add Two};
|
||||
qx{../task rc:dep.rc add Three};
|
||||
qx{../task rc:dep.rc add Four};
|
||||
qx{../task rc:dep.rc add Five};
|
||||
qx{../task rc:dep.rc add Six recurring due:tomorrow recur:daily};
|
||||
|
||||
# [20]
|
||||
qx{../task rc:dep.rc ls}; # To force handleRecurrence call.
|
||||
$output = qx{../task rc:dep.rc 6 dep:5};
|
||||
like ($output, qr/Modified \d+ task/, 'dependencies - recurring task depending on another task');
|
||||
|
||||
# [21]
|
||||
$output = qx{../task rc:dep.rc 4 dep:5};
|
||||
like ($output, qr/Modified \d+ task/, 'dependencies - task depending on recurring task');
|
||||
|
||||
# [22] t 1 dep:2,3,4; t 1 dep:-2,-4,5; t info 1 => blocked by 3,5
|
||||
$output = qx{../task rc:dep.rc 1 dep:2,3,4; ../task rc:dep.rc 1 dep:-2,-4,5; ../task rc:dep.rc info 1};
|
||||
like ($output, qr/This task blocked by\s+3 Three\n\s+5 Five\nUUID/, 'dependencies - multiple dependencies modified');
|
||||
|
||||
# [23,24]
|
||||
$output = qx{../task rc:dep.rc do 3,5; ../task rc:dep.rc info 1};
|
||||
unlike ($output, qr/This task blocked by/, 'dependencies - task info reflects completed dependencies');
|
||||
unlike ($output, qr/This task is blocking/, 'dependencies - task info reflects completed dependencies');
|
||||
|
||||
# [25]
|
||||
$output = qx{../task rc:dep.rc depreport};
|
||||
like ($output, qr/\s1\s+One\s+/, 'dependencies - depends report column reflects completed dependencies');
|
||||
|
||||
# [26]
|
||||
unlink 'pending.data';
|
||||
ok (!-r 'pending.data', 'Removed pending.data for a fresh start');
|
||||
|
||||
qx{../task rc:dep.rc add One};
|
||||
qx{../task rc:dep.rc add Two};
|
||||
qx{../task rc:dep.rc add Three};
|
||||
qx{../task rc:dep.rc add Four};
|
||||
|
||||
qx{../task rc:dep.rc 1 dep:3,4};
|
||||
qx{../task rc:dep.rc do 2};
|
||||
|
||||
# [27]
|
||||
$output = qx{../task rc:dep.rc depreport};
|
||||
like ($output, qr/\s1\s+2,3\s+One\s+/, 'dependencies - depends report column reflects changed IDs');
|
||||
|
||||
# [28]
|
||||
qx{../task rc:dep.rc do 3};
|
||||
$output = qx{../task rc:dep.rc depreport};
|
||||
like ($output, qr/\s1\s+2\s+One\s+/, 'dependencies - depends report column reflects completed dependencies');
|
||||
|
||||
# [29]
|
||||
unlink 'pending.data';
|
||||
ok (!-r 'pending.data', 'Removed pending.data for a fresh start');
|
||||
|
||||
qx{../task rc:dep.rc add One};
|
||||
qx{../task rc:dep.rc add Two};
|
||||
qx{../task rc:dep.rc add Three};
|
||||
qx{../task rc:dep.rc add Four};
|
||||
|
||||
qx{../task rc:dep.rc 2 dep:1; ../task rc:dep.rc 3 dep:2; ../task rc:dep.rc 4 dep:3};
|
||||
|
||||
# [30,31]
|
||||
$output = qx{echo y | ../task rc:dep.rc do 2};
|
||||
like ($output, qr/fixed/, 'dependencies - user prompted to fix broken chain after completing a blocked task');
|
||||
like ($output, qr/is blocked by/, 'dependencies - user nagged for completing a blocked task');
|
||||
|
||||
# [32]
|
||||
$output = qx{echo y | ../task rc:dep.rc do 1};
|
||||
unlike ($output, qr/fixed/, 'dependencies - user not prompted to fix broken chain when the head of the chain is marked as complete');
|
||||
|
||||
# [33]
|
||||
$output = qx{echo y | ../task rc:dep.rc del 4};
|
||||
unlike ($output, qr/fixed/, 'dependencies - user not prompted to fix broken chain when the tail of the chain is deleted');
|
||||
|
||||
# [34]
|
||||
unlink 'pending.data';
|
||||
ok (!-r 'pending.data', 'Removed pending.data for a fresh start');
|
||||
|
||||
qx{../task rc:dep.rc add One};
|
||||
qx{../task rc:dep.rc add Two};
|
||||
qx{../task rc:dep.rc add Three};
|
||||
qx{../task rc:dep.rc add Four};
|
||||
qx{../task rc:dep.rc add Five};
|
||||
|
||||
qx{../task rc:dep.rc 2 dep:1};
|
||||
qx{../task rc:dep.rc 3 dep:2};
|
||||
qx{../task rc:dep.rc 4 dep:3};
|
||||
qx{../task rc:dep.rc 5 dep:4};
|
||||
|
||||
# [35]
|
||||
qx{echo y | ../task rc:dep.rc do 2};
|
||||
$output = qx{../task rc:dep.rc depreport};
|
||||
like ($output, qr/\s1\s+One\s*\n\s2\s+1\s+Three\s*\n\s3\s+2\s+Four\s*\n\s4\s+3\s+Five/, 'dependencies - fixed chain after completing a blocked task');
|
||||
|
||||
# [36]
|
||||
qx{printf "Y\nY\n" | ../task rc:dep.rc del 2};
|
||||
$output = qx{../task rc:dep.rc depreport};
|
||||
like ($output, qr/\s1\s+One\s*\n\s2\s+1\s+Four\s*\n\s3\s+2\s+Five/, 'dependencies - fixed chain after deleting a blocked task');
|
||||
|
||||
# [37]
|
||||
qx{../task rc:dep.rc 2 dep:-1};
|
||||
$output = qx{../task rc:dep.rc depreport};
|
||||
like ($output, qr/\s1\s+One\s*\n\s2\s+Four\s*\n\s3\s+2\s+Five/, 'dependencies - chain should not be automatically repaired after manually removing a dependency');
|
||||
|
||||
# TODO - test dependency.confirmation config variable
|
||||
# TODO - test undo on backing out chain gap repair
|
||||
# TODO - test undo on backing out choice to not perform chain gap repair
|
||||
# TODO - test blocked task completion nag
|
||||
# TODO - test depend.any and depend.none report filters
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'dep.rc';
|
||||
ok (!-r 'dep.rc', 'Removed dep.rc');
|
||||
|
||||
exit 0;
|
||||
|
99
test/directory.t.cpp
Normal file
99
test/directory.t.cpp
Normal file
|
@ -0,0 +1,99 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006 - 2009, Paul Beckingham, Federico Hernandez.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free Software
|
||||
// Foundation; either version 2 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program; if not, write to the
|
||||
//
|
||||
// Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor,
|
||||
// Boston, MA
|
||||
// 02110-1301
|
||||
// USA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <algorithm>
|
||||
#include <Context.h>
|
||||
#include <Directory.h>
|
||||
#include <test.h>
|
||||
|
||||
Context context;
|
||||
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest t (21);
|
||||
|
||||
// Directory (const File&);
|
||||
// Directory (const Path&);
|
||||
Directory d0 (Path ("/tmp"));
|
||||
Directory d1 (File ("/tmp"));
|
||||
Directory d2 (File (Path ("/tmp")));
|
||||
t.is (d0.data, d1.data, "Directory(std::string) == Directory (File&)");
|
||||
t.is (d0.data, d2.data, "Directory(std::string) == Directory (File (Path &))");
|
||||
t.is (d1.data, d2.data, "Directory(File&)) == Directory (File (Path &))");
|
||||
|
||||
// Directory (const Directory&);
|
||||
Directory d3 (d2);
|
||||
t.is (d3.data, "/tmp", "Directory (Directory&)");
|
||||
|
||||
// Directory (const std::string&);
|
||||
Directory d4 ("/tmp/test_directory");
|
||||
|
||||
// Directory& operator= (const Directory&);
|
||||
Directory d5 = d4;
|
||||
t.is (d5.data, "/tmp/test_directory", "Directory::operator=");
|
||||
|
||||
// operator (std::string) const;
|
||||
t.is ((std::string) d3, "/tmp", "Directory::operator (std::string) const");
|
||||
|
||||
// virtual bool create ();
|
||||
t.ok (d5.create (), "Directory::create /tmp/test_directory");
|
||||
t.ok (d5.exists (), "Directory::exists /tmp/test_directory");
|
||||
|
||||
Directory d6 (d5.data + "/dir");
|
||||
t.ok (d6.create (), "Directory::create /tmp/test_directory/dir");
|
||||
|
||||
File::create (d5.data + "/f0");
|
||||
File::create (d6.data + "/f1");
|
||||
|
||||
// std::vector <std::string> list ();
|
||||
std::vector <std::string> files = d5.list ();
|
||||
std::sort (files.begin (), files.end ());
|
||||
t.is ((int)files.size (), 2, "Directory::list 1 file");
|
||||
t.is (files[0], "/tmp/test_directory/dir", "file[0] is /tmp/test_directory/dir");
|
||||
t.is (files[1], "/tmp/test_directory/f0", "file[1] is /tmp/test_directory/f0");
|
||||
|
||||
// std::vector <std::string> listRecursive ();
|
||||
files = d5.listRecursive ();
|
||||
std::sort (files.begin (), files.end ());
|
||||
t.is ((int)files.size (), 2, "Directory::list 1 file");
|
||||
t.is (files[0], "/tmp/test_directory/dir/f1", "file is /tmp/test_directory/dir/f1");
|
||||
t.is (files[1], "/tmp/test_directory/f0", "file is /tmp/test_directory/f0");
|
||||
|
||||
// virtual bool remove ();
|
||||
t.ok (File::remove (d5.data + "/f0"), "File::remove /tmp/test_directory/f0");
|
||||
t.ok (File::remove (d6.data + "/f1"), "File::remove /tmp/test_directory/dir/f1");
|
||||
|
||||
t.ok (d6.remove (), "Directory::remove /tmp/test_directory/dir");
|
||||
t.notok (d6.exists (), "Directory::exists /tmp/test_directory/dir - no");
|
||||
|
||||
t.ok (d5.remove (), "Directory::remove /tmp/test_directory");
|
||||
t.notok (d5.exists (), "Directory::exists /tmp/test_directory - no");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
81
test/due.t
Executable file
81
test/due.t
Executable file
|
@ -0,0 +1,81 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 9;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'due.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"due=4\n",
|
||||
"color=on\n",
|
||||
"color.due=red\n",
|
||||
"color.alternate=\n",
|
||||
"_forcecolor=on\n",
|
||||
"dateformat=m/d/Y\n";
|
||||
close $fh;
|
||||
ok (-r 'due.rc', 'Created due.rc');
|
||||
}
|
||||
|
||||
# Add a task that is almost due, and one that is just due.
|
||||
my ($d, $m, $y) = (localtime (time + 3 * 86_400))[3..5];
|
||||
my $just = sprintf ("%d/%d/%d", $m + 1, $d, $y + 1900);
|
||||
|
||||
($d, $m, $y) = (localtime (time + 5 * 86_400))[3..5];
|
||||
my $almost = sprintf ("%d/%d/%d", $m + 1, $d, $y + 1900);
|
||||
|
||||
qx{../task rc:due.rc add one due:$just};
|
||||
qx{../task rc:due.rc add two due:$almost};
|
||||
my $output = qx{../task rc:due.rc list};
|
||||
like ($output, qr/\[31m.+$just.+\[0m/, 'one marked due');
|
||||
like ($output, qr/\s+$almost\s+/, 'two not marked due');
|
||||
|
||||
qx{../task rc:due.rc add three due:today};
|
||||
$output = qx{../task rc:due.rc list due:today};
|
||||
like ($output, qr/three/, 'due:today works as a filter');
|
||||
|
||||
$output = qx{../task rc:due.rc list due.is:today};
|
||||
like ($output, qr/three/, 'due.is:today works as a filter');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'due.rc';
|
||||
ok (!-r 'due.rc', 'Removed due.rc');
|
||||
|
||||
exit 0;
|
||||
|
77
test/duplicate.t
Executable file
77
test/duplicate.t
Executable file
|
@ -0,0 +1,77 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 15;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'dup.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'dup.rc', 'Created dup.rc');
|
||||
}
|
||||
|
||||
# Test the duplicate command.
|
||||
qx{../task rc:dup.rc add foo};
|
||||
qx{../task rc:dup.rc duplicate 1};
|
||||
my $output = qx{../task rc:dup.rc info 2};
|
||||
like ($output, qr/ID\s+2/, 'duplicate new id');
|
||||
like ($output, qr/Status\s+Pending/, 'duplicate same status');
|
||||
like ($output, qr/Description\s+foo/, 'duplicate same description');
|
||||
|
||||
# Test the en passant modification while duplicating.
|
||||
qx{../task rc:dup.rc duplicate 1 priority:H /foo/FOO/ +tag};
|
||||
$output = qx{../task rc:dup.rc info 3};
|
||||
like ($output, qr/ID\s+3/, 'duplicate new id');
|
||||
like ($output, qr/Status\s+Pending/, 'duplicate same status');
|
||||
like ($output, qr/Description\s+FOO/, 'duplicate modified description');
|
||||
like ($output, qr/Priority\s+H/, 'duplicate added priority');
|
||||
like ($output, qr/Tags\s+tag/, 'duplicate added tag');
|
||||
|
||||
# Test the output of the duplicate command - returning id of duplicated task
|
||||
$output = qx{../task rc:dup.rc duplicate 1};
|
||||
like ($output, qr/Duplicated\s+1\s+'foo'/, 'duplicate output task id and description');
|
||||
like ($output, qr/Created\s+task\s+4/, 'duplicate output of new task id');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'dup.rc';
|
||||
ok (!-r 'dup.rc', 'Removed dup.rc');
|
||||
|
||||
exit 0;
|
||||
|
739
test/duration.t.cpp
Normal file
739
test/duration.t.cpp
Normal file
|
@ -0,0 +1,739 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free Software
|
||||
// Foundation; either version 2 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program; if not, write to the
|
||||
//
|
||||
// Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor,
|
||||
// Boston, MA
|
||||
// 02110-1301
|
||||
// USA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include <iostream>
|
||||
#include <Context.h>
|
||||
#include <Duration.h>
|
||||
#include <test.h>
|
||||
|
||||
Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// daily, day, Nd
|
||||
// weekly, 1w, sennight, biweekly, fortnight
|
||||
// monthly, bimonthly, Nm, semimonthly
|
||||
// 1st 2nd 3rd 4th .. 31st
|
||||
// quarterly, 1q
|
||||
// biannual, biyearly, annual, semiannual, yearly, 1y
|
||||
|
||||
int convertDuration (const std::string& input)
|
||||
{
|
||||
try { Duration d (input); return ((int) d) / 86400; }
|
||||
catch (...) {}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest t (606);
|
||||
|
||||
Duration d;
|
||||
|
||||
// std::string format ();
|
||||
d = Duration (0); t.is (d.format (), "-", "0 -> -");
|
||||
d = Duration (1); t.is (d.format (), "1 sec", "1 -> 1 sec");
|
||||
d = Duration (2); t.is (d.format (), "2 secs", "2 -> 2 secs");
|
||||
d = Duration (59); t.is (d.format (), "59 secs", "59 -> 59 secs");
|
||||
d = Duration (60); t.is (d.format (), "1 min", "60 -> 1 min");
|
||||
d = Duration (119); t.is (d.format (), "1 min", "119 -> 1 min");
|
||||
d = Duration (120); t.is (d.format (), "2 mins", "120 -> 2 mins");
|
||||
d = Duration (121); t.is (d.format (), "2 mins", "121 -> 2 mins");
|
||||
d = Duration (3599); t.is (d.format (), "59 mins", "3599 -> 59 mins");
|
||||
d = Duration (3600); t.is (d.format (), "1 hr", "3600 -> 1 hr");
|
||||
d = Duration (3601); t.is (d.format (), "1 hr", "3601 -> 1 hr");
|
||||
d = Duration (86399); t.is (d.format (), "23 hrs", "86399 -> 23 hrs");
|
||||
d = Duration (86400); t.is (d.format (), "1 day", "86400 -> 1 day");
|
||||
d = Duration (86401); t.is (d.format (), "1 day", "86401 -> 1 day");
|
||||
d = Duration (14 * 86400 - 1); t.is (d.format (), "1 wk", "14 days - 1 sec -> 1 wk");
|
||||
d = Duration (14 * 86400); t.is (d.format (), "2 wks", "14 days -> 2 wks");
|
||||
d = Duration (14 * 86400 + 1); t.is (d.format (), "2 wks", "14 days + 1 sec -> 2 wks");
|
||||
d = Duration (85 * 86400 - 1); t.is (d.format (), "2 mths", "85 days - 1 sec -> 2 mths");
|
||||
d = Duration (85 * 86400); t.is (d.format (), "2 mths", "85 days -> 2 mths");
|
||||
d = Duration (85 * 86400 + 1); t.is (d.format (), "2 mths", "85 days + 1 sec -> 2 mths");
|
||||
d = Duration (365 * 86400 - 1); t.is (d.format (), "11 mths", "365 days - 1 sec -> 11 mths");
|
||||
d = Duration (365 * 86400); t.is (d.format (), "1.0 yrs", "365 days -> 1.0 yrs");
|
||||
d = Duration (365 * 86400 + 1); t.is (d.format (), "1.0 yrs", "365 days + 1 sec -> 1.0 yrs");
|
||||
|
||||
// std::string formatCompact ();
|
||||
d = Duration (0), t.is (d.formatCompact (), "-", "0 -> -");
|
||||
d = Duration (1), t.is (d.formatCompact (), "1s", "1 -> 1s");
|
||||
d = Duration (2), t.is (d.formatCompact (), "2s", "2 -> 2s");
|
||||
d = Duration (59), t.is (d.formatCompact (), "59s", "59 -> 59s");
|
||||
d = Duration (60), t.is (d.formatCompact (), "1m", "60 -> 1m");
|
||||
d = Duration (119), t.is (d.formatCompact (), "1m", "119 -> 1m");
|
||||
d = Duration (120), t.is (d.formatCompact (), "2m", "120 -> 2m");
|
||||
d = Duration (121), t.is (d.formatCompact (), "2m", "121 -> 2m");
|
||||
d = Duration (3599), t.is (d.formatCompact (), "59m", "3599 -> 59m");
|
||||
d = Duration (3600), t.is (d.formatCompact (), "1h", "3600 -> 1h");
|
||||
d = Duration (3601), t.is (d.formatCompact (), "1h", "3601 -> 1h");
|
||||
d = Duration (86399), t.is (d.formatCompact (), "23h", "86399 -> 23h");
|
||||
d = Duration (86400), t.is (d.formatCompact (), "1d", "86400 -> 1d");
|
||||
d = Duration (86401), t.is (d.formatCompact (), "1d", "86401 -> 1d");
|
||||
d = Duration (14 * 86400 - 1), t.is (d.formatCompact (), "1wk", "14 days - 1 sec -> 1wk");
|
||||
d = Duration (14 * 86400), t.is (d.formatCompact (), "2wk", "14 days -> 2wk");
|
||||
d = Duration (14 * 86400 + 1), t.is (d.formatCompact (), "2wk", "14 days + 1 sec -> 2wk");
|
||||
d = Duration (85 * 86400 - 1), t.is (d.formatCompact (), "2mo", "85 days - 1 sec -> 2mo");
|
||||
d = Duration (85 * 86400), t.is (d.formatCompact (), "2mo", "85 days -> 2mo");
|
||||
d = Duration (85 * 86400 + 1), t.is (d.formatCompact (), "2mo", "85 days + 1 sec -> 2mo");
|
||||
d = Duration (365 * 86400 - 1), t.is (d.formatCompact (), "11mo", "365 days - 1 sec -> 11mo");
|
||||
d = Duration (365 * 86400), t.is (d.formatCompact (), "1.0y", "365 days -> 1.0y");
|
||||
d = Duration (365 * 86400 + 1), t.is (d.formatCompact (), "1.0y", "365 days + 1 sec -> 1.0y");
|
||||
|
||||
// Iterate for a whole year. Why? Just to see where the boundaries are,
|
||||
// so that changes can be made with some reference point.
|
||||
d = Duration ( 1*86400), t.is (d.formatCompact (), "1d", "1*86400 -> 1d");
|
||||
d = Duration ( 2*86400), t.is (d.formatCompact (), "2d", "2*86400 -> 2d");
|
||||
d = Duration ( 3*86400), t.is (d.formatCompact (), "3d", "3*86400 -> 3d");
|
||||
d = Duration ( 4*86400), t.is (d.formatCompact (), "4d", "4*86400 -> 4d");
|
||||
d = Duration ( 5*86400), t.is (d.formatCompact (), "5d", "5*86400 -> 5d");
|
||||
d = Duration ( 6*86400), t.is (d.formatCompact (), "6d", "6*86400 -> 6d");
|
||||
d = Duration ( 7*86400), t.is (d.formatCompact (), "7d", "7*86400 -> 7d");
|
||||
d = Duration ( 8*86400), t.is (d.formatCompact (), "8d", "8*86400 -> 8d");
|
||||
d = Duration ( 9*86400), t.is (d.formatCompact (), "9d", "9*86400 -> 9d");
|
||||
d = Duration ( 10*86400), t.is (d.formatCompact (), "10d", "10*86400 -> 10d");
|
||||
|
||||
d = Duration ( 11*86400), t.is (d.formatCompact (), "11d", "11*86400 -> 11d");
|
||||
d = Duration ( 12*86400), t.is (d.formatCompact (), "12d", "12*86400 -> 12d");
|
||||
d = Duration ( 13*86400), t.is (d.formatCompact (), "1wk", "13*86400 -> 1wk");
|
||||
d = Duration ( 14*86400), t.is (d.formatCompact (), "2wk", "14*86400 -> 2wk");
|
||||
d = Duration ( 15*86400), t.is (d.formatCompact (), "2wk", "15*86400 -> 2wk");
|
||||
d = Duration ( 16*86400), t.is (d.formatCompact (), "2wk", "16*86400 -> 2wk");
|
||||
d = Duration ( 17*86400), t.is (d.formatCompact (), "2wk", "17*86400 -> 2wk");
|
||||
d = Duration ( 18*86400), t.is (d.formatCompact (), "2wk", "18*86400 -> 2wk");
|
||||
d = Duration ( 19*86400), t.is (d.formatCompact (), "2wk", "19*86400 -> 2wk");
|
||||
d = Duration ( 20*86400), t.is (d.formatCompact (), "2wk", "20*86400 -> 2wk");
|
||||
|
||||
d = Duration ( 21*86400), t.is (d.formatCompact (), "3wk", "21*86400 -> 3wk");
|
||||
d = Duration ( 22*86400), t.is (d.formatCompact (), "3wk", "22*86400 -> 3wk");
|
||||
d = Duration ( 23*86400), t.is (d.formatCompact (), "3wk", "23*86400 -> 3wk");
|
||||
d = Duration ( 24*86400), t.is (d.formatCompact (), "3wk", "24*86400 -> 3wk");
|
||||
d = Duration ( 25*86400), t.is (d.formatCompact (), "3wk", "25*86400 -> 3wk");
|
||||
d = Duration ( 26*86400), t.is (d.formatCompact (), "3wk", "26*86400 -> 3wk");
|
||||
d = Duration ( 27*86400), t.is (d.formatCompact (), "3wk", "27*86400 -> 3wk");
|
||||
d = Duration ( 28*86400), t.is (d.formatCompact (), "4wk", "28*86400 -> 4wk");
|
||||
d = Duration ( 29*86400), t.is (d.formatCompact (), "4wk", "29*86400 -> 4wk");
|
||||
d = Duration ( 30*86400), t.is (d.formatCompact (), "4wk", "30*86400 -> 4wk");
|
||||
|
||||
d = Duration ( 31*86400), t.is (d.formatCompact (), "4wk", "31*86400 -> 4wk");
|
||||
d = Duration ( 32*86400), t.is (d.formatCompact (), "4wk", "32*86400 -> 4wk");
|
||||
d = Duration ( 33*86400), t.is (d.formatCompact (), "4wk", "33*86400 -> 4wk");
|
||||
d = Duration ( 34*86400), t.is (d.formatCompact (), "4wk", "34*86400 -> 4wk");
|
||||
d = Duration ( 35*86400), t.is (d.formatCompact (), "5wk", "35*86400 -> 5wk");
|
||||
d = Duration ( 36*86400), t.is (d.formatCompact (), "5wk", "36*86400 -> 5wk");
|
||||
d = Duration ( 37*86400), t.is (d.formatCompact (), "5wk", "37*86400 -> 5wk");
|
||||
d = Duration ( 38*86400), t.is (d.formatCompact (), "5wk", "38*86400 -> 5wk");
|
||||
d = Duration ( 39*86400), t.is (d.formatCompact (), "5wk", "39*86400 -> 5wk");
|
||||
d = Duration ( 40*86400), t.is (d.formatCompact (), "5wk", "40*86400 -> 5wk");
|
||||
|
||||
d = Duration ( 41*86400), t.is (d.formatCompact (), "5wk", "41*86400 -> 5wk");
|
||||
d = Duration ( 42*86400), t.is (d.formatCompact (), "6wk", "42*86400 -> 6wk");
|
||||
d = Duration ( 43*86400), t.is (d.formatCompact (), "6wk", "43*86400 -> 6wk");
|
||||
d = Duration ( 44*86400), t.is (d.formatCompact (), "6wk", "44*86400 -> 6wk");
|
||||
d = Duration ( 45*86400), t.is (d.formatCompact (), "6wk", "45*86400 -> 6wk");
|
||||
d = Duration ( 46*86400), t.is (d.formatCompact (), "6wk", "46*86400 -> 6wk");
|
||||
d = Duration ( 47*86400), t.is (d.formatCompact (), "6wk", "47*86400 -> 6wk");
|
||||
d = Duration ( 48*86400), t.is (d.formatCompact (), "6wk", "48*86400 -> 6wk");
|
||||
d = Duration ( 49*86400), t.is (d.formatCompact (), "7wk", "49*86400 -> 7wk");
|
||||
d = Duration ( 50*86400), t.is (d.formatCompact (), "7wk", "50*86400 -> 7wk");
|
||||
|
||||
d = Duration ( 51*86400), t.is (d.formatCompact (), "7wk", "51*86400 -> 7wk");
|
||||
d = Duration ( 52*86400), t.is (d.formatCompact (), "7wk", "52*86400 -> 7wk");
|
||||
d = Duration ( 53*86400), t.is (d.formatCompact (), "7wk", "53*86400 -> 7wk");
|
||||
d = Duration ( 54*86400), t.is (d.formatCompact (), "7wk", "54*86400 -> 7wk");
|
||||
d = Duration ( 55*86400), t.is (d.formatCompact (), "7wk", "55*86400 -> 7wk");
|
||||
d = Duration ( 56*86400), t.is (d.formatCompact (), "8wk", "56*86400 -> 8wk");
|
||||
d = Duration ( 57*86400), t.is (d.formatCompact (), "8wk", "57*86400 -> 8wk");
|
||||
d = Duration ( 58*86400), t.is (d.formatCompact (), "8wk", "58*86400 -> 8wk");
|
||||
d = Duration ( 59*86400), t.is (d.formatCompact (), "8wk", "59*86400 -> 8wk");
|
||||
d = Duration ( 60*86400), t.is (d.formatCompact (), "8wk", "60*86400 -> 8wk");
|
||||
|
||||
d = Duration ( 61*86400), t.is (d.formatCompact (), "8wk", "61*86400 -> 8wk");
|
||||
d = Duration ( 62*86400), t.is (d.formatCompact (), "8wk", "62*86400 -> 8wk");
|
||||
d = Duration ( 63*86400), t.is (d.formatCompact (), "9wk", "63*86400 -> 9wk");
|
||||
d = Duration ( 64*86400), t.is (d.formatCompact (), "9wk", "64*86400 -> 9wk");
|
||||
d = Duration ( 65*86400), t.is (d.formatCompact (), "9wk", "65*86400 -> 9wk");
|
||||
d = Duration ( 66*86400), t.is (d.formatCompact (), "9wk", "66*86400 -> 9wk");
|
||||
d = Duration ( 67*86400), t.is (d.formatCompact (), "9wk", "67*86400 -> 9wk");
|
||||
d = Duration ( 68*86400), t.is (d.formatCompact (), "9wk", "68*86400 -> 9wk");
|
||||
d = Duration ( 69*86400), t.is (d.formatCompact (), "9wk", "69*86400 -> 9wk");
|
||||
d = Duration ( 70*86400), t.is (d.formatCompact (), "10wk", "70*86400 -> 10wk");
|
||||
|
||||
d = Duration ( 71*86400), t.is (d.formatCompact (), "10wk", "71*86400 -> 10wk");
|
||||
d = Duration ( 72*86400), t.is (d.formatCompact (), "10wk", "72*86400 -> 10wk");
|
||||
d = Duration ( 73*86400), t.is (d.formatCompact (), "10wk", "73*86400 -> 10wk");
|
||||
d = Duration ( 74*86400), t.is (d.formatCompact (), "10wk", "74*86400 -> 10wk");
|
||||
d = Duration ( 75*86400), t.is (d.formatCompact (), "10wk", "75*86400 -> 10wk");
|
||||
d = Duration ( 76*86400), t.is (d.formatCompact (), "10wk", "76*86400 -> 10wk");
|
||||
d = Duration ( 77*86400), t.is (d.formatCompact (), "11wk", "77*86400 -> 11wk");
|
||||
d = Duration ( 78*86400), t.is (d.formatCompact (), "11wk", "78*86400 -> 11wk");
|
||||
d = Duration ( 79*86400), t.is (d.formatCompact (), "11wk", "79*86400 -> 11wk");
|
||||
d = Duration ( 80*86400), t.is (d.formatCompact (), "11wk", "80*86400 -> 11wk");
|
||||
|
||||
d = Duration ( 81*86400), t.is (d.formatCompact (), "11wk", "81*86400 -> 11wk");
|
||||
d = Duration ( 82*86400), t.is (d.formatCompact (), "11wk", "82*86400 -> 11wk");
|
||||
d = Duration ( 83*86400), t.is (d.formatCompact (), "11wk", "83*86400 -> 11wk");
|
||||
d = Duration ( 84*86400), t.is (d.formatCompact (), "2mo", "84*86400 -> 2mo");
|
||||
d = Duration ( 85*86400), t.is (d.formatCompact (), "2mo", "85*86400 -> 2mo");
|
||||
d = Duration ( 86*86400), t.is (d.formatCompact (), "2mo", "86*86400 -> 2mo");
|
||||
d = Duration ( 87*86400), t.is (d.formatCompact (), "2mo", "87*86400 -> 2mo");
|
||||
d = Duration ( 88*86400), t.is (d.formatCompact (), "2mo", "88*86400 -> 2mo");
|
||||
d = Duration ( 89*86400), t.is (d.formatCompact (), "2mo", "89*86400 -> 2mo");
|
||||
d = Duration ( 90*86400), t.is (d.formatCompact (), "2mo", "90*86400 -> 2mo");
|
||||
|
||||
d = Duration ( 91*86400), t.is (d.formatCompact (), "2mo", "91*86400 -> 2mo");
|
||||
d = Duration ( 92*86400), t.is (d.formatCompact (), "3mo", "92*86400 -> 3mo");
|
||||
d = Duration ( 93*86400), t.is (d.formatCompact (), "3mo", "93*86400 -> 3mo");
|
||||
d = Duration ( 94*86400), t.is (d.formatCompact (), "3mo", "94*86400 -> 3mo");
|
||||
d = Duration ( 95*86400), t.is (d.formatCompact (), "3mo", "95*86400 -> 3mo");
|
||||
d = Duration ( 96*86400), t.is (d.formatCompact (), "3mo", "96*86400 -> 3mo");
|
||||
d = Duration ( 97*86400), t.is (d.formatCompact (), "3mo", "97*86400 -> 3mo");
|
||||
d = Duration ( 98*86400), t.is (d.formatCompact (), "3mo", "98*86400 -> 3mo");
|
||||
d = Duration ( 99*86400), t.is (d.formatCompact (), "3mo", "99*86400 -> 3mo");
|
||||
d = Duration (100*86400), t.is (d.formatCompact (), "3mo", "100*86400 -> 3mo");
|
||||
|
||||
d = Duration (101*86400), t.is (d.formatCompact (), "3mo", "101*86400 -> 3mo");
|
||||
d = Duration (102*86400), t.is (d.formatCompact (), "3mo", "102*86400 -> 3mo");
|
||||
d = Duration (103*86400), t.is (d.formatCompact (), "3mo", "103*86400 -> 3mo");
|
||||
d = Duration (104*86400), t.is (d.formatCompact (), "3mo", "104*86400 -> 3mo");
|
||||
d = Duration (105*86400), t.is (d.formatCompact (), "3mo", "105*86400 -> 3mo");
|
||||
d = Duration (106*86400), t.is (d.formatCompact (), "3mo", "106*86400 -> 3mo");
|
||||
d = Duration (107*86400), t.is (d.formatCompact (), "3mo", "107*86400 -> 3mo");
|
||||
d = Duration (108*86400), t.is (d.formatCompact (), "3mo", "108*86400 -> 3mo");
|
||||
d = Duration (109*86400), t.is (d.formatCompact (), "3mo", "109*86400 -> 3mo");
|
||||
d = Duration (110*86400), t.is (d.formatCompact (), "3mo", "110*86400 -> 3mo");
|
||||
|
||||
d = Duration (111*86400), t.is (d.formatCompact (), "3mo", "111*86400 -> 3mo");
|
||||
d = Duration (112*86400), t.is (d.formatCompact (), "3mo", "112*86400 -> 3mo");
|
||||
d = Duration (113*86400), t.is (d.formatCompact (), "3mo", "113*86400 -> 3mo");
|
||||
d = Duration (114*86400), t.is (d.formatCompact (), "3mo", "114*86400 -> 3mo");
|
||||
d = Duration (115*86400), t.is (d.formatCompact (), "3mo", "115*86400 -> 3mo");
|
||||
d = Duration (116*86400), t.is (d.formatCompact (), "3mo", "116*86400 -> 3mo");
|
||||
d = Duration (117*86400), t.is (d.formatCompact (), "3mo", "117*86400 -> 3mo");
|
||||
d = Duration (118*86400), t.is (d.formatCompact (), "3mo", "118*86400 -> 3mo");
|
||||
d = Duration (119*86400), t.is (d.formatCompact (), "3mo", "119*86400 -> 3mo");
|
||||
d = Duration (120*86400), t.is (d.formatCompact (), "3mo", "120*86400 -> 3mo");
|
||||
|
||||
d = Duration (121*86400), t.is (d.formatCompact (), "3mo", "121*86400 -> 3mo");
|
||||
d = Duration (122*86400), t.is (d.formatCompact (), "3mo", "122*86400 -> 3mo");
|
||||
d = Duration (123*86400), t.is (d.formatCompact (), "4mo", "123*86400 -> 4mo");
|
||||
d = Duration (124*86400), t.is (d.formatCompact (), "4mo", "124*86400 -> 4mo");
|
||||
d = Duration (125*86400), t.is (d.formatCompact (), "4mo", "125*86400 -> 4mo");
|
||||
d = Duration (126*86400), t.is (d.formatCompact (), "4mo", "126*86400 -> 4mo");
|
||||
d = Duration (127*86400), t.is (d.formatCompact (), "4mo", "127*86400 -> 4mo");
|
||||
d = Duration (128*86400), t.is (d.formatCompact (), "4mo", "128*86400 -> 4mo");
|
||||
d = Duration (129*86400), t.is (d.formatCompact (), "4mo", "129*86400 -> 4mo");
|
||||
d = Duration (130*86400), t.is (d.formatCompact (), "4mo", "130*86400 -> 4mo");
|
||||
|
||||
d = Duration (131*86400), t.is (d.formatCompact (), "4mo", "131*86400 -> 4mo");
|
||||
d = Duration (132*86400), t.is (d.formatCompact (), "4mo", "132*86400 -> 4mo");
|
||||
d = Duration (133*86400), t.is (d.formatCompact (), "4mo", "133*86400 -> 4mo");
|
||||
d = Duration (134*86400), t.is (d.formatCompact (), "4mo", "134*86400 -> 4mo");
|
||||
d = Duration (135*86400), t.is (d.formatCompact (), "4mo", "135*86400 -> 4mo");
|
||||
d = Duration (136*86400), t.is (d.formatCompact (), "4mo", "136*86400 -> 4mo");
|
||||
d = Duration (137*86400), t.is (d.formatCompact (), "4mo", "137*86400 -> 4mo");
|
||||
d = Duration (138*86400), t.is (d.formatCompact (), "4mo", "138*86400 -> 4mo");
|
||||
d = Duration (139*86400), t.is (d.formatCompact (), "4mo", "139*86400 -> 4mo");
|
||||
d = Duration (140*86400), t.is (d.formatCompact (), "4mo", "140*86400 -> 4mo");
|
||||
|
||||
d = Duration (141*86400), t.is (d.formatCompact (), "4mo", "141*86400 -> 4mo");
|
||||
d = Duration (142*86400), t.is (d.formatCompact (), "4mo", "142*86400 -> 4mo");
|
||||
d = Duration (143*86400), t.is (d.formatCompact (), "4mo", "143*86400 -> 4mo");
|
||||
d = Duration (144*86400), t.is (d.formatCompact (), "4mo", "144*86400 -> 4mo");
|
||||
d = Duration (145*86400), t.is (d.formatCompact (), "4mo", "145*86400 -> 4mo");
|
||||
d = Duration (146*86400), t.is (d.formatCompact (), "4mo", "146*86400 -> 4mo");
|
||||
d = Duration (147*86400), t.is (d.formatCompact (), "4mo", "147*86400 -> 4mo");
|
||||
d = Duration (148*86400), t.is (d.formatCompact (), "4mo", "148*86400 -> 4mo");
|
||||
d = Duration (149*86400), t.is (d.formatCompact (), "4mo", "149*86400 -> 4mo");
|
||||
d = Duration (150*86400), t.is (d.formatCompact (), "4mo", "150*86400 -> 4mo");
|
||||
|
||||
d = Duration (151*86400), t.is (d.formatCompact (), "4mo", "151*86400 -> 4mo");
|
||||
d = Duration (152*86400), t.is (d.formatCompact (), "4mo", "152*86400 -> 4mo");
|
||||
d = Duration (153*86400), t.is (d.formatCompact (), "5mo", "153*86400 -> 5mo");
|
||||
d = Duration (154*86400), t.is (d.formatCompact (), "5mo", "154*86400 -> 5mo");
|
||||
d = Duration (155*86400), t.is (d.formatCompact (), "5mo", "155*86400 -> 5mo");
|
||||
d = Duration (156*86400), t.is (d.formatCompact (), "5mo", "156*86400 -> 5mo");
|
||||
d = Duration (157*86400), t.is (d.formatCompact (), "5mo", "157*86400 -> 5mo");
|
||||
d = Duration (158*86400), t.is (d.formatCompact (), "5mo", "158*86400 -> 5mo");
|
||||
d = Duration (159*86400), t.is (d.formatCompact (), "5mo", "159*86400 -> 5mo");
|
||||
d = Duration (160*86400), t.is (d.formatCompact (), "5mo", "160*86400 -> 5mo");
|
||||
|
||||
d = Duration (161*86400), t.is (d.formatCompact (), "5mo", "161*86400 -> 5mo");
|
||||
d = Duration (162*86400), t.is (d.formatCompact (), "5mo", "162*86400 -> 5mo");
|
||||
d = Duration (163*86400), t.is (d.formatCompact (), "5mo", "163*86400 -> 5mo");
|
||||
d = Duration (164*86400), t.is (d.formatCompact (), "5mo", "164*86400 -> 5mo");
|
||||
d = Duration (165*86400), t.is (d.formatCompact (), "5mo", "165*86400 -> 5mo");
|
||||
d = Duration (166*86400), t.is (d.formatCompact (), "5mo", "166*86400 -> 5mo");
|
||||
d = Duration (167*86400), t.is (d.formatCompact (), "5mo", "167*86400 -> 5mo");
|
||||
d = Duration (168*86400), t.is (d.formatCompact (), "5mo", "168*86400 -> 5mo");
|
||||
d = Duration (169*86400), t.is (d.formatCompact (), "5mo", "169*86400 -> 5mo");
|
||||
d = Duration (170*86400), t.is (d.formatCompact (), "5mo", "170*86400 -> 5mo");
|
||||
|
||||
d = Duration (171*86400), t.is (d.formatCompact (), "5mo", "171*86400 -> 5mo");
|
||||
d = Duration (172*86400), t.is (d.formatCompact (), "5mo", "172*86400 -> 5mo");
|
||||
d = Duration (173*86400), t.is (d.formatCompact (), "5mo", "173*86400 -> 5mo");
|
||||
d = Duration (174*86400), t.is (d.formatCompact (), "5mo", "174*86400 -> 5mo");
|
||||
d = Duration (175*86400), t.is (d.formatCompact (), "5mo", "175*86400 -> 5mo");
|
||||
d = Duration (176*86400), t.is (d.formatCompact (), "5mo", "176*86400 -> 5mo");
|
||||
d = Duration (177*86400), t.is (d.formatCompact (), "5mo", "177*86400 -> 5mo");
|
||||
d = Duration (178*86400), t.is (d.formatCompact (), "5mo", "178*86400 -> 5mo");
|
||||
d = Duration (179*86400), t.is (d.formatCompact (), "5mo", "179*86400 -> 5mo");
|
||||
d = Duration (180*86400), t.is (d.formatCompact (), "5mo", "180*86400 -> 5mo");
|
||||
|
||||
d = Duration (181*86400), t.is (d.formatCompact (), "5mo", "181*86400 -> 5mo");
|
||||
d = Duration (182*86400), t.is (d.formatCompact (), "5mo", "182*86400 -> 5mo");
|
||||
d = Duration (183*86400), t.is (d.formatCompact (), "5mo", "183*86400 -> 5mo");
|
||||
d = Duration (184*86400), t.is (d.formatCompact (), "6mo", "184*86400 -> 6mo");
|
||||
d = Duration (185*86400), t.is (d.formatCompact (), "6mo", "185*86400 -> 6mo");
|
||||
d = Duration (186*86400), t.is (d.formatCompact (), "6mo", "186*86400 -> 6mo");
|
||||
d = Duration (187*86400), t.is (d.formatCompact (), "6mo", "187*86400 -> 6mo");
|
||||
d = Duration (188*86400), t.is (d.formatCompact (), "6mo", "188*86400 -> 6mo");
|
||||
d = Duration (189*86400), t.is (d.formatCompact (), "6mo", "189*86400 -> 6mo");
|
||||
d = Duration (190*86400), t.is (d.formatCompact (), "6mo", "190*86400 -> 6mo");
|
||||
|
||||
d = Duration (191*86400), t.is (d.formatCompact (), "6mo", "191*86400 -> 6mo");
|
||||
d = Duration (192*86400), t.is (d.formatCompact (), "6mo", "192*86400 -> 6mo");
|
||||
d = Duration (193*86400), t.is (d.formatCompact (), "6mo", "193*86400 -> 6mo");
|
||||
d = Duration (194*86400), t.is (d.formatCompact (), "6mo", "194*86400 -> 6mo");
|
||||
d = Duration (195*86400), t.is (d.formatCompact (), "6mo", "195*86400 -> 6mo");
|
||||
d = Duration (196*86400), t.is (d.formatCompact (), "6mo", "196*86400 -> 6mo");
|
||||
d = Duration (197*86400), t.is (d.formatCompact (), "6mo", "197*86400 -> 6mo");
|
||||
d = Duration (198*86400), t.is (d.formatCompact (), "6mo", "198*86400 -> 6mo");
|
||||
d = Duration (199*86400), t.is (d.formatCompact (), "6mo", "199*86400 -> 6mo");
|
||||
d = Duration (200*86400), t.is (d.formatCompact (), "6mo", "200*86400 -> 6mo");
|
||||
|
||||
d = Duration (201*86400), t.is (d.formatCompact (), "6mo", "201*86400 -> 6mo");
|
||||
d = Duration (202*86400), t.is (d.formatCompact (), "6mo", "202*86400 -> 6mo");
|
||||
d = Duration (203*86400), t.is (d.formatCompact (), "6mo", "203*86400 -> 6mo");
|
||||
d = Duration (204*86400), t.is (d.formatCompact (), "6mo", "204*86400 -> 6mo");
|
||||
d = Duration (205*86400), t.is (d.formatCompact (), "6mo", "205*86400 -> 6mo");
|
||||
d = Duration (206*86400), t.is (d.formatCompact (), "6mo", "206*86400 -> 6mo");
|
||||
d = Duration (207*86400), t.is (d.formatCompact (), "6mo", "207*86400 -> 6mo");
|
||||
d = Duration (208*86400), t.is (d.formatCompact (), "6mo", "208*86400 -> 6mo");
|
||||
d = Duration (209*86400), t.is (d.formatCompact (), "6mo", "209*86400 -> 6mo");
|
||||
d = Duration (210*86400), t.is (d.formatCompact (), "6mo", "210*86400 -> 6mo");
|
||||
|
||||
d = Duration (211*86400), t.is (d.formatCompact (), "6mo", "211*86400 -> 6mo");
|
||||
d = Duration (212*86400), t.is (d.formatCompact (), "6mo", "212*86400 -> 6mo");
|
||||
d = Duration (213*86400), t.is (d.formatCompact (), "6mo", "213*86400 -> 6mo");
|
||||
d = Duration (214*86400), t.is (d.formatCompact (), "6mo", "214*86400 -> 6mo");
|
||||
d = Duration (215*86400), t.is (d.formatCompact (), "7mo", "215*86400 -> 7mo");
|
||||
d = Duration (216*86400), t.is (d.formatCompact (), "7mo", "216*86400 -> 7mo");
|
||||
d = Duration (217*86400), t.is (d.formatCompact (), "7mo", "217*86400 -> 7mo");
|
||||
d = Duration (218*86400), t.is (d.formatCompact (), "7mo", "218*86400 -> 7mo");
|
||||
d = Duration (219*86400), t.is (d.formatCompact (), "7mo", "219*86400 -> 7mo");
|
||||
d = Duration (220*86400), t.is (d.formatCompact (), "7mo", "220*86400 -> 7mo");
|
||||
|
||||
d = Duration (221*86400), t.is (d.formatCompact (), "7mo", "221*86400 -> 7mo");
|
||||
d = Duration (222*86400), t.is (d.formatCompact (), "7mo", "222*86400 -> 7mo");
|
||||
d = Duration (223*86400), t.is (d.formatCompact (), "7mo", "223*86400 -> 7mo");
|
||||
d = Duration (224*86400), t.is (d.formatCompact (), "7mo", "224*86400 -> 7mo");
|
||||
d = Duration (225*86400), t.is (d.formatCompact (), "7mo", "225*86400 -> 7mo");
|
||||
d = Duration (226*86400), t.is (d.formatCompact (), "7mo", "226*86400 -> 7mo");
|
||||
d = Duration (227*86400), t.is (d.formatCompact (), "7mo", "227*86400 -> 7mo");
|
||||
d = Duration (228*86400), t.is (d.formatCompact (), "7mo", "228*86400 -> 7mo");
|
||||
d = Duration (229*86400), t.is (d.formatCompact (), "7mo", "229*86400 -> 7mo");
|
||||
d = Duration (230*86400), t.is (d.formatCompact (), "7mo", "230*86400 -> 7mo");
|
||||
|
||||
d = Duration (231*86400), t.is (d.formatCompact (), "7mo", "231*86400 -> 7mo");
|
||||
d = Duration (232*86400), t.is (d.formatCompact (), "7mo", "232*86400 -> 7mo");
|
||||
d = Duration (233*86400), t.is (d.formatCompact (), "7mo", "233*86400 -> 7mo");
|
||||
d = Duration (234*86400), t.is (d.formatCompact (), "7mo", "234*86400 -> 7mo");
|
||||
d = Duration (235*86400), t.is (d.formatCompact (), "7mo", "235*86400 -> 7mo");
|
||||
d = Duration (236*86400), t.is (d.formatCompact (), "7mo", "236*86400 -> 7mo");
|
||||
d = Duration (237*86400), t.is (d.formatCompact (), "7mo", "237*86400 -> 7mo");
|
||||
d = Duration (238*86400), t.is (d.formatCompact (), "7mo", "238*86400 -> 7mo");
|
||||
d = Duration (239*86400), t.is (d.formatCompact (), "7mo", "239*86400 -> 7mo");
|
||||
d = Duration (240*86400), t.is (d.formatCompact (), "7mo", "240*86400 -> 7mo");
|
||||
|
||||
d = Duration (241*86400), t.is (d.formatCompact (), "7mo", "241*86400 -> 7mo");
|
||||
d = Duration (242*86400), t.is (d.formatCompact (), "7mo", "242*86400 -> 7mo");
|
||||
d = Duration (243*86400), t.is (d.formatCompact (), "7mo", "243*86400 -> 7mo");
|
||||
d = Duration (244*86400), t.is (d.formatCompact (), "7mo", "244*86400 -> 7mo");
|
||||
d = Duration (245*86400), t.is (d.formatCompact (), "8mo", "245*86400 -> 8mo");
|
||||
d = Duration (246*86400), t.is (d.formatCompact (), "8mo", "246*86400 -> 8mo");
|
||||
d = Duration (247*86400), t.is (d.formatCompact (), "8mo", "247*86400 -> 8mo");
|
||||
d = Duration (248*86400), t.is (d.formatCompact (), "8mo", "248*86400 -> 8mo");
|
||||
d = Duration (249*86400), t.is (d.formatCompact (), "8mo", "249*86400 -> 8mo");
|
||||
d = Duration (250*86400), t.is (d.formatCompact (), "8mo", "250*86400 -> 8mo");
|
||||
|
||||
d = Duration (251*86400), t.is (d.formatCompact (), "8mo", "251*86400 -> 8mo");
|
||||
d = Duration (252*86400), t.is (d.formatCompact (), "8mo", "252*86400 -> 8mo");
|
||||
d = Duration (253*86400), t.is (d.formatCompact (), "8mo", "253*86400 -> 8mo");
|
||||
d = Duration (254*86400), t.is (d.formatCompact (), "8mo", "254*86400 -> 8mo");
|
||||
d = Duration (255*86400), t.is (d.formatCompact (), "8mo", "255*86400 -> 8mo");
|
||||
d = Duration (256*86400), t.is (d.formatCompact (), "8mo", "256*86400 -> 8mo");
|
||||
d = Duration (257*86400), t.is (d.formatCompact (), "8mo", "257*86400 -> 8mo");
|
||||
d = Duration (258*86400), t.is (d.formatCompact (), "8mo", "258*86400 -> 8mo");
|
||||
d = Duration (259*86400), t.is (d.formatCompact (), "8mo", "259*86400 -> 8mo");
|
||||
d = Duration (260*86400), t.is (d.formatCompact (), "8mo", "260*86400 -> 8mo");
|
||||
|
||||
d = Duration (261*86400), t.is (d.formatCompact (), "8mo", "261*86400 -> 8mo");
|
||||
d = Duration (262*86400), t.is (d.formatCompact (), "8mo", "262*86400 -> 8mo");
|
||||
d = Duration (263*86400), t.is (d.formatCompact (), "8mo", "263*86400 -> 8mo");
|
||||
d = Duration (264*86400), t.is (d.formatCompact (), "8mo", "264*86400 -> 8mo");
|
||||
d = Duration (265*86400), t.is (d.formatCompact (), "8mo", "265*86400 -> 8mo");
|
||||
d = Duration (266*86400), t.is (d.formatCompact (), "8mo", "266*86400 -> 8mo");
|
||||
d = Duration (267*86400), t.is (d.formatCompact (), "8mo", "267*86400 -> 8mo");
|
||||
d = Duration (268*86400), t.is (d.formatCompact (), "8mo", "268*86400 -> 8mo");
|
||||
d = Duration (269*86400), t.is (d.formatCompact (), "8mo", "269*86400 -> 8mo");
|
||||
d = Duration (270*86400), t.is (d.formatCompact (), "8mo", "270*86400 -> 8mo");
|
||||
|
||||
d = Duration (271*86400), t.is (d.formatCompact (), "8mo", "271*86400 -> 8mo");
|
||||
d = Duration (272*86400), t.is (d.formatCompact (), "8mo", "272*86400 -> 8mo");
|
||||
d = Duration (273*86400), t.is (d.formatCompact (), "8mo", "273*86400 -> 8mo");
|
||||
d = Duration (274*86400), t.is (d.formatCompact (), "8mo", "274*86400 -> 8mo");
|
||||
d = Duration (275*86400), t.is (d.formatCompact (), "8mo", "275*86400 -> 8mo");
|
||||
d = Duration (276*86400), t.is (d.formatCompact (), "9mo", "276*86400 -> 9mo");
|
||||
d = Duration (277*86400), t.is (d.formatCompact (), "9mo", "277*86400 -> 9mo");
|
||||
d = Duration (278*86400), t.is (d.formatCompact (), "9mo", "278*86400 -> 9mo");
|
||||
d = Duration (279*86400), t.is (d.formatCompact (), "9mo", "279*86400 -> 9mo");
|
||||
d = Duration (280*86400), t.is (d.formatCompact (), "9mo", "280*86400 -> 9mo");
|
||||
|
||||
d = Duration (281*86400), t.is (d.formatCompact (), "9mo", "281*86400 -> 9mo");
|
||||
d = Duration (282*86400), t.is (d.formatCompact (), "9mo", "282*86400 -> 9mo");
|
||||
d = Duration (283*86400), t.is (d.formatCompact (), "9mo", "283*86400 -> 9mo");
|
||||
d = Duration (284*86400), t.is (d.formatCompact (), "9mo", "284*86400 -> 9mo");
|
||||
d = Duration (285*86400), t.is (d.formatCompact (), "9mo", "285*86400 -> 9mo");
|
||||
d = Duration (286*86400), t.is (d.formatCompact (), "9mo", "286*86400 -> 9mo");
|
||||
d = Duration (287*86400), t.is (d.formatCompact (), "9mo", "287*86400 -> 9mo");
|
||||
d = Duration (288*86400), t.is (d.formatCompact (), "9mo", "288*86400 -> 9mo");
|
||||
d = Duration (289*86400), t.is (d.formatCompact (), "9mo", "289*86400 -> 9mo");
|
||||
d = Duration (290*86400), t.is (d.formatCompact (), "9mo", "290*86400 -> 9mo");
|
||||
|
||||
d = Duration (291*86400), t.is (d.formatCompact (), "9mo", "291*86400 -> 9mo");
|
||||
d = Duration (292*86400), t.is (d.formatCompact (), "9mo", "292*86400 -> 9mo");
|
||||
d = Duration (293*86400), t.is (d.formatCompact (), "9mo", "293*86400 -> 9mo");
|
||||
d = Duration (294*86400), t.is (d.formatCompact (), "9mo", "294*86400 -> 9mo");
|
||||
d = Duration (295*86400), t.is (d.formatCompact (), "9mo", "295*86400 -> 9mo");
|
||||
d = Duration (296*86400), t.is (d.formatCompact (), "9mo", "296*86400 -> 9mo");
|
||||
d = Duration (297*86400), t.is (d.formatCompact (), "9mo", "297*86400 -> 9mo");
|
||||
d = Duration (298*86400), t.is (d.formatCompact (), "9mo", "298*86400 -> 9mo");
|
||||
d = Duration (299*86400), t.is (d.formatCompact (), "9mo", "299*86400 -> 9mo");
|
||||
d = Duration (300*86400), t.is (d.formatCompact (), "9mo", "300*86400 -> 9mo");
|
||||
|
||||
d = Duration (301*86400), t.is (d.formatCompact (), "9mo", "301*86400 -> 9mo");
|
||||
d = Duration (302*86400), t.is (d.formatCompact (), "9mo", "302*86400 -> 9mo");
|
||||
d = Duration (303*86400), t.is (d.formatCompact (), "9mo", "303*86400 -> 9mo");
|
||||
d = Duration (304*86400), t.is (d.formatCompact (), "9mo", "304*86400 -> 9mo");
|
||||
d = Duration (305*86400), t.is (d.formatCompact (), "9mo", "305*86400 -> 9mo");
|
||||
d = Duration (306*86400), t.is (d.formatCompact (), "10mo", "306*86400 -> 10mo");
|
||||
d = Duration (307*86400), t.is (d.formatCompact (), "10mo", "307*86400 -> 10mo");
|
||||
d = Duration (308*86400), t.is (d.formatCompact (), "10mo", "308*86400 -> 10mo");
|
||||
d = Duration (309*86400), t.is (d.formatCompact (), "10mo", "309*86400 -> 10mo");
|
||||
d = Duration (310*86400), t.is (d.formatCompact (), "10mo", "310*86400 -> 10mo");
|
||||
|
||||
d = Duration (311*86400), t.is (d.formatCompact (), "10mo", "311*86400 -> 10mo");
|
||||
d = Duration (312*86400), t.is (d.formatCompact (), "10mo", "312*86400 -> 10mo");
|
||||
d = Duration (313*86400), t.is (d.formatCompact (), "10mo", "313*86400 -> 10mo");
|
||||
d = Duration (314*86400), t.is (d.formatCompact (), "10mo", "314*86400 -> 10mo");
|
||||
d = Duration (315*86400), t.is (d.formatCompact (), "10mo", "315*86400 -> 10mo");
|
||||
d = Duration (316*86400), t.is (d.formatCompact (), "10mo", "316*86400 -> 10mo");
|
||||
d = Duration (317*86400), t.is (d.formatCompact (), "10mo", "317*86400 -> 10mo");
|
||||
d = Duration (318*86400), t.is (d.formatCompact (), "10mo", "318*86400 -> 10mo");
|
||||
d = Duration (319*86400), t.is (d.formatCompact (), "10mo", "319*86400 -> 10mo");
|
||||
d = Duration (320*86400), t.is (d.formatCompact (), "10mo", "320*86400 -> 10mo");
|
||||
|
||||
d = Duration (321*86400), t.is (d.formatCompact (), "10mo", "321*86400 -> 10mo");
|
||||
d = Duration (322*86400), t.is (d.formatCompact (), "10mo", "322*86400 -> 10mo");
|
||||
d = Duration (323*86400), t.is (d.formatCompact (), "10mo", "323*86400 -> 10mo");
|
||||
d = Duration (324*86400), t.is (d.formatCompact (), "10mo", "324*86400 -> 10mo");
|
||||
d = Duration (325*86400), t.is (d.formatCompact (), "10mo", "325*86400 -> 10mo");
|
||||
d = Duration (326*86400), t.is (d.formatCompact (), "10mo", "326*86400 -> 10mo");
|
||||
d = Duration (327*86400), t.is (d.formatCompact (), "10mo", "327*86400 -> 10mo");
|
||||
d = Duration (328*86400), t.is (d.formatCompact (), "10mo", "328*86400 -> 10mo");
|
||||
d = Duration (329*86400), t.is (d.formatCompact (), "10mo", "329*86400 -> 10mo");
|
||||
d = Duration (330*86400), t.is (d.formatCompact (), "10mo", "330*86400 -> 10mo");
|
||||
|
||||
d = Duration (331*86400), t.is (d.formatCompact (), "10mo", "331*86400 -> 10mo");
|
||||
d = Duration (332*86400), t.is (d.formatCompact (), "10mo", "332*86400 -> 10mo");
|
||||
d = Duration (333*86400), t.is (d.formatCompact (), "10mo", "333*86400 -> 10mo");
|
||||
d = Duration (334*86400), t.is (d.formatCompact (), "10mo", "334*86400 -> 10mo");
|
||||
d = Duration (335*86400), t.is (d.formatCompact (), "10mo", "335*86400 -> 10mo");
|
||||
d = Duration (336*86400), t.is (d.formatCompact (), "10mo", "336*86400 -> 10mo");
|
||||
d = Duration (337*86400), t.is (d.formatCompact (), "11mo", "337*86400 -> 11mo");
|
||||
d = Duration (338*86400), t.is (d.formatCompact (), "11mo", "338*86400 -> 11mo");
|
||||
d = Duration (339*86400), t.is (d.formatCompact (), "11mo", "339*86400 -> 11mo");
|
||||
d = Duration (340*86400), t.is (d.formatCompact (), "11mo", "340*86400 -> 11mo");
|
||||
|
||||
d = Duration (341*86400), t.is (d.formatCompact (), "11mo", "341*86400 -> 11mo");
|
||||
d = Duration (342*86400), t.is (d.formatCompact (), "11mo", "342*86400 -> 11mo");
|
||||
d = Duration (343*86400), t.is (d.formatCompact (), "11mo", "343*86400 -> 11mo");
|
||||
d = Duration (344*86400), t.is (d.formatCompact (), "11mo", "344*86400 -> 11mo");
|
||||
d = Duration (345*86400), t.is (d.formatCompact (), "11mo", "345*86400 -> 11mo");
|
||||
d = Duration (346*86400), t.is (d.formatCompact (), "11mo", "346*86400 -> 11mo");
|
||||
d = Duration (347*86400), t.is (d.formatCompact (), "11mo", "347*86400 -> 11mo");
|
||||
d = Duration (348*86400), t.is (d.formatCompact (), "11mo", "348*86400 -> 11mo");
|
||||
d = Duration (349*86400), t.is (d.formatCompact (), "11mo", "349*86400 -> 11mo");
|
||||
d = Duration (350*86400), t.is (d.formatCompact (), "11mo", "350*86400 -> 11mo");
|
||||
|
||||
d = Duration (351*86400), t.is (d.formatCompact (), "11mo", "351*86400 -> 11mo");
|
||||
d = Duration (352*86400), t.is (d.formatCompact (), "11mo", "352*86400 -> 11mo");
|
||||
d = Duration (353*86400), t.is (d.formatCompact (), "11mo", "353*86400 -> 11mo");
|
||||
d = Duration (354*86400), t.is (d.formatCompact (), "11mo", "354*86400 -> 11mo");
|
||||
d = Duration (355*86400), t.is (d.formatCompact (), "11mo", "355*86400 -> 11mo");
|
||||
d = Duration (356*86400), t.is (d.formatCompact (), "11mo", "356*86400 -> 11mo");
|
||||
d = Duration (357*86400), t.is (d.formatCompact (), "11mo", "357*86400 -> 11mo");
|
||||
d = Duration (358*86400), t.is (d.formatCompact (), "11mo", "358*86400 -> 11mo");
|
||||
d = Duration (359*86400), t.is (d.formatCompact (), "11mo", "359*86400 -> 11mo");
|
||||
d = Duration (360*86400), t.is (d.formatCompact (), "11mo", "360*86400 -> 11mo");
|
||||
|
||||
d = Duration (361*86400), t.is (d.formatCompact (), "11mo", "361*86400 -> 11mo");
|
||||
d = Duration (362*86400), t.is (d.formatCompact (), "11mo", "362*86400 -> 11mo");
|
||||
d = Duration (363*86400), t.is (d.formatCompact (), "11mo", "363*86400 -> 11mo");
|
||||
d = Duration (364*86400), t.is (d.formatCompact (), "11mo", "364*86400 -> 11mo");
|
||||
d = Duration (365*86400), t.is (d.formatCompact (), "1.0y", "365*86400 -> 1.0y");
|
||||
|
||||
t.ok (d.valid ("daily"), "valid duration daily");
|
||||
t.ok (d.valid ("day"), "valid duration day");
|
||||
t.ok (d.valid ("weekly"), "valid duration weekly");
|
||||
t.ok (d.valid ("weekdays"), "valid duration weekdays");
|
||||
t.ok (d.valid ("sennight"), "valid duration sennight");
|
||||
t.ok (d.valid ("biweekly"), "valid duration biweekly");
|
||||
t.ok (d.valid ("fortnight"), "valid duration fortnight");
|
||||
t.ok (d.valid ("monthly"), "valid duration monthly");
|
||||
t.ok (d.valid ("bimonthly"), "valid duration bimonthly");
|
||||
t.ok (d.valid ("quarterly"), "valid duration quarterly");
|
||||
t.ok (d.valid ("annual"), "valid duration annual");
|
||||
t.ok (d.valid ("yearly"), "valid duration yearly");
|
||||
t.ok (d.valid ("semiannual"), "valid duration semiannual");
|
||||
t.ok (d.valid ("biannual"), "valid duration biannual");
|
||||
t.ok (d.valid ("biyearly"), "valid duration biyearly");
|
||||
|
||||
t.ok (d.valid ("0 yrs"), "valid duration 0 yrs");
|
||||
t.ok (d.valid ("0 yr"), "valid duration 0 yr");
|
||||
t.ok (d.valid ("0y"), "valid duration 0y");
|
||||
t.ok (d.valid ("1 yrs"), "valid duration 1 yrs");
|
||||
t.ok (d.valid ("1 yr"), "valid duration 1 yr");
|
||||
t.ok (d.valid ("1y"), "valid duration 1y");
|
||||
t.ok (d.valid ("10 yrs"), "valid duration 10 yrs");
|
||||
t.ok (d.valid ("10 yr"), "valid duration 10 yr");
|
||||
t.ok (d.valid ("10y"), "valid duration 10y");
|
||||
t.ok (d.valid ("1.1 yrs"), "valid duration 1.1 yrs");
|
||||
t.ok (d.valid ("-1.1 yrs"), "valid duration -1.1 yrs");
|
||||
t.ok (d.valid ("1.1y"), "valid duration 1.1y");
|
||||
t.ok (d.valid ("-1.1y"), "valid duration -1.1y");
|
||||
|
||||
t.ok (d.valid ("0 qtrs"), "valid duration 0 qtrs");
|
||||
t.ok (d.valid ("0 qtr"), "valid duration 0 qtr");
|
||||
t.ok (d.valid ("0q"), "valid duration 0q");
|
||||
t.ok (d.valid ("1 qtrs"), "valid duration 1 qtrs");
|
||||
t.ok (d.valid ("1 qtr"), "valid duration 1 qtr");
|
||||
t.ok (d.valid ("1q"), "valid duration 1q");
|
||||
t.ok (d.valid ("10 qtrs"), "valid duration 10 qtrs");
|
||||
t.ok (d.valid ("10 qtr"), "valid duration 10 qtr");
|
||||
t.ok (d.valid ("10q"), "valid duration 10q");
|
||||
|
||||
t.ok (d.valid ("0 mnths"), "valid duration 0 mnths");
|
||||
t.ok (d.valid ("0 mnth"), "valid duration 0 mnth");
|
||||
t.ok (d.valid ("0mo"), "valid duration 0mo");
|
||||
t.ok (d.valid ("1 mnths"), "valid duration 1 mnths");
|
||||
t.ok (d.valid ("1 mnth"), "valid duration 1 mnth");
|
||||
t.ok (d.valid ("1mo"), "valid duration 1mo");
|
||||
t.ok (d.valid ("10 mnths"), "valid duration 10 mnths");
|
||||
t.ok (d.valid ("10 mnth"), "valid duration 10 mnth");
|
||||
t.ok (d.valid ("10mo"), "valid duration 10mo");
|
||||
t.ok (d.valid ("-1 mnths"), "valid duration -1 mnths");
|
||||
t.ok (d.valid ("-1 mnth"), "valid duration -1 mnth");
|
||||
t.ok (d.valid ("-1 mths"), "valid duration -1 mths");
|
||||
t.ok (d.valid ("-1 mth"), "valid duration -1 mth");
|
||||
t.ok (d.valid ("-1mo"), "valid duration -1mo");
|
||||
|
||||
t.ok (d.valid ("0 wks"), "valid duration 0 wks");
|
||||
t.ok (d.valid ("0 wk"), "valid duration 0 wk");
|
||||
t.ok (d.valid ("0w"), "valid duration 0w");
|
||||
t.ok (d.valid ("1 wks"), "valid duration 1 wks");
|
||||
t.ok (d.valid ("1 wk"), "valid duration 1 wk");
|
||||
t.ok (d.valid ("1w"), "valid duration 1w");
|
||||
t.ok (d.valid ("10 wks"), "valid duration 10 wks");
|
||||
t.ok (d.valid ("10 wk"), "valid duration 10 wk");
|
||||
t.ok (d.valid ("10w"), "valid duration 10w");
|
||||
t.ok (d.valid ("-1 wks"), "valid duration -1 wks");
|
||||
t.ok (d.valid ("-1 wk"), "valid duration -1 wk");
|
||||
t.ok (d.valid ("-1wk"), "valid duration -1wk");
|
||||
t.ok (d.valid ("-1w"), "valid duration -1w");
|
||||
|
||||
t.ok (d.valid ("0 days"), "valid duration 0 days");
|
||||
t.ok (d.valid ("0 day"), "valid duration 0 day");
|
||||
t.ok (d.valid ("0d"), "valid duration 0d");
|
||||
t.ok (d.valid ("1 days"), "valid duration 1 days");
|
||||
t.ok (d.valid ("1 day"), "valid duration 1 day");
|
||||
t.ok (d.valid ("1d"), "valid duration 1d");
|
||||
t.ok (d.valid ("10 days"), "valid duration 10 days");
|
||||
t.ok (d.valid ("10 day"), "valid duration 10 day");
|
||||
t.ok (d.valid ("10d"), "valid duration 10d");
|
||||
t.ok (d.valid ("-1 days"), "valid duration -1 days");
|
||||
t.ok (d.valid ("-1 day"), "valid duration -1 day");
|
||||
t.ok (d.valid ("-1d"), "valid duration -1d");
|
||||
|
||||
t.ok (d.valid ("0 hrs"), "valid duration 0 hrs");
|
||||
t.ok (d.valid ("0 hr"), "valid duration 0 hr");
|
||||
t.ok (d.valid ("0h"), "valid duration 0h");
|
||||
t.ok (d.valid ("1 hrs"), "valid duration 1 hrs");
|
||||
t.ok (d.valid ("1 hr"), "valid duration 1 hr");
|
||||
t.ok (d.valid ("1h"), "valid duration 1h");
|
||||
t.ok (d.valid ("10 hrs"), "valid duration 10 hrs");
|
||||
t.ok (d.valid ("10 hr"), "valid duration 10 hr");
|
||||
t.ok (d.valid ("10h"), "valid duration 10h");
|
||||
t.ok (d.valid ("-1 hrs"), "valid duration -1 hrs");
|
||||
t.ok (d.valid ("-1 hr"), "valid duration -1 hr");
|
||||
t.ok (d.valid ("-1h"), "valid duration -1h");
|
||||
|
||||
t.ok (d.valid ("0 mins"), "valid duration 0 mins");
|
||||
t.ok (d.valid ("0 min"), "valid duration 0 min");
|
||||
t.ok (d.valid ("0m"), "valid duration 0m");
|
||||
t.ok (d.valid ("1 mins"), "valid duration 1 mins");
|
||||
t.ok (d.valid ("1 min"), "valid duration 1 min");
|
||||
t.ok (d.valid ("1m"), "valid duration 1m");
|
||||
t.ok (d.valid ("10 mins"), "valid duration 10 mins");
|
||||
t.ok (d.valid ("10 min"), "valid duration 10 min");
|
||||
t.ok (d.valid ("10m"), "valid duration 10m");
|
||||
t.ok (d.valid ("-1 mins"), "valid duration -1 mins");
|
||||
t.ok (d.valid ("-1 min"), "valid duration -1 min");
|
||||
t.ok (d.valid ("-1m"), "valid duration -1m");
|
||||
|
||||
t.ok (d.valid ("0 secs"), "valid duration 0 secs");
|
||||
t.ok (d.valid ("0 sec"), "valid duration 0 sec");
|
||||
t.ok (d.valid ("0s"), "valid duration 0s");
|
||||
t.ok (d.valid ("1 secs"), "valid duration 1 secs");
|
||||
t.ok (d.valid ("1 sec"), "valid duration 1 sec");
|
||||
t.ok (d.valid ("1s"), "valid duration 1s");
|
||||
t.ok (d.valid ("10 secs"), "valid duration 10 secs");
|
||||
t.ok (d.valid ("10 sec"), "valid duration 10 sec");
|
||||
t.ok (d.valid ("10s"), "valid duration 10s");
|
||||
t.ok (d.valid ("-1 secs"), "valid duration -1 secs");
|
||||
t.ok (d.valid ("-1 sec"), "valid duration -1 sec");
|
||||
t.ok (d.valid ("-1s"), "valid duration -1s");
|
||||
|
||||
t.notok (d.valid ("woof"), "valid duration woof = fail");
|
||||
|
||||
t.is (convertDuration ("daily"), 1, "valid duration daily");
|
||||
t.is (convertDuration ("day"), 1, "valid duration day");
|
||||
t.is (convertDuration ("weekly"), 7, "valid duration weekly");
|
||||
t.is (convertDuration ("weekdays"), 1, "valid duration weekdays");
|
||||
t.is (convertDuration ("sennight"), 7, "valid duration sennight");
|
||||
t.is (convertDuration ("biweekly"), 14, "valid duration biweekly");
|
||||
t.is (convertDuration ("fortnight"), 14, "valid duration fortnight");
|
||||
t.is (convertDuration ("monthly"), 30, "valid duration monthly");
|
||||
t.is (convertDuration ("bimonthly"), 61, "valid duration bimonthly");
|
||||
t.is (convertDuration ("quarterly"), 91, "valid duration quarterly");
|
||||
t.is (convertDuration ("annual"), 365, "valid duration annual");
|
||||
t.is (convertDuration ("yearly"), 365, "valid duration yearly");
|
||||
t.is (convertDuration ("semiannual"), 183, "valid duration semiannual");
|
||||
t.is (convertDuration ("biannual"), 730, "valid duration biannual");
|
||||
t.is (convertDuration ("biyearly"), 730, "valid duration biyearly");
|
||||
|
||||
t.is (convertDuration ("0 yrs"), 0, "valid duration 0 yrs");
|
||||
t.is (convertDuration ("0 yr"), 0, "valid duration 0 yr");
|
||||
t.is (convertDuration ("0y"), 0, "valid duration 0y");
|
||||
t.is (convertDuration ("1 yrs"), 365, "valid duration 1 yrs");
|
||||
t.is (convertDuration ("1 yr"), 365, "valid duration 1 yr");
|
||||
t.is (convertDuration ("1y"), 365, "valid duration 1y");
|
||||
t.is (convertDuration ("10 yrs"), 3650, "valid duration 10 yrs");
|
||||
t.is (convertDuration ("10 yr"), 3650, "valid duration 10 yr");
|
||||
t.is (convertDuration ("10y"), 3650, "valid duration 10y");
|
||||
|
||||
t.is (convertDuration ("0 qtrs"), 0, "valid duration 0 qtrs");
|
||||
t.is (convertDuration ("0 qtr"), 0, "valid duration 0 qtr");
|
||||
t.is (convertDuration ("0q"), 0, "valid duration 0q");
|
||||
t.is (convertDuration ("1 qtrs"), 91, "valid duration 1 qtrs");
|
||||
t.is (convertDuration ("1 qtr"), 91, "valid duration 1 qtr");
|
||||
t.is (convertDuration ("1q"), 91, "valid duration 1q");
|
||||
t.is (convertDuration ("10 qtrs"), 910, "valid duration 10 qtrs");
|
||||
t.is (convertDuration ("10 qtr"), 910, "valid duration 10 qtr");
|
||||
t.is (convertDuration ("10q"), 910, "valid duration 10q");
|
||||
|
||||
t.is (convertDuration ("0 mths"), 0, "valid duration 0 mths");
|
||||
t.is (convertDuration ("0 mth"), 0, "valid duration 0 mth");
|
||||
t.is (convertDuration ("0mo"), 0, "valid duration 0mo");
|
||||
t.is (convertDuration ("1 mths"), 30, "valid duration 1 mths");
|
||||
t.is (convertDuration ("1 mth"), 30, "valid duration 1 mth");
|
||||
t.is (convertDuration ("1mo"), 30, "valid duration 1mo");
|
||||
t.is (convertDuration ("10 mths"), 300, "valid duration 10 mths");
|
||||
t.is (convertDuration ("10 mth"), 300, "valid duration 10 mth");
|
||||
t.is (convertDuration ("10mo"), 300, "valid duration 10mo");
|
||||
|
||||
t.is (convertDuration ("0 wks"), 0, "valid duration 0 wks");
|
||||
t.is (convertDuration ("0 wk"), 0, "valid duration 0 wk");
|
||||
t.is (convertDuration ("0w"), 0, "valid duration 0w");
|
||||
t.is (convertDuration ("1 wks"), 7, "valid duration 1 wks");
|
||||
t.is (convertDuration ("1 wk"), 7, "valid duration 1 wk");
|
||||
t.is (convertDuration ("1w"), 7, "valid duration 1w");
|
||||
t.is (convertDuration ("10 wks"), 70, "valid duration 10 wks");
|
||||
t.is (convertDuration ("10 wk"), 70, "valid duration 10 wk");
|
||||
t.is (convertDuration ("10w"), 70, "valid duration 10w");
|
||||
|
||||
t.is (convertDuration ("0 days"), 0, "valid duration 0 days");
|
||||
t.is (convertDuration ("0 day"), 0, "valid duration 0 day");
|
||||
t.is (convertDuration ("0d"), 0, "valid duration 0d");
|
||||
t.is (convertDuration ("1 days"), 1, "valid duration 1 days");
|
||||
t.is (convertDuration ("1 day"), 1, "valid duration 1 day");
|
||||
t.is (convertDuration ("1d"), 1, "valid duration 1d");
|
||||
t.is (convertDuration ("10 days"), 10, "valid duration 10 days");
|
||||
t.is (convertDuration ("10 day"), 10, "valid duration 10 day");
|
||||
t.is (convertDuration ("10d"), 10, "valid duration 10d");
|
||||
|
||||
try
|
||||
{
|
||||
Duration left, right;
|
||||
|
||||
// operator<
|
||||
left = Duration ("1sec"); right = Duration ("2secs"); t.ok (left < right, "duration 1sec < 2secs");
|
||||
left = Duration ("-2secs"); right = Duration ("-1sec"); t.ok (left < right, "duration -2secs < -1sec");
|
||||
left = Duration ("1sec"); right = Duration ("1min"); t.ok (left < right, "duration 1sec < 1min");
|
||||
left = Duration ("1min"); right = Duration ("1hr"); t.ok (left < right, "duration 1min < 1hr");
|
||||
left = Duration ("1hr"); right = Duration ("1d"); t.ok (left < right, "duration 1hr < 1d");
|
||||
left = Duration ("1d"); right = Duration ("1w"); t.ok (left < right, "duration 1d < 1w");
|
||||
left = Duration ("1w"); right = Duration ("1mo"); t.ok (left < right, "duration 1w < 1mo");
|
||||
left = Duration ("1mo"); right = Duration ("1q"); t.ok (left < right, "duration 1mo < 1q");
|
||||
left = Duration ("1q"); right = Duration ("1y"); t.ok (left < right, "duration 1q < 1y");
|
||||
|
||||
left = Duration ("-3s"); right = Duration ("-6s"); t.ok (right < left, "duration -6s < -3s");
|
||||
|
||||
// operator>
|
||||
left = Duration ("2secs"); right = Duration ("1sec"); t.ok (left > right, "2sec > 1secs");
|
||||
left = Duration ("-1sec"); right = Duration ("-2secs"); t.ok (left > right, "-1secs > -2sec");
|
||||
left = Duration ("1min"); right = Duration ("1sec"); t.ok (left > right, "1min > 1sec");
|
||||
left = Duration ("1hr"); right = Duration ("1min"); t.ok (left > right, "1hr > 1min");
|
||||
left = Duration ("1d"); right = Duration ("1hr"); t.ok (left > right, "1d > 1hr");
|
||||
left = Duration ("1w"); right = Duration ("1d"); t.ok (left > right, "1w > 1d");
|
||||
left = Duration ("1mo"); right = Duration ("1w"); t.ok (left > right, "1mo > 1w");
|
||||
left = Duration ("1q"); right = Duration ("1mo"); t.ok (left > right, "1q > 1mo");
|
||||
left = Duration ("1y"); right = Duration ("1q"); t.ok (left > right, "1y > 1q");
|
||||
|
||||
left = Duration ("-3s"); right = Duration ("-6s"); t.ok (left > right, "duration -3s > -6s");
|
||||
}
|
||||
|
||||
catch (const std::string& e) { t.diag (e); }
|
||||
catch (...) { t.diag ("Unknown error"); }
|
||||
|
||||
// Duration::negative
|
||||
t.ok ( Duration ("-1day").negative (), "-1day is negative");
|
||||
t.ok (! Duration ("1day").negative (), "1day is not negative");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
70
test/enpassant.t
Executable file
70
test/enpassant.t
Executable file
|
@ -0,0 +1,70 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 13;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'enp.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'enp.rc', 'Created enp.rc');
|
||||
}
|
||||
|
||||
# Test the en passant feature.
|
||||
qx{../task rc:enp.rc add foo};
|
||||
qx{../task rc:enp.rc add foo bar};
|
||||
qx{../task rc:enp.rc do 1,2 /foo/FOO/ pri:H +tag};
|
||||
my $output = qx{../task rc:enp.rc info 1};
|
||||
like ($output, qr/Status\s+Completed/, 'en passant 1 status change');
|
||||
like ($output, qr/Description\s+FOO/, 'en passant 1 description change');
|
||||
like ($output, qr/Priority\s+H/, 'en passant 1 description change');
|
||||
like ($output, qr/Tags\s+tag/, 'en passant 1 description change');
|
||||
$output = qx{../task rc:enp.rc info 2};
|
||||
like ($output, qr/Status\s+Completed/, 'en passant 2 status change');
|
||||
like ($output, qr/Description\s+FOO bar/, 'en passant 2 description change');
|
||||
like ($output, qr/Priority\s+H/, 'en passant 2 description change');
|
||||
like ($output, qr/Tags\s+tag/, 'en passant 2 description change');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'enp.rc';
|
||||
ok (!-r 'enp.rc', 'Removed enp.rc');
|
||||
|
||||
exit 0;
|
||||
|
83
test/export.csv.t
Executable file
83
test/export.csv.t
Executable file
|
@ -0,0 +1,83 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 9;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'export.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'export.rc', 'Created export.rc');
|
||||
}
|
||||
|
||||
# Add two tasks, export, examine result.
|
||||
qx{../task rc:export.rc add priority:H project:A one};
|
||||
qx{../task rc:export.rc add +tag1 +tag2 two};
|
||||
qx{../task rc:export.rc export.csv > ./export.txt};
|
||||
|
||||
my @lines;
|
||||
if (open my $fh, '<', './export.txt')
|
||||
{
|
||||
while (my $line = <$fh>)
|
||||
{
|
||||
next unless $line =~ /^['0-9]/;
|
||||
push @lines, $line;
|
||||
}
|
||||
|
||||
close $fh;
|
||||
}
|
||||
|
||||
my $line1 = qr/'uuid','status','tags','entry','start','due','recur','end','project','priority','fg','bg','description'\n/;
|
||||
my $line2 = qr/'.{8}-.{4}-.{4}-.{4}-.{12}','pending','',\d+,,,,,'A','H',,,'one'\n/;
|
||||
my $line3 = qr/'.{8}-.{4}-.{4}-.{4}-.{12}','pending','tag1 tag2',\d+,,,,,,,,,'two'\n/;
|
||||
|
||||
like ($lines[0], $line1, "export line one");
|
||||
like ($lines[1], $line2, "export line two");
|
||||
like ($lines[2], $line3, "export line three");
|
||||
|
||||
# Cleanup.
|
||||
unlink 'export.txt';
|
||||
ok (!-r 'export.txt', 'Removed export.txt');
|
||||
|
||||
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');
|
||||
|
||||
unlink 'export.rc';
|
||||
ok (!-r 'export.rc', 'Removed export.rc');
|
||||
|
||||
exit 0;
|
||||
|
87
test/export.yaml.t
Executable file
87
test/export.yaml.t
Executable file
|
@ -0,0 +1,87 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 22;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'export.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'export.rc', 'Created export.rc');
|
||||
}
|
||||
|
||||
# Add two tasks, export, examine result.
|
||||
qx{../task rc:export.rc add priority:H project:A one};
|
||||
qx{../task rc:export.rc add +tag1 +tag2 two};
|
||||
qx{../task rc:export.rc export.yaml > ./export.txt};
|
||||
|
||||
my @lines;
|
||||
if (open my $fh, '<', './export.txt')
|
||||
{
|
||||
@lines = <$fh>;
|
||||
close $fh;
|
||||
}
|
||||
|
||||
like ($lines[0], qr/^\%YAML 1\.1$/, 'export.yaml line 1');
|
||||
like ($lines[1], qr/^---$/, 'export.yaml line 2');
|
||||
like ($lines[2], qr/^ task:$/, 'export.yaml line 3');
|
||||
like ($lines[3], qr/^ description: one$/, 'export.yaml line 4');
|
||||
like ($lines[4], qr/^ entry: \d+$/, 'export.yaml line 5');
|
||||
like ($lines[5], qr/^ priority: H$/, 'export.yaml line 6');
|
||||
like ($lines[6], qr/^ project: A$/, 'export.yaml line 7');
|
||||
like ($lines[7], qr/^ status: pending$/, 'export.yaml line 8');
|
||||
like ($lines[8], qr/^ uuid: .+$/, 'export.yaml line 9');
|
||||
like ($lines[9], qr/^ task:$/, 'export.yaml line 10');
|
||||
like ($lines[10], qr/^ description: two$/, 'export.yaml line 11');
|
||||
like ($lines[11], qr/^ entry: \d+$/, 'export.yaml line 12');
|
||||
like ($lines[12], qr/^ status: pending$/, 'export.yaml line 13');
|
||||
like ($lines[13], qr/^ tags: tag1,tag2$/, 'export.yaml line 14');
|
||||
like ($lines[14], qr/^ uuid: .+$/, 'export.yaml line 15');
|
||||
like ($lines[15], qr/^\.\.\.$/, 'export.yaml line 16');
|
||||
|
||||
# Cleanup.
|
||||
unlink 'export.txt';
|
||||
ok (!-r 'export.txt', 'Removed export.txt');
|
||||
|
||||
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');
|
||||
|
||||
unlink 'export.rc';
|
||||
ok (!-r 'export.rc', 'Removed export.rc');
|
||||
|
||||
exit 0;
|
||||
|
62
test/feature.exit.t
Executable file
62
test/feature.exit.t
Executable file
|
@ -0,0 +1,62 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'exit.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"confirmation=no\n";
|
||||
close $fh;
|
||||
ok (-r 'exit.rc', 'Created exit.rc');
|
||||
}
|
||||
|
||||
qx{../task rc:exit.rc add foo};
|
||||
my $exit_good = system ('../task rc:exit.rc ls foo 2>&1 >>/dev/null');
|
||||
is ($exit_good, 0, 'task returns 0 on success');
|
||||
my $exit_bad = system ('../task rc:exit.rc ls bar 2>&1 >>/dev/null');
|
||||
isnt ($exit_bad, 0, 'task returns non-zero on failure');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'exit.rc';
|
||||
ok (!-r 'exit.rc', 'Removed exit.rc');
|
||||
|
||||
exit 0;
|
||||
|
53
test/file.t.cpp
Normal file
53
test/file.t.cpp
Normal file
|
@ -0,0 +1,53 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006 - 2009, Paul Beckingham, Federico Hernandez.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free Software
|
||||
// Foundation; either version 2 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program; if not, write to the
|
||||
//
|
||||
// Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor,
|
||||
// Boston, MA
|
||||
// 02110-1301
|
||||
// USA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <Context.h>
|
||||
#include <File.h>
|
||||
#include <test.h>
|
||||
|
||||
Context context;
|
||||
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest t (6);
|
||||
|
||||
File::write ("/tmp/file.t.txt", "This is a test\n");
|
||||
File f6 ("/tmp/file.t.txt");
|
||||
t.ok (f6.size () == 15, "File::size /tmp/file.t.txt good");
|
||||
t.ok (f6.mode () & S_IRUSR, "File::mode /tmp/file.t.txt good");
|
||||
t.ok (File::remove ("/tmp/file.t.txt"), "File::remove /tmp/file.t.txt good");
|
||||
|
||||
// operator (std::string) const;
|
||||
t.is ((std::string) f6, "/tmp/file.t.txt", "File::operator (std::string) const");
|
||||
|
||||
t.ok (File::create ("/tmp/file.t.create"), "File::create /tmp/file.t.create good");
|
||||
t.ok (File::remove ("/tmp/file.t.create"), "File::remove /tmp/file.t.create good");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
168
test/filt.t.cpp
Normal file
168
test/filt.t.cpp
Normal file
|
@ -0,0 +1,168 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free Software
|
||||
// Foundation; either version 2 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program; if not, write to the
|
||||
//
|
||||
// Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor,
|
||||
// Boston, MA
|
||||
// 02110-1301
|
||||
// USA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#include "main.h"
|
||||
#include "test.h"
|
||||
#include "Filter.h"
|
||||
#include "Task.h"
|
||||
|
||||
Context context;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest test (20);
|
||||
|
||||
// Create a filter consisting of two Att criteria.
|
||||
Filter f;
|
||||
f.push_back (Att ("name1", "value1"));
|
||||
f.push_back (Att ("name2", "value2"));
|
||||
test.is (f.size (), (size_t)2, "Filter created");
|
||||
|
||||
// Create a Task to match against.
|
||||
Task yes;
|
||||
yes.set ("name1", "value1");
|
||||
yes.set ("name2", "value2");
|
||||
test.ok (f.pass (yes), "full match");
|
||||
|
||||
yes.set ("name3", "value3");
|
||||
test.ok (f.pass (yes), "over match");
|
||||
|
||||
// Negative tests.
|
||||
Task no0;
|
||||
test.notok (f.pass (no0), "no match against default Task");
|
||||
|
||||
Task no1;
|
||||
no1.set ("name3", "value3");
|
||||
test.notok (f.pass (no1), "no match against mismatch Task");
|
||||
|
||||
Task partial;
|
||||
partial.set ("name1", "value1");
|
||||
test.notok (f.pass (partial), "no match against partial Task");
|
||||
|
||||
// Modifiers.
|
||||
Task mods;
|
||||
mods.set ("name", "value");
|
||||
mods.set ("description", "hello, world.");
|
||||
|
||||
Att a ("name", "is", "value");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.ok (f.pass (mods), "name:value -> name.is:value = match");
|
||||
// TODO test inverse.
|
||||
|
||||
a = Att ("name", "isnt", "value");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.notok (f.pass (mods), "name:value -> name.isnt:value = no match");
|
||||
// TODO test inverse.
|
||||
|
||||
a = Att ("name", "startswith", "val");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.ok (f.pass (mods), "name:value -> name.startswith:val = match");
|
||||
// TODO test inverse.
|
||||
|
||||
a = Att ("name", "endswith", "lue");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.ok (f.pass (mods), "name:value -> name.endswith:lue = match");
|
||||
// TODO test inverse.
|
||||
|
||||
a = Att ("name", "has", "alu");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.ok (f.pass (mods), "name:value -> name.has:alu = match");
|
||||
// TODO test inverse.
|
||||
|
||||
a = Att ("name", "hasnt", "alu");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.notok (f.pass (mods), "name:value -> name.hasnt:alu = no match");
|
||||
// TODO test inverse.
|
||||
|
||||
a = Att ("name", "any", "");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.ok (f.pass (mods), "name:value -> name.any: = match");
|
||||
// TODO test inverse.
|
||||
|
||||
a = Att ("name", "none", "");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.notok (f.pass (mods), "name:value -> name.none: = no match");
|
||||
// TODO test inverse.
|
||||
|
||||
/*
|
||||
"before"
|
||||
"after"
|
||||
"under"
|
||||
"over"
|
||||
"above"
|
||||
"below"
|
||||
*/
|
||||
|
||||
a = Att ("description", "word", "hello");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.ok (f.pass (mods), "description:hello, world. -> description.word:hello = match");
|
||||
// TODO test inverse.
|
||||
|
||||
a = Att ("description", "word", "world");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.ok (f.pass (mods), "description:hello, world. -> description.word:world = match");
|
||||
// TODO test inverse.
|
||||
|
||||
a = Att ("description", "word", "pig");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.notok (f.pass (mods), "description:hello, world. -> description.word:pig = no match");
|
||||
// TODO test inverse.
|
||||
|
||||
a = Att ("description", "noword", "hello");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.notok (f.pass (mods), "description:hello, world. -> description.noword:hello = no match");
|
||||
// TODO test inverse.
|
||||
|
||||
a = Att ("description", "noword", "world");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.notok (f.pass (mods), "description:hello, world. -> description.noword:world = no match");
|
||||
// TODO test inverse.
|
||||
|
||||
a = Att ("description", "noword", "pig");
|
||||
f.clear ();
|
||||
f.push_back (a);
|
||||
test.ok (f.pass (mods), "description:hello, world. -> description.noword:pig = match");
|
||||
// TODO test inverse.
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
290
test/filter.t
Executable file
290
test/filter.t
Executable file
|
@ -0,0 +1,290 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 180;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'filter.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'filter.rc', 'Created filter.rc');
|
||||
}
|
||||
|
||||
# Test the filters.
|
||||
qx{../task rc:filter.rc add project:A priority:H +tag one foo};
|
||||
qx{../task rc:filter.rc add project:A priority:H two};
|
||||
qx{../task rc:filter.rc add project:A three};
|
||||
qx{../task rc:filter.rc add priority:H four};
|
||||
qx{../task rc:filter.rc add +tag five};
|
||||
qx{../task rc:filter.rc add six foo};
|
||||
qx{../task rc:filter.rc add priority:L seven bar foo};
|
||||
|
||||
my $output = qx{../task rc:filter.rc list};
|
||||
like ($output, qr/one/, 'a1');
|
||||
like ($output, qr/two/, 'a2');
|
||||
like ($output, qr/three/, 'a3');
|
||||
like ($output, qr/four/, 'a4');
|
||||
like ($output, qr/five/, 'a5');
|
||||
like ($output, qr/six/, 'a6');
|
||||
like ($output, qr/seven/, 'a7');
|
||||
|
||||
$output = qx{../task rc:filter.rc list project:A};
|
||||
like ($output, qr/one/, 'b1');
|
||||
like ($output, qr/two/, 'b2');
|
||||
like ($output, qr/three/, 'b3');
|
||||
unlike ($output, qr/four/, 'b4');
|
||||
unlike ($output, qr/five/, 'b5');
|
||||
unlike ($output, qr/six/, 'b6');
|
||||
unlike ($output, qr/seven/, 'b7');
|
||||
|
||||
$output = qx{../task rc:filter.rc list priority:H};
|
||||
like ($output, qr/one/, 'c1');
|
||||
like ($output, qr/two/, 'c2');
|
||||
unlike ($output, qr/three/, 'c3');
|
||||
like ($output, qr/four/, 'c4');
|
||||
unlike ($output, qr/five/, 'c5');
|
||||
unlike ($output, qr/six/, 'c6');
|
||||
unlike ($output, qr/seven/, 'c7');
|
||||
|
||||
$output = qx{../task rc:filter.rc list priority:};
|
||||
unlike ($output, qr/one/, 'd1');
|
||||
unlike ($output, qr/two/, 'd2');
|
||||
like ($output, qr/three/, 'd3');
|
||||
unlike ($output, qr/four/, 'd4');
|
||||
like ($output, qr/five/, 'd5');
|
||||
like ($output, qr/six/, 'd6');
|
||||
unlike ($output, qr/seven/, 'd7');
|
||||
|
||||
$output = qx{../task rc:filter.rc list foo};
|
||||
like ($output, qr/one/, 'e1');
|
||||
unlike ($output, qr/two/, 'e2');
|
||||
unlike ($output, qr/three/, 'e3');
|
||||
unlike ($output, qr/four/, 'e4');
|
||||
unlike ($output, qr/five/, 'e5');
|
||||
like ($output, qr/six/, 'e6');
|
||||
like ($output, qr/seven/, 'e7');
|
||||
|
||||
$output = qx{../task rc:filter.rc list foo bar};
|
||||
unlike ($output, qr/one/, 'f1');
|
||||
unlike ($output, qr/two/, 'f2');
|
||||
unlike ($output, qr/three/, 'f3');
|
||||
unlike ($output, qr/four/, 'f4');
|
||||
unlike ($output, qr/five/, 'f5');
|
||||
unlike ($output, qr/six/, 'f6');
|
||||
like ($output, qr/seven/, 'f7');
|
||||
|
||||
$output = qx{../task rc:filter.rc list +tag};
|
||||
like ($output, qr/one/, 'g1');
|
||||
unlike ($output, qr/two/, 'g2');
|
||||
unlike ($output, qr/three/, 'g3');
|
||||
unlike ($output, qr/four/, 'g4');
|
||||
like ($output, qr/five/, 'g5');
|
||||
unlike ($output, qr/six/, 'g6');
|
||||
unlike ($output, qr/seven/, 'g7');
|
||||
|
||||
$output = qx{../task rc:filter.rc list -tag};
|
||||
unlike ($output, qr/one/, 'h1');
|
||||
like ($output, qr/two/, 'h2');
|
||||
like ($output, qr/three/, 'h3');
|
||||
like ($output, qr/four/, 'h4');
|
||||
unlike ($output, qr/five/, 'h5');
|
||||
like ($output, qr/six/, 'h6');
|
||||
like ($output, qr/seven/, 'h7');
|
||||
|
||||
$output = qx{../task rc:filter.rc list -missing};
|
||||
like ($output, qr/one/, 'i1');
|
||||
like ($output, qr/two/, 'i2');
|
||||
like ($output, qr/three/, 'i3');
|
||||
like ($output, qr/four/, 'i4');
|
||||
like ($output, qr/five/, 'i5');
|
||||
like ($output, qr/six/, 'i6');
|
||||
like ($output, qr/seven/, 'i7');
|
||||
|
||||
$output = qx{../task rc:filter.rc list +tag -tag};
|
||||
unlike ($output, qr/one/, 'j1');
|
||||
unlike ($output, qr/two/, 'j2');
|
||||
unlike ($output, qr/three/, 'j3');
|
||||
unlike ($output, qr/four/, 'j4');
|
||||
unlike ($output, qr/five/, 'j5');
|
||||
unlike ($output, qr/six/, 'j6');
|
||||
unlike ($output, qr/seven/, 'j7');
|
||||
|
||||
$output = qx{../task rc:filter.rc list project:A priority:H};
|
||||
like ($output, qr/one/, 'k1');
|
||||
like ($output, qr/two/, 'k2');
|
||||
unlike ($output, qr/three/, 'k3');
|
||||
unlike ($output, qr/four/, 'k4');
|
||||
unlike ($output, qr/five/, 'k5');
|
||||
unlike ($output, qr/six/, 'k6');
|
||||
unlike ($output, qr/seven/, 'k7');
|
||||
|
||||
$output = qx{../task rc:filter.rc list project:A priority:};
|
||||
unlike ($output, qr/one/, 'l1');
|
||||
unlike ($output, qr/two/, 'l2');
|
||||
like ($output, qr/three/, 'l3');
|
||||
unlike ($output, qr/four/, 'l4');
|
||||
unlike ($output, qr/five/, 'l5');
|
||||
unlike ($output, qr/six/, 'l6');
|
||||
unlike ($output, qr/seven/, 'l7');
|
||||
|
||||
$output = qx{../task rc:filter.rc list project:A foo};
|
||||
like ($output, qr/one/, 'm1');
|
||||
unlike ($output, qr/two/, 'm2');
|
||||
unlike ($output, qr/three/, 'm3');
|
||||
unlike ($output, qr/four/, 'm4');
|
||||
unlike ($output, qr/five/, 'm5');
|
||||
unlike ($output, qr/six/, 'm6');
|
||||
unlike ($output, qr/seven/, 'm7');
|
||||
|
||||
$output = qx{../task rc:filter.rc list project:A +tag};
|
||||
like ($output, qr/one/, 'n1');
|
||||
unlike ($output, qr/two/, 'n2');
|
||||
unlike ($output, qr/three/, 'n3');
|
||||
unlike ($output, qr/four/, 'n4');
|
||||
unlike ($output, qr/five/, 'n5');
|
||||
unlike ($output, qr/six/, 'n6');
|
||||
unlike ($output, qr/seven/, 'n7');
|
||||
|
||||
$output = qx{../task rc:filter.rc list project:A priority:H foo};
|
||||
like ($output, qr/one/, 'o1');
|
||||
unlike ($output, qr/two/, 'o2');
|
||||
unlike ($output, qr/three/, 'o3');
|
||||
unlike ($output, qr/four/, 'o4');
|
||||
unlike ($output, qr/five/, 'o5');
|
||||
unlike ($output, qr/six/, 'o6');
|
||||
unlike ($output, qr/seven/, 'o7');
|
||||
|
||||
$output = qx{../task rc:filter.rc list project:A priority:H +tag};
|
||||
like ($output, qr/one/, 'p1');
|
||||
unlike ($output, qr/two/, 'p2');
|
||||
unlike ($output, qr/three/, 'p3');
|
||||
unlike ($output, qr/four/, 'p4');
|
||||
unlike ($output, qr/five/, 'p5');
|
||||
unlike ($output, qr/six/, 'p6');
|
||||
unlike ($output, qr/seven/, 'p7');
|
||||
|
||||
$output = qx{../task rc:filter.rc list project:A priority:H foo +tag};
|
||||
like ($output, qr/one/, 'q1');
|
||||
unlike ($output, qr/two/, 'q2');
|
||||
unlike ($output, qr/three/, 'q3');
|
||||
unlike ($output, qr/four/, 'q4');
|
||||
unlike ($output, qr/five/, 'q5');
|
||||
unlike ($output, qr/six/, 'q6');
|
||||
unlike ($output, qr/seven/, 'q7');
|
||||
|
||||
$output = qx{../task rc:filter.rc list project:A priority:H foo +tag baz};
|
||||
unlike ($output, qr/one/, 'r1');
|
||||
unlike ($output, qr/two/, 'r2');
|
||||
unlike ($output, qr/three/, 'r3');
|
||||
unlike ($output, qr/four/, 'r4');
|
||||
unlike ($output, qr/five/, 'r5');
|
||||
unlike ($output, qr/six/, 'r6');
|
||||
unlike ($output, qr/seven/, 'r7');
|
||||
|
||||
# Regex filters.
|
||||
$output = qx{../task rc:filter.rc list rc.regex:on project:[A-Z]};
|
||||
like ($output, qr/one/, 's1');
|
||||
like ($output, qr/two/, 's2');
|
||||
like ($output, qr/three/, 's3');
|
||||
unlike ($output, qr/four/, 's4');
|
||||
unlike ($output, qr/five/, 's5');
|
||||
unlike ($output, qr/six/, 's6');
|
||||
unlike ($output, qr/seven/, 's7');
|
||||
|
||||
$output = qx{../task rc:filter.rc list rc.regex:on project:.};
|
||||
like ($output, qr/one/, 't1');
|
||||
like ($output, qr/two/, 't2');
|
||||
like ($output, qr/three/, 't3');
|
||||
unlike ($output, qr/four/, 't4');
|
||||
unlike ($output, qr/five/, 't5');
|
||||
unlike ($output, qr/six/, 't6');
|
||||
unlike ($output, qr/seven/, 't7');
|
||||
|
||||
$output = qx{../task rc:filter.rc rc.regex:on list fo\{2\}};
|
||||
like ($output, qr/one/, 'u1');
|
||||
unlike ($output, qr/two/, 'u2');
|
||||
unlike ($output, qr/three/, 'u3');
|
||||
unlike ($output, qr/four/, 'u4');
|
||||
unlike ($output, qr/five/, 'u5');
|
||||
like ($output, qr/six/, 'u6');
|
||||
like ($output, qr/seven/, 'u7');
|
||||
|
||||
$output = qx{../task rc:filter.rc rc.regex:on list f.. b..};
|
||||
unlike ($output, qr/one/, 'v1');
|
||||
unlike ($output, qr/two/, 'v2');
|
||||
unlike ($output, qr/three/, 'v3');
|
||||
unlike ($output, qr/four/, 'v4');
|
||||
unlike ($output, qr/five/, 'v5');
|
||||
unlike ($output, qr/six/, 'v6');
|
||||
like ($output, qr/seven/, 'v7');
|
||||
|
||||
$output = qx{../task rc:filter.rc rc.regex:on list ^s};
|
||||
unlike ($output, qr/one/, 'w1');
|
||||
unlike ($output, qr/two/, 'w2');
|
||||
unlike ($output, qr/three/, 'w3');
|
||||
unlike ($output, qr/four/, 'w4');
|
||||
unlike ($output, qr/five/, 'w5');
|
||||
like ($output, qr/six/, 'w6');
|
||||
like ($output, qr/seven/, 'w7');
|
||||
|
||||
$output = qx{../task rc:filter.rc rc.regex:on list ^.i};
|
||||
unlike ($output, qr/one/, 'x1');
|
||||
unlike ($output, qr/two/, 'x2');
|
||||
unlike ($output, qr/three/, 'x3');
|
||||
unlike ($output, qr/four/, 'x4');
|
||||
like ($output, qr/five/, 'x5');
|
||||
like ($output, qr/six/, 'x6');
|
||||
unlike ($output, qr/seven/, 'x7');
|
||||
|
||||
$output = qx{../task rc:filter.rc rc.regex:on list "two|five"};
|
||||
unlike ($output, qr/one/, 'y1');
|
||||
like ($output, qr/two/, 'y2');
|
||||
unlike ($output, qr/three/, 'y3');
|
||||
unlike ($output, qr/four/, 'y4');
|
||||
like ($output, qr/five/, 'y5');
|
||||
unlike ($output, qr/six/, 'y6');
|
||||
unlike ($output, qr/seven/, 'y7');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'filter.rc';
|
||||
ok (!-r 'filter.rc', 'Removed filter.rc');
|
||||
|
||||
exit 0;
|
||||
|
89
test/fontunderline.t
Executable file
89
test/fontunderline.t
Executable file
|
@ -0,0 +1,89 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 13;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'font.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'font.rc', 'Created font.rc');
|
||||
}
|
||||
|
||||
# Test the fontunderline config variable. The following truth table defines
|
||||
# the different results which are to be tested.
|
||||
#
|
||||
# color _forcecolor fontunderline result
|
||||
# ----- ----------- ------------- ---------
|
||||
# 0 0 0 dashes
|
||||
# 0 0 1 dashes
|
||||
# 0 1 0 dashes
|
||||
# 0 1 1 underline
|
||||
# 1* 0 0 dashes
|
||||
# 1* 0 1 dashes
|
||||
# 1* 1 0 dashes
|
||||
# 1* 1 1 underline
|
||||
#
|
||||
# * When isatty (fileno (stdout)) is false, color is automatically disabled.
|
||||
|
||||
qx{../task rc:font.rc add foo};
|
||||
my $output = qx{../task 1 info rc:font.rc rc.color:off rc._forcecolor:off rc.fontunderline:off};
|
||||
like ($output, qr/--------/, '0,0,0 -> dashes');
|
||||
$output = qx{../task 1 info rc:font.rc rc.color:off rc._forcecolor:off rc.fontunderline:on};
|
||||
like ($output, qr/--------/, '0,0,1 -> dashes');
|
||||
$output = qx{../task 1 info rc:font.rc rc.color:off rc._forcecolor:on rc.fontunderline:off};
|
||||
like ($output, qr/--------/, '0,1,0 -> dashes');
|
||||
$output = qx{../task 1 info rc:font.rc rc.color:off rc._forcecolor:on rc.fontunderline:on};
|
||||
unlike ($output, qr/--------/, '0,1,1 -> underline');
|
||||
$output = qx{../task 1 info rc:font.rc rc.color:on rc._forcecolor:off rc.fontunderline:off};
|
||||
like ($output, qr/--------/, '1,0,0 -> dashes');
|
||||
$output = qx{../task 1 info rc:font.rc rc.color:on rc._forcecolor:off rc.fontunderline:on};
|
||||
like ($output, qr/--------/, '1,0,1 -> dashes');
|
||||
$output = qx{../task 1 info rc:font.rc rc.color:on rc._forcecolor:on rc.fontunderline:off};
|
||||
like ($output, qr/--------/, '1,1,0 -> dashes');
|
||||
$output = qx{../task 1 info rc:font.rc rc.color:on rc._forcecolor:on rc.fontunderline:on};
|
||||
unlike ($output, qr/--------/, '1,1,1 -> underline');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'font.rc';
|
||||
ok (!-r 'font.rc', 'Removed font.rc');
|
||||
|
||||
exit 0;
|
||||
|
69
test/grid.t.cpp
Normal file
69
test/grid.t.cpp
Normal file
|
@ -0,0 +1,69 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// taskwarrior - a command line task list manager.
|
||||
//
|
||||
// Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
// All rights reserved.
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or modify it under
|
||||
// the terms of the GNU General Public License as published by the Free Software
|
||||
// Foundation; either version 2 of the License, or (at your option) any later
|
||||
// version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License along with
|
||||
// this program; if not, write to the
|
||||
//
|
||||
// Free Software Foundation, Inc.,
|
||||
// 51 Franklin Street, Fifth Floor,
|
||||
// Boston, MA
|
||||
// 02110-1301
|
||||
// USA
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <Context.h>
|
||||
#include <Grid.h>
|
||||
#include <test.h>
|
||||
|
||||
Context context;
|
||||
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
UnitTest ut (30);
|
||||
|
||||
Grid g;
|
||||
ut.is ((int) g.width (), 0, "Zero width for uninitialized grid");
|
||||
ut.is ((int) g.height (), 0, "Zero height for uninitialized grid");
|
||||
|
||||
g.add (2, 2, false);
|
||||
ut.is ((int) g.width (), 3, "Width of 3 columns");
|
||||
ut.is ((int) g.height (), 3, "Height of 3 rows");
|
||||
|
||||
Grid g2;
|
||||
g2.add (0, 1, "value");
|
||||
g2.add (1, 0, "value");
|
||||
ut.is ((int) g2.width (), 2, "Width of 2 columns");
|
||||
ut.is ((int) g2.height (), 2, "Height of 2 rows");
|
||||
ut.is (g2.byRow (0, 0), NULL, "Gap at 0,0");
|
||||
ut.ok (g2.byRow (0, 1), "Cell at 0,0");
|
||||
ut.ok (g2.byRow (1, 0), "Cell at 0,0");
|
||||
ut.is (g2.byRow (1, 1), NULL, "Gap at 1,1");
|
||||
|
||||
Grid g3;
|
||||
for (int i = 0; i < 14; ++i)
|
||||
g3.add (i / 4, i % 4, "value");
|
||||
|
||||
for (int i = 0; i < 20; ++i)
|
||||
if (i < 14)
|
||||
ut.ok (g3.byRow (i / 4, i % 4), "g3 good cell");
|
||||
else
|
||||
ut.is (g3.byRow (i / 4, i % 4), NULL, "g3 missing cell");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
83
test/history.annual.t
Executable file
83
test/history.annual.t
Executable file
|
@ -0,0 +1,83 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 9;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'time.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'time.rc', 'Created time.rc');
|
||||
}
|
||||
|
||||
# Create some tasks that were started/finished in different months, then verify
|
||||
# contents of the history report
|
||||
|
||||
my @timeArray = localtime(time);
|
||||
my $now = time ();
|
||||
my $lastyear = $now - ($timeArray[7]+1) * 86_400;
|
||||
|
||||
if (open my $fh, '>', 'pending.data')
|
||||
{
|
||||
print $fh <<EOF;
|
||||
[status:"pending" description:"PLW" entry:"$lastyear" wait:"$now"]
|
||||
[status:"pending" description:"PL" entry:"$lastyear"]
|
||||
[status:"deleted" description:"DLN" entry:"$lastyear" due:"$now" end:"$now"]
|
||||
[status:"deleted" description:"DLN2" entry:"$lastyear" end:"$now"]
|
||||
[status:"deleted" description:"DNN" entry:"$lastyear" end:"$now"]
|
||||
[status:"completed" description:"CLN" entry:"$lastyear" end:"$now"]
|
||||
[status:"completed" description:"CLL" entry:"$lastyear" end:"$lastyear"]
|
||||
[status:"completed" description:"CNN" entry:"$now" end:"$now"]
|
||||
[status:"completed" description:"CNN2" entry:"$now" end:"$now"]
|
||||
EOF
|
||||
close $fh;
|
||||
ok (-r 'pending.data', 'Created pending.data');
|
||||
}
|
||||
|
||||
my $output = qx{../task rc:time.rc history.annual};
|
||||
like ($output, qr/7\s+1\s+0\s+6/, 'history.annual - last year');
|
||||
like ($output, qr/2\s+3\s+3\s+-4/, 'history.annual - this year');
|
||||
like ($output, qr/4\s+2\s+1\s+1/, 'history.annual - average');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'time.rc';
|
||||
ok (!-r 'time.rc', 'Removed time.rc');
|
||||
|
||||
exit 0;
|
83
test/history.monthly.t
Executable file
83
test/history.monthly.t
Executable file
|
@ -0,0 +1,83 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 9;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'time.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'time.rc', 'Created time.rc');
|
||||
}
|
||||
|
||||
# Create some tasks that were started/finished in different months, then verify
|
||||
# contents of the history report
|
||||
|
||||
my @timeArray = localtime(time);
|
||||
my $now = time ();
|
||||
my $lastmonth = $now - $timeArray[3] * 86_400;
|
||||
|
||||
if (open my $fh, '>', 'pending.data')
|
||||
{
|
||||
print $fh <<EOF;
|
||||
[status:"pending" description:"PLW" entry:"$lastmonth" wait:"$now"]
|
||||
[status:"pending" description:"PL" entry:"$lastmonth"]
|
||||
[status:"deleted" description:"DLN" entry:"$lastmonth" due:"$now" end:"$now"]
|
||||
[status:"deleted" description:"DLN2" entry:"$lastmonth" end:"$now"]
|
||||
[status:"deleted" description:"DNN" entry:"$lastmonth" end:"$now"]
|
||||
[status:"completed" description:"CLN" entry:"$lastmonth" end:"$now"]
|
||||
[status:"completed" description:"CLL" entry:"$lastmonth" end:"$lastmonth"]
|
||||
[status:"completed" description:"CNN" entry:"$now" end:"$now"]
|
||||
[status:"completed" description:"CNN2" entry:"$now" end:"$now"]
|
||||
EOF
|
||||
close $fh;
|
||||
ok (-r 'pending.data', 'Created pending.data');
|
||||
}
|
||||
|
||||
my $output = qx{../task rc:time.rc history.monthly};
|
||||
like ($output, qr/7\s+1\s+0\s+6/, 'history.monthly - last month');
|
||||
like ($output, qr/2\s+3\s+3\s+-4/, 'history.monthly - this month');
|
||||
like ($output, qr/4\s+2\s+1\s+1/, 'history.monthly - average');
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'time.rc';
|
||||
ok (!-r 'time.rc', 'Removed time.rc');
|
||||
|
||||
exit 0;
|
81
test/hook.api.task_debug.t
Executable file
81
test/hook.api.task_debug.t
Executable file
|
@ -0,0 +1,81 @@
|
|||
#! /usr/bin/perl
|
||||
################################################################################
|
||||
## taskwarrior - a command line task list manager.
|
||||
##
|
||||
## Copyright 2006 - 2010, Paul Beckingham, Federico Hernandez.
|
||||
## All rights reserved.
|
||||
##
|
||||
## This program is free software; you can redistribute it and/or modify it under
|
||||
## the terms of the GNU General Public License as published by the Free Software
|
||||
## Foundation; either version 2 of the License, or (at your option) any later
|
||||
## version.
|
||||
##
|
||||
## This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||
## details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License along with
|
||||
## this program; if not, write to the
|
||||
##
|
||||
## Free Software Foundation, Inc.,
|
||||
## 51 Franklin Street, Fifth Floor,
|
||||
## Boston, MA
|
||||
## 02110-1301
|
||||
## USA
|
||||
##
|
||||
################################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 8;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'hook.rc')
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"hooks=on\n",
|
||||
"debug=on\n",
|
||||
"hook.pre-display=" . $ENV{'PWD'} . "/hook:test\n";
|
||||
close $fh;
|
||||
ok (-r 'hook.rc', 'Created hook.rc');
|
||||
}
|
||||
|
||||
if (open my $fh, '>', 'hook')
|
||||
{
|
||||
print $fh "function test () task_debug_message ('DEBUG MESSAGE') return 0, nil end\n";
|
||||
close $fh;
|
||||
ok (-r 'hook', 'Created hook');
|
||||
}
|
||||
|
||||
my $output = qx{../task rc:hook.rc version};
|
||||
if ($output =~ /PUC-Rio/)
|
||||
{
|
||||
# Test the hook.
|
||||
qx{../task rc:hook.rc add foo};
|
||||
$output = qx{../task rc:hook.rc info 1};
|
||||
like ($output, qr/DEBUG MESSAGE/ms, 'Hook called task_debug_message');
|
||||
}
|
||||
else
|
||||
{
|
||||
pass ('Hook called task_debug_message - skip: no Lua support');
|
||||
}
|
||||
|
||||
# Cleanup.
|
||||
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');
|
||||
|
||||
unlink 'hook';
|
||||
ok (!-r 'hook', 'Removed hook');
|
||||
|
||||
unlink 'hook.rc';
|
||||
ok (!-r 'hook.rc', 'Removed hook.rc');
|
||||
|
||||
exit 0;
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue