mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-21 07:43:08 +02:00
Unit Tests
- Upgraded to the new template.
This commit is contained in:
parent
2c8d795f21
commit
3a91a0d798
1 changed files with 11 additions and 7 deletions
|
@ -29,12 +29,16 @@ use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 4;
|
use Test::More tests => 4;
|
||||||
|
|
||||||
|
use File::Basename;
|
||||||
|
my $ut = basename ($0);
|
||||||
|
my $rc = $ut . '.rc';
|
||||||
|
|
||||||
# Ensure environment has no influence.
|
# Ensure environment has no influence.
|
||||||
delete $ENV{'TASKDATA'};
|
delete $ENV{'TASKDATA'};
|
||||||
delete $ENV{'TASKRC'};
|
delete $ENV{'TASKRC'};
|
||||||
|
|
||||||
# Create the rc file.
|
# Create the rc file.
|
||||||
if (open my $fh, '>', 'color.rc')
|
if (open my $fh, '>', $rc)
|
||||||
{
|
{
|
||||||
print $fh "data.location=.\n",
|
print $fh "data.location=.\n",
|
||||||
"color.header=blue\n",
|
"color.header=blue\n",
|
||||||
|
@ -46,13 +50,13 @@ if (open my $fh, '>', 'color.rc')
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test the errors colors
|
# Test the errors colors
|
||||||
my $output = qx{../src/task rc:color.rc rc.debug:on add foo priority:X 2>&1 >/dev/null};
|
my $output = qx{../src/task rc:$rc rc.debug:on add foo priority:X 2>&1 >/dev/null};
|
||||||
like ($output, qr/^\033\[33m The\ 'priority'\ attribute\ does\ not\ allow\ a\ value\ of\ 'X'\. \033\[0m$/xms, 'color.error');
|
like ($output, qr/^\033\[33m The\ 'priority'\ attribute\ does\ not\ allow\ a\ value\ of\ 'X'\. \033\[0m$/xms, "$ut: color.error");
|
||||||
like ($output, qr/^\033\[32m Timer\ Config::load\ \(.+color.rc\) .* \033\[0m$/xms, 'color.debug');
|
like ($output, qr/^\033\[32m Timer\ Config::load\ \(.+$rc\) .* \033\[0m$/xms, "$ut: color.debug");
|
||||||
like ($output, qr/^\033\[34m Using\ alternate\ .taskrc\ file\ /xms, 'color.header');
|
like ($output, qr/^\033\[34m Using\ alternate\ .taskrc\ file\ /xms, "$ut: color.header");
|
||||||
like ($output, qr/^\033\[31m Configuration\ override\ rc.debug:on \033\[0m$/xms, 'color.footnote');
|
like ($output, qr/^\033\[31m Configuration\ override\ rc.debug:on \033\[0m$/xms, "$ut: color.footnote");
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data color.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data), $rc;
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue