mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Unit Tests
- Fixed some tests that used old message text. - Fixed tests that relied on 'log'ed tasks still being written into pending.data. - Removed obsolete auto-info tests.
This commit is contained in:
parent
9641dde54f
commit
2e09ddd900
4 changed files with 12 additions and 89 deletions
|
@ -41,7 +41,7 @@ if (open my $fh, '>', 'bug_annotate.rc')
|
||||||
# Attempt a blank annotation.
|
# Attempt a blank annotation.
|
||||||
qx{../src/task rc:bug_annotate.rc add foo};
|
qx{../src/task rc:bug_annotate.rc add foo};
|
||||||
my $output = qx{../src/task rc:bug_annotate.rc 1 annotate};
|
my $output = qx{../src/task rc:bug_annotate.rc 1 annotate};
|
||||||
like ($output, qr/Cannot apply a blank annotation./, 'failed on blank annotation');
|
like ($output, qr/Additional text must be provided/, 'failed on blank annotation');
|
||||||
|
|
||||||
# Attempt an annotation without ID
|
# Attempt an annotation without ID
|
||||||
$output = qx{../src/task rc:bug_annotate.rc annotate bar};
|
$output = qx{../src/task rc:bug_annotate.rc annotate bar};
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 9;
|
use Test::More tests => 11;
|
||||||
|
|
||||||
# Create the rc file.
|
# Create the rc file.
|
||||||
if (open my $fh, '>', 'extra.rc')
|
if (open my $fh, '>', 'extra.rc')
|
||||||
|
@ -40,10 +40,13 @@ if (open my $fh, '>', 'extra.rc')
|
||||||
}
|
}
|
||||||
|
|
||||||
qx{../src/task rc:extra.rc add foo};
|
qx{../src/task rc:extra.rc add foo};
|
||||||
my $output = qx{../src/task rc:extra.rc 1 start pri:L};
|
qx{../src/task rc:extra.rc 1 start pri:L};
|
||||||
like ($output, qr/The 'start' command does not allow further modification of a task\./, 'no modifications allowed for start');
|
qx{../src/task rc:extra.rc 1 stop pro:bar};
|
||||||
$output = qx{../src/task rc:extra.rc 1 stop pro:bar};
|
my $output = qx{../src/task rc:extra.rc list};
|
||||||
like ($output, qr/The 'stop' command does not allow further modification of a task\./, 'no modifications allowed for stop');
|
like ($output, qr/foo/, 'Task shown');
|
||||||
|
like ($output, qr/1 task/, 'Correct count');
|
||||||
|
like ($output, qr/L/, 'Correct priority');
|
||||||
|
like ($output, qr/bar/, 'Correct annotation');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink 'pending.data';
|
unlink 'pending.data';
|
||||||
|
|
77
test/info.t
77
test/info.t
|
@ -1,77 +0,0 @@
|
||||||
#! /usr/bin/perl
|
|
||||||
################################################################################
|
|
||||||
## taskwarrior - a command line task list manager.
|
|
||||||
##
|
|
||||||
## Copyright 2006 - 2011, Paul Beckingham, Federico Hernandez.
|
|
||||||
## 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 => 13;
|
|
||||||
|
|
||||||
# Create the rc file.
|
|
||||||
if (open my $fh, '>', 'info.rc')
|
|
||||||
{
|
|
||||||
print $fh "data.location=.\n",
|
|
||||||
"confirmation=off\n";
|
|
||||||
close $fh;
|
|
||||||
ok (-r 'info.rc', 'Created info.rc');
|
|
||||||
}
|
|
||||||
|
|
||||||
# Test the add command.
|
|
||||||
qx{../src/task rc:info.rc add test one};
|
|
||||||
qx{../src/task rc:info.rc add test two};
|
|
||||||
qx{../src/task rc:info.rc add test three};
|
|
||||||
|
|
||||||
my $output = qx{../src/task rc:info.rc 1};
|
|
||||||
like ($output, qr/Description\s+test one\n/, 'single auto-info one');
|
|
||||||
unlike ($output, qr/Description\s+test two\n/, 'single auto-info !two');
|
|
||||||
unlike ($output, qr/Description\s+test three\n/, 'single auto-info !three');
|
|
||||||
|
|
||||||
$output = qx{../src/task rc:info.rc 1-2};
|
|
||||||
like ($output, qr/Description\s+test one\n/, 'single auto-info one');
|
|
||||||
like ($output, qr/Description\s+test two\n/, 'single auto-info two');
|
|
||||||
unlike ($output, qr/Description\s+test three\n/, 'single auto-info !three');
|
|
||||||
|
|
||||||
# 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 'backlog.data';
|
|
||||||
ok (!-r 'backlog.data', 'Removed backlog.data');
|
|
||||||
|
|
||||||
unlink 'synch.key';
|
|
||||||
ok (!-r 'synch.key', 'Removed synch.key');
|
|
||||||
|
|
||||||
unlink 'info.rc';
|
|
||||||
ok (!-r 'info.rc', 'Removed info.rc');
|
|
||||||
|
|
||||||
exit 0;
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 11;
|
use Test::More tests => 8;
|
||||||
|
|
||||||
# Create the rc file.
|
# Create the rc file.
|
||||||
if (open my $fh, '>', 'log.rc')
|
if (open my $fh, '>', 'log.rc')
|
||||||
|
@ -41,11 +41,8 @@ if (open my $fh, '>', 'log.rc')
|
||||||
|
|
||||||
# Test the log command.
|
# Test the log command.
|
||||||
qx{../src/task rc:log.rc log This is a test};
|
qx{../src/task rc:log.rc log This is a test};
|
||||||
my $output = qx{../src/task rc:log.rc info 1};
|
my $output = qx{../src/task rc:log.rc completed};
|
||||||
like ($output, qr/ID\s+1\n/, 'log ID');
|
like ($output, qr/This is a test/, 'log description');
|
||||||
like ($output, qr/Description\s+This is a test\n/, 'log ID');
|
|
||||||
like ($output, qr/Status\s+Completed\n/, 'log Completed');
|
|
||||||
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/, 'log UUID');
|
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink 'pending.data';
|
unlink 'pending.data';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue