#! /usr/bin/env perl ################################################################################ ## ## Copyright 2006 - 2014, 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 => 24; # Ensure environment has no influence. delete $ENV{'TASKDATA'}; delete $ENV{'TASKRC'}; # Create the rc file. if (open my $fh, '>', 'uuid.rc') { print $fh "data.location=.\n", "dateformat=m/d/Y\n", "confirmation=off\n", "report.unittest.columns=id,entry,start,description\n", "report.unittest.filter=status:pending\n", "report.unittest.sort=id\n"; close $fh; } if (open my $fh, '>', 'pending.data') { print $fh <', 'completed.data') { print $fh <&1}; qx{../src/task rc:uuid.rc 2 modify TWO 2>&1}; my $output = qx{../src/task rc:uuid.rc list 2>&1}; like ($output, qr/ONE/, 'task list ONE'); like ($output, qr/TWO/, 'task list TWO'); like ($output, qr/three/, 'task list three'); like ($output, qr/ssttaarrtt/, 'task list ssttaarrtt'); unlike ($output, qr/four/, 'task does not list four'); unlike ($output, qr/five/, 'task does not list five'); unlike ($output, qr/eenndd/, 'task does not list eenndd'); unlike ($output, qr/UUNNDDOO/, 'task does not list UUNNDDOO'); qx{../src/task rc:uuid.rc ea3b4822-574c-464b-8025-7f7be9f3cc57 modify FOUR 2>&1}; $output = qx{../src/task rc:uuid.rc completed 2>&1}; unlike ($output, qr/ONE/, 'task does not list ONE'); unlike ($output, qr/TWO/, 'task does not list TWO'); unlike ($output, qr/three/, 'task does not list three'); unlike ($output, qr/ssttaarrtt/, 'task does not list ssttaarrtt'); like ($output, qr/FOUR/, 'modified completed task FOUR'); like ($output, qr/five/, 'did not modify task five'); like ($output, qr/eenndd/, 'did not modify task eenndd'); like ($output, qr/UUNNDDOO/, 'did not modify task UUNNDDOO'); qx{../src/task rc:uuid.rc c1361003-948e-43e8-85c8-15d28dc3c71c modify status:pending 2>&1}; $output = qx{../src/task rc:uuid.rc list 2>&1}; like ($output, qr/UUNNDDOO/, 'task UUNNDDOO modified status to pending'); $output = qx{../src/task rc:uuid.rc completed 2>&1}; unlike ($output, qr/UUNNDDOO/, 'task does not list UUNNDDOO after modification'); qx{../src/task rc:uuid.rc d71d3566-7a6b-4c32-8f0b-6de75bb9397b modify start:12/31/2010 2>&1}; $output = qx{../src/task rc:uuid.rc unittest 2>&1}; like ($output, qr/12\/31\/2010/, 'modified start date of task ssttaarrtt'); qx{../src/task rc:uuid.rc 727baa6c-65b8-485e-a810-e133e3cd83dc modify end:12/31/2010 2>&1}; $output = qx{../src/task rc:uuid.rc completed 2>&1}; like ($output, qr/12\/31\/2010/, 'modified end date of task eenndd'); qx{../src/task rc:uuid.rc aa4abef1-1dc5-4a43-b6a0-7872df3094bb modify entry:12/30/2010 2>&1}; qx{../src/task rc:uuid.rc aa4abef1-1dc5-4a43-b6a0-7872df3094bb modify start:1/1/2011 2>&1}; $output = qx{../src/task rc:uuid.rc unittest 2>&1}; like ($output, qr/12\/30\/2010/, 'modified entry date of task three'); like ($output, qr/1\/1\/2011/, 'added start date of task three with modify'); # Cleanup. unlink qw(pending.data completed.data undo.data backlog.data uuid.rc); exit 0;