From e8c0c8861bb30adcd9ebe263d6343deae1035754 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 23 Jul 2010 17:16:54 -0700 Subject: [PATCH] Unit tests - bug.441.t - Added unit test for bug 441, where /one/one:/ fails to substitute, and instead clobbers the whole description. --- src/tests/bug.441.t | 62 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100755 src/tests/bug.441.t diff --git a/src/tests/bug.441.t b/src/tests/bug.441.t new file mode 100755 index 000000000..d044494d3 --- /dev/null +++ b/src/tests/bug.441.t @@ -0,0 +1,62 @@ +#! /usr/bin/perl +################################################################################ +## task - a command line task list manager. +## +## Copyright 2006 - 2010, Paul Beckingham. +## All rights reserved. +## +## This program is free software; you can redistribute it and/or modify it under +## the terms of the GNU General Public License as published by the Free Software +## Foundation; either version 2 of the License, or (at your option) any later +## version. +## +## This program is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +## FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +## details. +## +## You should have received a copy of the GNU General Public License along with +## this program; if not, write to the +## +## Free Software Foundation, Inc., +## 51 Franklin Street, Fifth Floor, +## Boston, MA +## 02110-1301 +## USA +## +################################################################################ + +use strict; +use warnings; +use Test::More tests => 6; + +# Create the rc file. +if (open my $fh, '>', '441.rc') +{ + print $fh "data.location=.\n", + "confirmation=off\n"; + + close $fh; + ok (-r '441.rc', 'Created 441.rc'); +} + +# Bug #441: A colon messes up text replacement with /// +qx{../task rc:441.rc add one two three}; +qx{../task rc:441.rc 1 /two/two:/}; +my $output = qx{../task rc:441.rc ls}; +like ($output, qr/one two: three/ms, 'Substitution with colon worked'); + +# Cleanup. +unlink 'pending.data'; +ok (!-r 'pending.data', 'Removed pending.data'); + +unlink 'completed.data'; +ok (!-r 'completed.data', 'Removed completed.data'); + +unlink 'undo.data'; +ok (!-r 'undo.data', 'Removed undo.data'); + +unlink '441.rc'; +ok (!-r '441.rc', 'Removed 441.rc'); + +exit 0;