mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Unit Tests - add, delete, info, ///
- Began set of high-level integration tests, in Perl.
This commit is contained in:
parent
72efddc066
commit
92ba36bdec
4 changed files with 129 additions and 17 deletions
|
@ -39,8 +39,6 @@
|
|||
Config::Config ()
|
||||
{
|
||||
// These are default (but overridable) reports.
|
||||
(*this)["report.large.columns"] = "id,uuid,project,priority,entry,start,due,age,active,tags,description";
|
||||
(*this)["report.large.sort"] = "due+,priority-,project+";
|
||||
(*this)["report.long.columns"] = "id,project,priority,entry,start,due,age,tags,description";
|
||||
(*this)["report.long.sort"] = "due+,priority-,project+";
|
||||
(*this)["report.list.columns"] = "id,project,priority,due,active,age,description";
|
||||
|
|
72
src/tests/add.t
Executable file
72
src/tests/add.t
Executable file
|
@ -0,0 +1,72 @@
|
|||
#! /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 => 14;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'add.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'add.rc', 'Created add.rc');
|
||||
}
|
||||
|
||||
# Test the add command.
|
||||
my $output = qx{../task rc:add.rc add This is a test; ../task rc:add.rc info 1};
|
||||
like ($output, qr/ID\s+1\n/, 'add ID');
|
||||
like ($output, qr/Description\s+This is a test\n/, 'add ID');
|
||||
like ($output, qr/Status\s+Pending\n/, 'add Pending');
|
||||
like ($output, qr/UUID\s+[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}\n/, 'add UUID');
|
||||
|
||||
# Test the /// modifier.
|
||||
$output = qx{../task rc:add.rc 1 /test/TEST/; ../task rc:add.rc 1 "/is //"; ../task rc:add.rc info 1};
|
||||
like ($output, qr/ID\s+1\n/, 'add ID');
|
||||
like ($output, qr/Status\s+Pending\n/, 'add Pending');
|
||||
like ($output, qr/Description\s+This a TEST\n/, 'add ID');
|
||||
|
||||
# Test delete.
|
||||
$output = qx{../task rc:add.rc delete 1; ../task rc:add.rc info 1};
|
||||
like ($output, qr/ID\s+1\n/, 'add ID');
|
||||
like ($output, qr/Status\s+Deleted\n/, 'add Deleted');
|
||||
|
||||
# Test undelete.
|
||||
$output = qx{../task rc:add.rc undelete 1; ../task rc:add.rc info 1};
|
||||
like ($output, qr/ID\s+1\n/, 'add ID');
|
||||
like ($output, qr/Status\s+Pending\n/, 'add Pending');
|
||||
|
||||
# Cleanup.
|
||||
unlink 'pending.data';
|
||||
ok (!-r 'pendind.data', 'Removed pending.data');
|
||||
|
||||
unlink 'add.rc';
|
||||
ok (!-r 'add.rc', 'Removed add.rc');
|
||||
|
||||
exit 0;
|
||||
|
57
src/tests/basic.t
Executable file
57
src/tests/basic.t
Executable file
|
@ -0,0 +1,57 @@
|
|||
#! /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 => 7;
|
||||
|
||||
# Create the rc file.
|
||||
if (open my $fh, '>', 'basic.rc')
|
||||
{
|
||||
print $fh "data.location=.\n";
|
||||
close $fh;
|
||||
ok (-r 'basic.rc', 'Created basic.rc');
|
||||
}
|
||||
|
||||
# Test the usage command.
|
||||
my $output = qx{../task rc:basic.rc};
|
||||
like ($output, qr/Usage: task/, 'usage');
|
||||
like ($output, qr/http:\/\/www\.beckingham\.net\/task\.html/, 'usage - url');
|
||||
|
||||
# Test the version command.
|
||||
$output = qx{../task rc:basic.rc version};
|
||||
like ($output, qr/task \d+\.\d+\.\d+/, 'version - task version number');
|
||||
like ($output, qr/ABSOLUTELY NO WARRANTY/, 'version - warranty');
|
||||
like ($output, qr/http:\/\/www\.beckingham\.net\/task\.html/, 'version - url');
|
||||
|
||||
# Cleanup.
|
||||
unlink 'basic.rc';
|
||||
ok (!-r 'basic.rc', 'Removed basic.rc');
|
||||
|
||||
exit 0;
|
||||
|
15
src/tests/in
15
src/tests/in
|
@ -1,15 +0,0 @@
|
|||
./task add monday due:monday
|
||||
./task add tuesday due:tuesday
|
||||
./task add wednesday due:wednesday
|
||||
./task add thursday due:thursday
|
||||
./task add friday due:friday
|
||||
./task add saturday due:saturday
|
||||
./task add sunday due:sunday
|
||||
./task add yesterday due:yesterday
|
||||
./task add today due:today
|
||||
./task add tomorrow due:tomorrow
|
||||
./task add eow due:eow
|
||||
./task add eom due:eom
|
||||
./task add eoy due:eoy
|
||||
./task add 21st due:21st
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue