mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Unit Tests
- Corrected use of rc.fontunderline with the new Views. - Added new sample todo.sh import data, thanks to Daniel Wilcox. - Added rc.defaultwidth to various tests. - Modified tests to accomodate new next report. - Corrected regex in rc.override.t.
This commit is contained in:
parent
73f72c54c1
commit
bb04a58bdc
6 changed files with 51 additions and 19 deletions
|
@ -158,7 +158,8 @@ void Column::renderHeader (
|
|||
Color c = color;
|
||||
|
||||
// Now underline the header, or add a dashed line.
|
||||
if (context.config.getBoolean ("fontunderline"))
|
||||
if (context.color () &&
|
||||
context.config.getBoolean ("fontunderline"))
|
||||
{
|
||||
c.blend (Color (Color::nocolor, Color::nocolor, true, false, false));
|
||||
lines.push_back (c.colorize (leftJustify (header, width)));
|
||||
|
|
|
@ -39,7 +39,7 @@ if (open my $fh, '>', 'font.rc')
|
|||
}
|
||||
|
||||
# Test the fontunderline config variable. The following truth table defines
|
||||
# the different results which are to be tested.
|
||||
# the different results which are to be confirmed.
|
||||
#
|
||||
# color _forcecolor fontunderline result
|
||||
# ----- ----------- ------------- ---------
|
||||
|
|
|
@ -28,12 +28,13 @@
|
|||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More tests => 11;
|
||||
use Test::More tests => 30;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'import.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
print $fh "data.location=.\n",
|
||||
"dateformat=YYYY-M-D\n";
|
||||
close $fh;
|
||||
ok (-r 'import.rc', 'Created import.rc');
|
||||
}
|
||||
|
@ -41,23 +42,52 @@ if (open my $fh, '>', 'import.rc')
|
|||
# Create import file.
|
||||
if (open my $fh, '>', 'import.txt')
|
||||
{
|
||||
print $fh "x 2009-03-25 Walk the dog +project \@context\n",
|
||||
"This is a test +project \@context\n",
|
||||
"(A) A prioritized task\n",
|
||||
"\n";
|
||||
print $fh "(A) Prioritized todo\n",
|
||||
"(B) 2011-05-09 Prioritized with entry date\n",
|
||||
"2011-05-09 Not prioritized with entry date\n",
|
||||
"(C) +Project \@Context Priority with Project and context t:2011-05-11 < due date\n",
|
||||
"(D) 2011-05-09 +Project +OtherProject \@Context \@OtherContext Two Projects and Context with date\n",
|
||||
"x 2011-05-11 2011-05-09 +Project +OtherProject \@Context with date and completion date\n";
|
||||
close $fh;
|
||||
ok (-r 'import.txt', 'Created sample import data');
|
||||
}
|
||||
|
||||
my $output = qx{../src/task rc:import.rc import import.txt};
|
||||
like ($output, qr/Imported 3 tasks successfully, with 0 errors./, 'no errors');
|
||||
like ($output, qr/Imported 6 tasks successfully, with 0 errors./, 'no errors');
|
||||
|
||||
$output = qx{../src/task rc:import.rc list};
|
||||
like ($output, qr/1.+project.+This is a test/, 't1');
|
||||
like ($output, qr/2.+H.+A prioritized task/, 't2');
|
||||
$output = qx{../src/task rc:import.rc info 1};
|
||||
like ($output, qr/^Priority.+H.*$/m, 'priority (A) -> pri:H');
|
||||
like ($output, qr/^Description.+Prioritized todo.*$/m, '... -> desc:...');
|
||||
|
||||
$output = qx{../src/task rc:import.rc completed};
|
||||
like ($output, qr/3\/25\/2009.+Walk the dog/, 't3');
|
||||
$output = qx{../src/task rc:import.rc info 2};
|
||||
like ($output, qr/^Priority.+M.*$/m, 'priority (B) -> pri:M');
|
||||
like ($output, qr/^Description.+Prioritized with entry Date.*$/m, '... -> desc:...');
|
||||
|
||||
$output = qx{../src/task rc:import.rc info 3};
|
||||
like ($output, qr/^Project.+Project.*$/m, '+Project -> pro:Project');
|
||||
like ($output, qr/^Description.+Not prioritized with entry Date.*$/m, '... -> desc:...');
|
||||
|
||||
$output = qx{../src/task rc:import.rc info 4};
|
||||
like ($output, qr/^Priority.+L.*$/m, 'priority (C) -> pri:L');
|
||||
like ($output, qr/^Project.+Project.*$/m, '+Project -> pro:Project');
|
||||
like ($output, qr/^Description.+Priority with Project and context.*$/m, '... -> desc:...');
|
||||
like ($output, qr/^Tags.+\@Context.*$/m, '@Context -> +@Context');
|
||||
like ($output, qr/^Due.+2011-05-11.*$/m, 't:2011-05-11 -> due:2011-05-11');
|
||||
|
||||
$output = qx{../src/task rc:import.rc info 5};
|
||||
unlike ($output, qr/^Priority/m, 'priority (D) -> pri:');
|
||||
like ($output, qr/^Project.+Project.*$/m, '+Project -> pro:Project');
|
||||
like ($output, qr/^Description.+Two Projects and Context with date.*$/m, '... -> desc:...');
|
||||
like ($output, qr/^Tags.+\@Context.*$/m, '@Context -> +@Context');
|
||||
like ($output, qr/^Entry.+2011-05-09.*$/m, '2011-05-09 -> entry:2011-05-09');
|
||||
|
||||
$output = qx{../src/task rc:import.rc info 6};
|
||||
like ($output, qr/^Description.+With date and completion date.*$/m, '... -> desc:...');
|
||||
like ($output, qr/^Description.+With date and completion date.*$/m, '... -> desc:...');
|
||||
like ($output, qr/^Tags.+\@Context.*$/m, '@Context -> +@Context');
|
||||
like ($output, qr/^Entry.+2011-05-09.*$/m, '2011-05-09 -> entry:2011-05-09');
|
||||
like ($output, qr/^End.+2011-05-11.*$/m, '2011-05-11 -> end:2011-05-11');
|
||||
like ($output, qr/^Status.+Completed.*$/m, 'x -> status:Completed');
|
||||
|
||||
# Cleanup.
|
||||
unlink 'import.txt';
|
||||
|
|
|
@ -33,7 +33,8 @@ use Test::More tests => 11;
|
|||
# Create the rc file.
|
||||
if (open my $fh, '>', 'tags.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
print $fh "data.location=.\n",
|
||||
"defaultwidth=100\n";
|
||||
close $fh;
|
||||
ok (-r 'tags.rc', 'Created tags.rc');
|
||||
}
|
||||
|
|
|
@ -47,8 +47,8 @@ qx{../src/task rc:next.rc add project:B priority:H BH};
|
|||
qx{../src/task rc:next.rc add project:B Bnone};
|
||||
|
||||
my $output = qx{../src/task rc:next.rc next};
|
||||
like ($output, qr/\s1\sA\s+H\s+(?:-|\d secs?)\sAH\n/, 'AH shown');
|
||||
like ($output, qr/\s3\sB\s+H\s+(?:-|\d secs?)\sBH\n/, 'BH shown');
|
||||
like ($output, qr/AH/, 'AH shown');
|
||||
like ($output, qr/BH/, 'BH shown');
|
||||
|
||||
# Cleanup.
|
||||
unlink 'pending.data';
|
||||
|
|
|
@ -40,10 +40,10 @@ if (open my $fh, '>', 'rc.rc')
|
|||
}
|
||||
|
||||
my $output = qx{../src/task rc:rc.rc show};
|
||||
like ($output, qr/\sfoo\s+bar/, 'unmodified');
|
||||
like ($output, qr/^.*foo.+bar.*$/m, 'unmodified');
|
||||
|
||||
$output = qx{../src/task rc:rc.rc rc.foo:baz show};
|
||||
like ($output, qr/\sfoo\s+baz/, 'overridden');
|
||||
like ($output, qr/^.*foo.*baz.*$/m, 'overridden');
|
||||
|
||||
unlink 'rc.rc';
|
||||
ok (!-r 'rc.rc', 'Removed rc.rc');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue