mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-23 05:27:47 +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 Test::More tests => 4;
|
||||
|
||||
use File::Basename;
|
||||
my $ut = basename ($0);
|
||||
my $rc = $ut . '.rc';
|
||||
|
||||
# Ensure environment has no influence.
|
||||
delete $ENV{'TASKDATA'};
|
||||
delete $ENV{'TASKRC'};
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'color.rc')
|
||||
if (open my $fh, '>', $rc)
|
||||
{
|
||||
print $fh "data.location=.\n",
|
||||
"color.header=blue\n",
|
||||
|
@ -46,13 +50,13 @@ if (open my $fh, '>', 'color.rc')
|
|||
}
|
||||
|
||||
# Test the errors colors
|
||||
my $output = qx{../src/task rc:color.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\[32m Timer\ Config::load\ \(.+color.rc\) .* \033\[0m$/xms, 'color.debug');
|
||||
like ($output, qr/^\033\[34m Using\ alternate\ .taskrc\ file\ /xms, 'color.header');
|
||||
like ($output, qr/^\033\[31m Configuration\ override\ rc.debug:on \033\[0m$/xms, 'color.footnote');
|
||||
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, "$ut: color.error");
|
||||
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, "$ut: color.header");
|
||||
like ($output, qr/^\033\[31m Configuration\ override\ rc.debug:on \033\[0m$/xms, "$ut: color.footnote");
|
||||
|
||||
# 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;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue