Unit Tests

- Modified several unit tests to accomodate new column names.
This commit is contained in:
Paul Beckingham 2011-05-08 17:14:28 -04:00
parent 0d9d01324e
commit 04033911c3
10 changed files with 46 additions and 130 deletions

View file

@ -28,7 +28,7 @@
use strict;
use warnings;
use Test::More tests => 51;
use Test::More tests => 29;
# Create the rc file.
if (open my $fh, '>', 'annotate.rc')
@ -79,42 +79,16 @@ my $output = qx{../src/task rc:annotate.rc rrr};
#
# 4 tasks
like ($output, qr/1 one/, 'task 1');
like ($output, qr/1 one/, 'task 1'); # 2
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{../src/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{../src/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/one.+\d{1,2}\/\d{1,2}\/\d{4}\s+foo1/ms, 'full - first annotation task 1');
like ($output, qr/foo1.+\d{1,2}\/\d{1,2}\/\d{4}\s+foo2/ms, 'full - second annotation task 1');
like ($output, qr/foo2.+\d{1,2}\/\d{1,2}\/\d{4}\s+foo3/ms, 'full - third annotation task 1');
like ($output, qr/two.+\d{1,2}\/\d{1,2}\/\d{4}\s+bar1/ms, 'full - first annotation task 2');
like ($output, qr/bar1.+\d{1,2}\/\d{1,2}\/\d{4}\s+bar2/ms, 'full - second annotation task 2');
like ($output, qr/three.+\d{1,2}\/\d{1,2}\/\d{4}\s+baz1/ms,'full - first annotation task 3');
like ($output, qr/4 tasks/, 'count');
if (open my $fh, '>', 'annotate2.rc')
@ -132,16 +106,16 @@ if (open my $fh, '>', 'annotate2.rc')
}
$output = qx{../src/task rc:annotate2.rc rrr};
like ($output, qr/1 one/, 'task 1');
like ($output, qr/1 one/, 'task 1'); # 14
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/one.+\d{1,6}\s+\d{1,6}\s+foo1/ms, 'dateformat - first annotation task 1'); #18
like ($output, qr/foo1.+\d{1,6}\s+\d{1,6}\s+foo2/ms, 'dateformat - second annotation task 1');
like ($output, qr/foo2.+\d{1,6}\s+\d{1,6}\s+foo3/ms, 'dateformat - third annotation task 1');
like ($output, qr/two.+\d{1,6}\s+\d{1,6}\s+bar1/ms, 'dateformat - first annotation task 2');
like ($output, qr/bar1.+\d{1,6}\s+\d{1,6}\s+bar2/ms, 'dateformat - second annotation task 2');
like ($output, qr/three.+\d{1,6}\s+\d{1,6}\s+baz1/ms,'dateformat - first annotation task 3');
like ($output, qr/4 tasks/, 'count');
# Cleanup.

View file

@ -44,11 +44,11 @@ qx{../src/task rc:bug.rc add due:yesterday before};
qx{../src/task rc:bug.rc add due:today now};
qx{../src/task rc:bug.rc add due:tomorrow after};
my $output = qx{../src/task rc:bug.rc rc.report.long.sort:countdown+ long};
like ($output, qr/before.+now.+after/ms, 'rc.report.long.sort:countdown+ works');
my $output = qx{../src/task rc:bug.rc rc.report.long.sort:due+ long};
like ($output, qr/before.+now.+after/ms, 'rc.report.long.sort:due+ works');
$output = qx{../src/task rc:bug.rc rc.report.long.sort:countdown- long};
like ($output, qr/after.+now.+before/ms, 'rc.report.long.sort:countdown- works');
$output = qx{../src/task rc:bug.rc rc.report.long.sort:due- long};
like ($output, qr/after.+now.+before/ms, 'rc.report.long.sort:due- works');
# Cleanup.
unlink 'pending.data';

View file

@ -1,63 +0,0 @@
#! /usr/bin/perl
################################################################################
## taskwarrior - a command line task list manager.
##
## Copyright 2006 - 2011, 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{../src/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;

View file

@ -33,7 +33,8 @@ use Test::More tests => 40;
# Create the rc file.
if (open my $fh, '>', 'bug.rc')
{
print $fh "data.location=.\n";
print $fh "data.location=.\n",
"defaultwidth=0\n";
close $fh;
ok (-r 'bug.rc', 'Created bug.rc');
@ -44,19 +45,20 @@ qx{../src/task rc:bug.rc add one +ordinary};
qx{../src/task rc:bug.rc add two +\@strange};
my $output = qx{../src/task rc:bug.rc long +ordinary};
like ($output, qr/one/, '+ordinary explicitly included');
diag ($output);
like ($output, qr/one/, '+ordinary explicitly included'); # 2
unlike ($output, qr/two/, '@strange implicitly excluded');
$output = qx{../src/task rc:bug.rc long -ordinary};
unlike ($output, qr/one/, '-ordinary explicitly excluded');
like ($output, qr/two/, '@strange implicitly included');
like ($output, qr/two/, '@strange implicitly included'); # 5
$output = qx{../src/task rc:bug.rc long +\@strange};
unlike ($output, qr/one/, '-ordinary implicitly excluded');
like ($output, qr/two/, '@strange explicitly included');
like ($output, qr/two/, '@strange explicitly included'); # 7
$output = qx{../src/task rc:bug.rc long -\@strange};
like ($output, qr/one/, '+ordinary implicitly included');
like ($output, qr/one/, '+ordinary implicitly included'); # 8
unlike ($output, qr/two/, '@strange explicitly excluded');
# Bug #XXX - '-t1 -t2' doesn't seem to work, when @ characters are involved.

View file

@ -34,7 +34,8 @@ use Test::More tests => 8;
if (open my $fh, '>', 'color.rc')
{
print $fh "data.location=.\n",
"color.pri.H=red\n";
"color.pri.H=red\n",
"fontunderline=no\n";
close $fh;
ok (-r 'color.rc', 'Created color.rc');
}

View file

@ -35,28 +35,28 @@ 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.columns=id,due.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.up.sort=due+\n";
print $fh "report.down.description=countdown- report\n";
print $fh "report.down.columns=id,countdown,description\n";
print $fh "report.down.columns=id,due.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.down.sort=due-\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.upc.sort=due+\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";
print $fh "report.downc.sort=due-\n";
close $fh;
ok (-r 'countdown.rc', 'Created countdown.rc');

View file

@ -35,7 +35,7 @@ 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.columns=id,priority.long\n",
"report.foo.labels=ID,P\n",
"report.foo.sort=id+\n";
close $fh;
@ -49,11 +49,11 @@ qx{../src/task rc:pri.rc add three pri:L};
qx{../src/task rc:pri.rc add four pri:};
my $output = qx{../src/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');
like ($output, qr/ID.+Pri/, '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';

View file

@ -35,7 +35,7 @@ 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.columns=id,recur.indicator\n",
"report.foo.labels=ID,R\n",
"report.foo.sort=id+\n";
close $fh;
@ -46,7 +46,7 @@ if (open my $fh, '>', 'custom.rc')
qx{../src/task rc:custom.rc add foo due:tomorrow recur:weekly};
qx{../src/task rc:custom.rc add bar};
my $output = qx{../src/task rc:custom.rc foo 2>&1};
like ($output, qr/ID R/, 'Recurrence indicator heading');
like ($output, qr/ID.+R/, 'Recurrence indicator heading');
like ($output, qr/3\s+R/, 'Recurrence indicator t1');
unlike ($output, qr/2\s+R/, 'No recurrence indicator t2');

View file

@ -35,7 +35,7 @@ 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.columns=id,tags.indicator\n",
"report.foo.labels=ID,T\n",
"report.foo.sort=id+\n";
close $fh;
@ -46,7 +46,7 @@ if (open my $fh, '>', 'custom.rc')
qx{../src/task rc:custom.rc add foo +tag};
qx{../src/task rc:custom.rc add bar};
my $output = qx{../src/task rc:custom.rc foo 2>&1};
like ($output, qr/ID T/, 'Tag indicator heading');
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');

View file

@ -21,6 +21,8 @@ fi
for i in *.t
do
echo '#' $i >>all.log
if [ $BAR == 1 ]; then
$VRAMSTEG --label 'All tests' --min 0 --max $TOTAL --current $COUNT --percentage --start $START --estimate
COUNT=$[COUNT + 1]