mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Unit Tests
- Removed useless setup/teardown tests, improving the signal to noise ratio.
This commit is contained in:
parent
102792e425
commit
a59f8644f1
8 changed files with 8 additions and 69 deletions
|
@ -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'};
|
||||||
|
@ -46,7 +46,6 @@ if (open my $fh, '>', 'uda.rc')
|
||||||
"report.uda.labels=ID,Extra,Description\n",
|
"report.uda.labels=ID,Extra,Description\n",
|
||||||
"dateformat=m/d/Y\n";
|
"dateformat=m/d/Y\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'uda.rc', 'Created uda.rc');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add tasks with and without the UDA.
|
# Add tasks with and without the UDA.
|
||||||
|
@ -62,11 +61,5 @@ unlike ($output, qr/Created task \d+/, 'UDA date bad data not accepted');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data uda.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data uda.rc);
|
||||||
ok (! -r 'pending.data' &&
|
|
||||||
! -r 'completed.data' &&
|
|
||||||
! -r 'undo.data' &&
|
|
||||||
! -r 'backlog.data' &&
|
|
||||||
! -r 'uda.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'};
|
||||||
|
@ -49,7 +49,6 @@ if (open my $fh, '>', 'uda.rc')
|
||||||
"report.uda.sort=id\n",
|
"report.uda.sort=id\n",
|
||||||
"report.uda.labels=ID,Smell,Size,Description\n";
|
"report.uda.labels=ID,Smell,Size,Description\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'uda.rc', 'Created uda.rc');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add task with nondefault UDA
|
# Add task with nondefault UDA
|
||||||
|
@ -69,14 +68,7 @@ like ($output, qr/1\s+strong\s+one/, 'UDA nondefault stored');
|
||||||
like ($output, qr/2\s+weak\s+two/, 'UDA default stored');
|
like ($output, qr/2\s+weak\s+two/, 'UDA default stored');
|
||||||
like ($output, qr/3\s+weak\s+10\s+three/, 'UDA without default stored');
|
like ($output, qr/3\s+weak\s+10\s+three/, 'UDA without default stored');
|
||||||
|
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data uda.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data uda.rc);
|
||||||
ok (! -r 'pending.data' &&
|
|
||||||
! -r 'completed.data' &&
|
|
||||||
! -r 'undo.data' &&
|
|
||||||
! -r 'backlog.data' &&
|
|
||||||
! -r 'uda.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'};
|
||||||
|
@ -45,7 +45,6 @@ if (open my $fh, '>', 'uda.rc')
|
||||||
"report.uda.sort=extra,description\n",
|
"report.uda.sort=extra,description\n",
|
||||||
"report.uda.labels=ID,Extra,Description\n";
|
"report.uda.labels=ID,Extra,Description\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'uda.rc', 'Created uda.rc');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add tasks with and without the UDA.
|
# Add tasks with and without the UDA.
|
||||||
|
@ -65,11 +64,5 @@ unlike ($output, qr/Created task \d+/, 'UDA duration bad data not accepted');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data uda.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data uda.rc);
|
||||||
ok (! -r 'pending.data' &&
|
|
||||||
! -r 'completed.data' &&
|
|
||||||
! -r 'undo.data' &&
|
|
||||||
! -r 'backlog.data' &&
|
|
||||||
! -r 'uda.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'};
|
||||||
|
@ -45,7 +45,6 @@ if (open my $fh, '>', 'uda.rc')
|
||||||
"report.uda.sort=extra,description\n",
|
"report.uda.sort=extra,description\n",
|
||||||
"report.uda.labels=ID,Extra,Description\n";
|
"report.uda.labels=ID,Extra,Description\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'uda.rc', 'Created uda.rc');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add tasks with and without the UDA.
|
# Add tasks with and without the UDA.
|
||||||
|
@ -61,11 +60,5 @@ unlike ($output, qr/Created task \d+/, 'UDA numeric bad data not accepted');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data uda.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data uda.rc);
|
||||||
ok (! -r 'pending.data' &&
|
|
||||||
! -r 'completed.data' &&
|
|
||||||
! -r 'undo.data' &&
|
|
||||||
! -r 'backlog.data' &&
|
|
||||||
! -r 'uda.rc', 'Cleanup');
|
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 10;
|
use Test::More tests => 6;
|
||||||
|
|
||||||
# Ensure environment has no influence.
|
# Ensure environment has no influence.
|
||||||
delete $ENV{'TASKDATA'};
|
delete $ENV{'TASKDATA'};
|
||||||
|
@ -41,7 +41,6 @@ if (open my $fh, '>', 'uda.rc')
|
||||||
"uda.extra.type=string\n",
|
"uda.extra.type=string\n",
|
||||||
"uda.extra.label=Extra\n";
|
"uda.extra.label=Extra\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'uda.rc', 'Created uda.rc');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add a task with a defined UDA.
|
# Add a task with a defined UDA.
|
||||||
|
@ -55,7 +54,6 @@ if (open my $fh, '>', 'uda.rc')
|
||||||
print $fh "data.location=.\n",
|
print $fh "data.location=.\n",
|
||||||
"confirmation=off\n";
|
"confirmation=off\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'uda.rc', 'Created uda.rc again');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Observe the UDA properly reported by the 'info' command.
|
# Observe the UDA properly reported by the 'info' command.
|
||||||
|
@ -79,7 +77,6 @@ if (open my $fh, '>', 'import.txt')
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'import.txt', 'Created sample import data');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = qx{../src/task rc:uda.rc import import.txt 2>&1 >/dev/null};
|
$output = qx{../src/task rc:uda.rc import import.txt 2>&1 >/dev/null};
|
||||||
|
@ -89,12 +86,5 @@ like ($output, qr/extra\s+bar/, 'UDA orphan imported and visible');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data uda.rc import.txt);
|
unlink qw(pending.data completed.data undo.data backlog.data uda.rc import.txt);
|
||||||
ok (! -r 'pending.data' &&
|
|
||||||
! -r 'completed.data' &&
|
|
||||||
! -r 'undo.data' &&
|
|
||||||
! -r 'backlog.data' &&
|
|
||||||
! -r 'uda.rc' &&
|
|
||||||
! -r 'import.txt', 'Cleanup');
|
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 4;
|
use Test::More tests => 2;
|
||||||
|
|
||||||
# Ensure environment has no influence.
|
# Ensure environment has no influence.
|
||||||
delete $ENV{'TASKDATA'};
|
delete $ENV{'TASKDATA'};
|
||||||
|
@ -51,7 +51,6 @@ if (open my $fh, '>', 'uda.rc')
|
||||||
"report.bad.labels=ID,Extra2\n",
|
"report.bad.labels=ID,Extra2\n",
|
||||||
"report.bad.sort=ID\n";
|
"report.bad.sort=ID\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'uda.rc', 'Created uda.rc');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add a task with a defined UDA.
|
# Add a task with a defined UDA.
|
||||||
|
@ -67,12 +66,5 @@ like ($output, qr/Unrecognized column name/, 'UDA Orphan causes error');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data uda.rc import.txt);
|
unlink qw(pending.data completed.data undo.data backlog.data uda.rc import.txt);
|
||||||
ok (! -r 'pending.data' &&
|
|
||||||
! -r 'completed.data' &&
|
|
||||||
! -r 'undo.data' &&
|
|
||||||
! -r 'backlog.data' &&
|
|
||||||
! -r 'uda.rc' &&
|
|
||||||
! -r 'import.txt', 'Cleanup');
|
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use Test::More tests => 4;
|
use Test::More tests => 2;
|
||||||
|
|
||||||
# Ensure environment has no influence.
|
# Ensure environment has no influence.
|
||||||
delete $ENV{'TASKDATA'};
|
delete $ENV{'TASKDATA'};
|
||||||
|
@ -45,7 +45,6 @@ if (open my $fh, '>', 'uda.rc')
|
||||||
"report.uda.sort=extra,description\n",
|
"report.uda.sort=extra,description\n",
|
||||||
"report.uda.labels=ID,Extra,Description\n";
|
"report.uda.labels=ID,Extra,Description\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'uda.rc', 'Created uda.rc');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add tasks with and without the UDA.
|
# Add tasks with and without the UDA.
|
||||||
|
@ -57,11 +56,5 @@ like ($output, qr/2\s+without/, 'UDA string blank');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data uda.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data uda.rc);
|
||||||
ok (! -r 'pending.data' &&
|
|
||||||
! -r 'completed.data' &&
|
|
||||||
! -r 'undo.data' &&
|
|
||||||
! -r 'backlog.data' &&
|
|
||||||
! -r 'uda.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'};
|
||||||
|
@ -42,7 +42,6 @@ if (open my $fh, '>', 'uda.rc')
|
||||||
"uda.smell.label=Smell\n",
|
"uda.smell.label=Smell\n",
|
||||||
"uda.smell.values=weak,strong\n";
|
"uda.smell.values=weak,strong\n";
|
||||||
close $fh;
|
close $fh;
|
||||||
ok (-r 'uda.rc', 'Created uda.rc');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add tasks with valid and invalid UDA values.
|
# Add tasks with valid and invalid UDA values.
|
||||||
|
@ -57,11 +56,5 @@ unlike ($output, qr/Created task 3/, 'UDA smell:toxic disallowed');
|
||||||
|
|
||||||
# Cleanup.
|
# Cleanup.
|
||||||
unlink qw(pending.data completed.data undo.data backlog.data uda.rc);
|
unlink qw(pending.data completed.data undo.data backlog.data uda.rc);
|
||||||
ok (! -r 'pending.data' &&
|
|
||||||
! -r 'completed.data' &&
|
|
||||||
! -r 'undo.data' &&
|
|
||||||
! -r 'backlog.data' &&
|
|
||||||
! -r 'uda.rc', 'Cleanup');
|
|
||||||
|
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue