From dc404d76b9b27bd35bd29f3371ab97e410839a1d Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 5 May 2012 14:14:01 -0400 Subject: [PATCH] Unit Tests - Added tests for bug #1006 (thanks to Louis-Claude Canon). --- test/bug.1006.t | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100755 test/bug.1006.t diff --git a/test/bug.1006.t b/test/bug.1006.t new file mode 100755 index 000000000..cc5fb47d5 --- /dev/null +++ b/test/bug.1006.t @@ -0,0 +1,64 @@ +#! /usr/bin/perl +################################################################################ +## taskwarrior - a command line task list manager. +## +## Copyright 2006-2012, Paul Beckingham, Federico Hernandez. +## +## Permission is hereby granted, free of charge, to any person obtaining a copy +## of this software and associated documentation files (the "Software"), to deal +## in the Software without restriction, including without limitation the rights +## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +## copies of the Software, and to permit persons to whom the Software is +## furnished to do so, subject to the following conditions: +## +## The above copyright notice and this permission notice shall be included +## in all copies or substantial portions of the Software. +## +## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +## OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +## THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +## SOFTWARE. +## +## http://www.opensource.org/licenses/mit-license.php +## +################################################################################ + +use strict; +use warnings; +use Test::More tests => 4; + +# Create the rc file. +if (open my $fh, '>', 'bug.rc') +{ + print $fh "data.location=.\n"; + close $fh; + ok (-r 'bug.rc', 'Created bug.rc'); +} + +# Bug with completion of "des" in task descriptions and annotations. It happens +# for all the shortcuts for column attributes that are automatically completed. +# This is because DOM elements are checked before standard words when strings +# are tokenized. + +qx{../src/task rc:bug.rc add des}; +qx{../src/task rc:bug.rc 1 annotate des}; +my $output = qx{../src/task rc:bug.rc 1 info}; +unlike ($output, qr/description/ms, 'Attribute not completed in description'); + +$output = qx{../src/task test rc:bug.rc rc.report.test.columns:des rc.report.test.labels:__}; +diag ($output); +like ($output, qr/__/ms, 'Custom column present in the output'); + +### Cleanup. +unlink qw(pending.data completed.data undo.data backlog.data synch.key bug.rc); +ok (! -r 'pending.data' && + ! -r 'completed.data' && + ! -r 'undo.data' && + ! -r 'backlog.data' && + ! -r 'synch.key' && + ! -r 'bug.rc', 'Cleanup'); + +exit 0;