mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Unit Tests
- Removed useless setup/teardown tests, improving the signal to noise ratio.
This commit is contained in:
parent
307ea1c857
commit
f85ff7bde1
8 changed files with 8 additions and 64 deletions
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 10;
|
use Test::More tests => 8;
|
||||||
|
|
||||||
# Ensure environment has no influence.
|
# Ensure environment has no influence.
|
||||||
delete $ENV{'TASKDATA'};
|
delete $ENV{'TASKDATA'};
|
||||||
|
@ -38,7 +38,6 @@ if (open my $fh, '>', 'sp.rc')
|
||||||
{
|
{
|
||||||
print $fh "data.location=.\n";
|
print $fh "data.location=.\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'sp.rc', 'Created sp.rc');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
my $setup = "../src/task rc:sp.rc add project:abc abc 2>&1;"
|
my $setup = "../src/task rc:sp.rc add project:abc abc 2>&1;"
|
||||||
|
@ -67,11 +66,5 @@ like ($output, qr/No matches\./, 'abc,ab,a,b | abcd -> nul');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data sp.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data sp.rc);
|
||||||
ok (! -r 'pending.data' &&
|
|
||||||
! -r 'completed.data' &&
|
|
||||||
! -r 'undo.data' &&
|
|
||||||
! -r 'backlog.data' &&
|
|
||||||
! -r 'sp.rc', 'Cleanup');
|
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 9;
|
use Test::More tests => 7;
|
||||||
|
|
||||||
# Ensure environment has no influence.
|
# Ensure environment has no influence.
|
||||||
delete $ENV{'TASKDATA'};
|
delete $ENV{'TASKDATA'};
|
||||||
|
@ -39,7 +39,6 @@ if (open my $fh, '>', 'subst.rc')
|
||||||
print $fh "data.location=.\n",
|
print $fh "data.location=.\n",
|
||||||
"regex=off\n";
|
"regex=off\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'subst.rc', 'Created subst.rc');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Test the substitution command.
|
# Test the substitution command.
|
||||||
|
@ -79,11 +78,5 @@ like ($output, qr/aaa CcC/, 'regex');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data subst.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data subst.rc);
|
||||||
ok (! -r 'pending.data' &&
|
|
||||||
! -r 'completed.data' &&
|
|
||||||
! -r 'undo.data' &&
|
|
||||||
! -r 'backlog.data' &&
|
|
||||||
! -r 'subst.rc', 'Cleanup');
|
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 8;
|
use Test::More tests => 6;
|
||||||
|
|
||||||
# Ensure environment has no influence.
|
# Ensure environment has no influence.
|
||||||
delete $ENV{'TASKDATA'};
|
delete $ENV{'TASKDATA'};
|
||||||
|
@ -38,7 +38,6 @@ if (open my $fh, '>', 'tag.rc')
|
||||||
{
|
{
|
||||||
print $fh "data.location=.\n";
|
print $fh "data.location=.\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'tag.rc', 'Created tag.rc');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add task with tags.
|
# Add task with tags.
|
||||||
|
@ -67,11 +66,5 @@ unlike ($output, qr/^Tags/m, '-missing NOP');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data tag.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data tag.rc);
|
||||||
ok (! -r 'pending.data' &&
|
|
||||||
! -r 'completed.data' &&
|
|
||||||
! -r 'undo.data' &&
|
|
||||||
! -r 'backlog.data' &&
|
|
||||||
! -r 'tag.rc', 'Cleanup');
|
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 6;
|
use Test::More tests => 4;
|
||||||
|
|
||||||
# Ensure environment has no influence.
|
# Ensure environment has no influence.
|
||||||
delete $ENV{'TASKDATA'};
|
delete $ENV{'TASKDATA'};
|
||||||
|
@ -38,7 +38,6 @@ if (open my $fh, '>', 'time.rc')
|
||||||
{
|
{
|
||||||
print $fh "data.location=.\n";
|
print $fh "data.location=.\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'time.rc', 'Created time.rc');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Create some tasks that were started/finished in different weeks, then verify
|
# Create some tasks that were started/finished in different weeks, then verify
|
||||||
|
@ -86,11 +85,5 @@ like ($output, qr/Completed.+C0.+Started.+PS0.+Completed.+C1.+Started.+PS1.+Comp
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data time.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data time.rc);
|
||||||
ok (! -r 'pending.data' &&
|
|
||||||
! -r 'completed.data' &&
|
|
||||||
! -r 'undo.data' &&
|
|
||||||
! -r 'backlog.data' &&
|
|
||||||
! -r 'time.rc', 'Cleanup');
|
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 32;
|
use Test::More tests => 30;
|
||||||
|
|
||||||
# Ensure environment has no influence.
|
# Ensure environment has no influence.
|
||||||
delete $ENV{'TASKDATA'};
|
delete $ENV{'TASKDATA'};
|
||||||
|
@ -67,7 +67,6 @@ if (open my $fh, '>', 'urgency.rc')
|
||||||
"confirmation=off\n";
|
"confirmation=off\n";
|
||||||
|
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'urgency.rc', 'Created urgency.rc');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add a task, and verify that the individual urgency terms are being correctly
|
# Add a task, and verify that the individual urgency terms are being correctly
|
||||||
|
@ -340,10 +339,4 @@ like ($output, qr/Urgency 0\.01$/ms, 'near-zero urgency is truncated');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data urgency.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data urgency.rc);
|
||||||
ok (! -r 'pending.data' &&
|
|
||||||
! -r 'completed.data' &&
|
|
||||||
! -r 'undo.data' &&
|
|
||||||
! -r 'backlog.data' &&
|
|
||||||
! -r 'urgency.rc', 'Cleanup');
|
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 5;
|
use Test::More tests => 3;
|
||||||
|
|
||||||
# Ensure environment has no influence.
|
# Ensure environment has no influence.
|
||||||
delete $ENV{'TASKDATA'};
|
delete $ENV{'TASKDATA'};
|
||||||
|
@ -38,7 +38,6 @@ if (open my $fh, '>', 'utf8.rc')
|
||||||
{
|
{
|
||||||
print $fh "data.location=.\n";
|
print $fh "data.location=.\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'utf8.rc', 'Created utf8.rc');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add a task with UTF8 in the description.
|
# Add a task with UTF8 in the description.
|
||||||
|
@ -74,11 +73,5 @@ like ($output, qr/utf8 in tag/, 'utf8 in tag works');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data utf8.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data utf8.rc);
|
||||||
ok (! -r 'pending.data' &&
|
|
||||||
! -r 'completed.data' &&
|
|
||||||
! -r 'undo.data' &&
|
|
||||||
! -r 'backlog.data' &&
|
|
||||||
! -r 'utf8.rc', 'Cleanup');
|
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 8;
|
use Test::More tests => 6;
|
||||||
|
|
||||||
# Ensure environment has no influence.
|
# Ensure environment has no influence.
|
||||||
delete $ENV{'TASKDATA'};
|
delete $ENV{'TASKDATA'};
|
||||||
|
@ -39,7 +39,6 @@ if (open my $fh, '>', 'verbose.rc')
|
||||||
print $fh "data.location=.\n",
|
print $fh "data.location=.\n",
|
||||||
"print.empty.columns=yes\n";
|
"print.empty.columns=yes\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'verbose.rc', 'Created verbose.rc');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Verbosity: 'new-id'
|
# Verbosity: 'new-id'
|
||||||
|
@ -70,11 +69,5 @@ unlike ($output, qr/ID.+Project.+Pri.+Description/, '\'label\' verbosity good');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data verbose.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data verbose.rc);
|
||||||
ok (! -r 'pending.data' &&
|
|
||||||
! -r 'completed.data' &&
|
|
||||||
! -r 'undo.data' &&
|
|
||||||
! -r 'backlog.data' &&
|
|
||||||
! -r 'verbose.rc', 'Cleanup');
|
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 13;
|
use Test::More tests => 11;
|
||||||
|
|
||||||
# Ensure environment has no influence.
|
# Ensure environment has no influence.
|
||||||
delete $ENV{'TASKDATA'};
|
delete $ENV{'TASKDATA'};
|
||||||
|
@ -44,7 +44,6 @@ if (open my $fh, '>', 'wait.rc')
|
||||||
"confirmation=off\n";
|
"confirmation=off\n";
|
||||||
|
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'wait.rc', 'Created wait.rc');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add a waiting task, check it is not there, wait, then check it is.
|
# Add a waiting task, check it is not there, wait, then check it is.
|
||||||
|
@ -86,10 +85,4 @@ like ($output, qr/Warning: You have specified that the 'wait' date is after the
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data wait.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data wait.rc);
|
||||||
ok (! -r 'pending.data' &&
|
|
||||||
! -r 'completed.data' &&
|
|
||||||
! -r 'undo.data' &&
|
|
||||||
! -r 'backlog.data' &&
|
|
||||||
! -r 'wait.rc', 'Cleanup');
|
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue