From a6e9e6cdfbe8ee9fe31a0e7b55169ea1ccb7013e Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 3 Jul 2009 23:51:13 -0400 Subject: [PATCH] Unit Tests - rc - Now tests whether the default rc and data.location are created from scratch. --- src/tests/rc.t | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 src/tests/rc.t diff --git a/src/tests/rc.t b/src/tests/rc.t new file mode 100755 index 000000000..633cb0417 --- /dev/null +++ b/src/tests/rc.t @@ -0,0 +1,49 @@ +#! /usr/bin/perl +################################################################################ +## task - a command line task list manager. +## +## Copyright 2006 - 2009, 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 File::Path; +use Test::More tests => 4; + +# Create the rc file. +unlink 'foo.rc'; +rmtree 'foo', 0, 0; +qx{echo 'y'|../task rc:foo.rc rc.data.location:foo}; + +ok (-r 'foo.rc', 'Created default rc file'); +ok (-d 'foo', 'Created default data directory'); + +rmtree 'foo', 0, 0; +ok (!-r 'foo', 'Removed foo'); + +unlink 'foo.rc'; +ok (!-r 'foo.rc', 'Removed foo.rc'); + +exit 0; +