From 7c87bbc19ae1f729189ebb4f3fb46a5ece463a23 Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Sat, 14 Mar 2009 12:02:33 -0400 Subject: [PATCH] Unit Tests - dateformat - Unit tests determine whether the dateformat configuration variable determines how dates are parsed, and how dates are rendered. --- src/tests/dateformat.t | 54 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100755 src/tests/dateformat.t diff --git a/src/tests/dateformat.t b/src/tests/dateformat.t new file mode 100755 index 000000000..83fe0b293 --- /dev/null +++ b/src/tests/dateformat.t @@ -0,0 +1,54 @@ +#! /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 Test::More tests => 5; + +# Create the rc file. +if (open my $fh, '>', 'date.rc') +{ + print $fh "data.location=.\n", + "dateformat=YMD\n"; + close $fh; + ok (-r 'date.rc', 'Created date.rc'); +} + +qx{../task rc:date.rc add foo due:20091231}; +my $output = qx{../task rc:date.rc info 1}; +like ($output, qr/\b20091231\b/, 'date format YMD parsed'); + +# Cleanup. +unlink 'pending.data'; +ok (!-r 'pending.data', 'Removed pending.data'); + +unlink 'date.rc'; +ok (!-r 'date.rc', 'Removed date.rc'); + +exit 0; +