mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Unit Tests
- Removed obsolete tests.
This commit is contained in:
parent
39da3d68ca
commit
f7a68df299
1 changed files with 44 additions and 40 deletions
|
@ -28,16 +28,21 @@
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Time::Local;
|
use Time::Local;
|
||||||
use Test::More tests => 35;
|
use Test::More tests => 34;
|
||||||
|
|
||||||
# Ensure environment has no influence.
|
# Ensure environment has no influence.
|
||||||
delete $ENV{'TASKDATA'};
|
delete $ENV{'TASKDATA'};
|
||||||
delete $ENV{'TASKRC'};
|
delete $ENV{'TASKRC'};
|
||||||
|
|
||||||
|
use File::Basename;
|
||||||
|
my $ut = basename ($0);
|
||||||
|
my $rc = $ut . '.rc';
|
||||||
|
|
||||||
# Create the rc file.
|
# Create the rc file.
|
||||||
if (open my $fh, '>', 'bug.rc')
|
if (open my $fh, '>', $rc)
|
||||||
{
|
{
|
||||||
print $fh "data.location=.\n";
|
print $fh "data.location=.\n",
|
||||||
|
"confirmation=off\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,148 +59,147 @@ if (open my $fh, '>', 'pending.data')
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'pending.data', 'Created pending.data');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my $output = qx{../src/task rc:bug.rc 1 info 2>&1};
|
my $output = qx{../src/task rc:$rc 1 info 2>&1};
|
||||||
my ($uuid) = $output =~ /UUID\s+(\S{36})/ms;
|
my ($uuid) = $output =~ /UUID\s+(\S{36})/ms;
|
||||||
|
|
||||||
$output = qx{../src/task rc:bug.rc $uuid list 2>&1};
|
$output = qx{../src/task rc:$rc $uuid list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $uuid");
|
like ($output, qr/one/, "Found with $uuid");
|
||||||
|
|
||||||
my ($short) = $uuid =~ /^(.{35})/;
|
my ($short) = $uuid =~ /^(.{35})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{34})/;
|
($short) = $uuid =~ /^(.{34})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{33})/;
|
($short) = $uuid =~ /^(.{33})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{32})/;
|
($short) = $uuid =~ /^(.{32})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{31})/;
|
($short) = $uuid =~ /^(.{31})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{30})/;
|
($short) = $uuid =~ /^(.{30})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{29})/;
|
($short) = $uuid =~ /^(.{29})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{28})/;
|
($short) = $uuid =~ /^(.{28})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{27})/;
|
($short) = $uuid =~ /^(.{27})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{26})/;
|
($short) = $uuid =~ /^(.{26})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{25})/;
|
($short) = $uuid =~ /^(.{25})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{24})/;
|
($short) = $uuid =~ /^(.{24})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{23})/;
|
($short) = $uuid =~ /^(.{23})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{22})/;
|
($short) = $uuid =~ /^(.{22})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{21})/;
|
($short) = $uuid =~ /^(.{21})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{20})/;
|
($short) = $uuid =~ /^(.{20})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{19})/;
|
($short) = $uuid =~ /^(.{19})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{18})/;
|
($short) = $uuid =~ /^(.{18})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{17})/;
|
($short) = $uuid =~ /^(.{17})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{16})/;
|
($short) = $uuid =~ /^(.{16})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{15})/;
|
($short) = $uuid =~ /^(.{15})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{14})/;
|
($short) = $uuid =~ /^(.{14})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
like ($output, qr/one/, "Found with $short");
|
like ($output, qr/one/, "Found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{13})/;
|
($short) = $uuid =~ /^(.{13})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
unlike ($output, qr/one/, "Not found with $short");
|
unlike ($output, qr/one/, "Not found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{12})/;
|
($short) = $uuid =~ /^(.{12})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
unlike ($output, qr/one/, "Not found with $short");
|
unlike ($output, qr/one/, "Not found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{11})/;
|
($short) = $uuid =~ /^(.{11})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
unlike ($output, qr/one/, "Not found with $short");
|
unlike ($output, qr/one/, "Not found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{10})/;
|
($short) = $uuid =~ /^(.{10})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
unlike ($output, qr/one/, "Not found with $short");
|
unlike ($output, qr/one/, "Not found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{9})/;
|
($short) = $uuid =~ /^(.{9})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
unlike ($output, qr/one/, "Not found with $short");
|
unlike ($output, qr/one/, "Not found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{8})/;
|
($short) = $uuid =~ /^(.{8})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
unlike ($output, qr/one/, "Not found with $short");
|
unlike ($output, qr/one/, "Not found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{7})/;
|
($short) = $uuid =~ /^(.{7})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
unlike ($output, qr/one/, "Not found with $short");
|
unlike ($output, qr/one/, "Not found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{6})/;
|
($short) = $uuid =~ /^(.{6})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
unlike ($output, qr/one/, "Not found with $short");
|
unlike ($output, qr/one/, "Not found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{5})/;
|
($short) = $uuid =~ /^(.{5})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
unlike ($output, qr/one/, "Not found with $short");
|
unlike ($output, qr/one/, "Not found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{4})/;
|
($short) = $uuid =~ /^(.{4})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
unlike ($output, qr/one/, "Not found with $short");
|
unlike ($output, qr/one/, "Not found with $short");
|
||||||
|
|
||||||
($short) = $uuid =~ /^(.{3})/;
|
($short) = $uuid =~ /^(.{3})/;
|
||||||
$output = qx{../src/task rc:bug.rc $short list 2>&1};
|
$output = qx{../src/task rc:$rc $short list 2>&1};
|
||||||
unlike ($output, qr/one/, "Not found with $short");
|
unlike ($output, qr/one/, "Not found with $short");
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data bug.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data), $rc;
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue