Unit Tests - color.*, abbreviation

- Added unit tests for all auto coloration configuration settings.
- Tweaked colorization rule precedence to allow color.due to override
  the built-in coloration of due tasks.
This commit is contained in:
Paul Beckingham 2009-03-10 00:08:40 -04:00
parent 0ff33d1c16
commit 6fade84535
10 changed files with 515 additions and 14 deletions

View file

@ -28,7 +28,7 @@
use strict;
use warnings;
use Test::More tests => 15;
use Test::More tests => 22;
# Create the rc file.
if (open my $fh, '>', 'abbrev.rc')
@ -38,7 +38,7 @@ if (open my $fh, '>', 'abbrev.rc')
ok (-r 'abbrev.rc', 'Created abbrev.rc');
}
# Test the add command.
# Test the priority attribute abbrevations.
qx{../task rc:abbrev.rc add priority:H with};
qx{../task rc:abbrev.rc add without};
@ -66,6 +66,28 @@ $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 version};
like ($output, qr/ABSOLUTELY NO WARRANTY/, 'version');
$output = qx{../task versio};
like ($output, qr/ABSOLUTELY NO WARRANTY/, 'versio');
$output = qx{../task versi};
like ($output, qr/ABSOLUTELY NO WARRANTY/, 'versi');
$output = qx{../task vers};
like ($output, qr/ABSOLUTELY NO WARRANTY/, 'vers');
$output = qx{../task ver};
like ($output, qr/ABSOLUTELY NO WARRANTY/, 'ver');
$output = qx{../task ve};
like ($output, qr/ABSOLUTELY NO WARRANTY/, 've');
$output = qx{../task v};
like ($output, qr/ABSOLUTELY NO WARRANTY/, 'v');
# Cleanup.
unlink 'pending.data';
ok (!-r 'pending.data', 'Removed pending.data');