Unit Tests

- Improved the signal-to-noise ratio for the args tests.
This commit is contained in:
Paul Beckingham 2011-09-06 23:22:16 -04:00
parent 0da3e12e36
commit 646117c213
6 changed files with 48 additions and 108 deletions

View file

@ -28,7 +28,7 @@
use strict; use strict;
use warnings; use warnings;
use Test::More tests => 12; use Test::More tests => 7;
# Create the rc file. # Create the rc file.
if (open my $fh, '>', 'args.rc') if (open my $fh, '>', 'args.rc')
@ -55,23 +55,13 @@ $output = qx{../src/task rc:args.rc done 2};
unlike ($output, qr/^Completed 2 /ms, 'ID after COMMAND'); unlike ($output, qr/^Completed 2 /ms, 'ID after COMMAND');
# Cleanup. # Cleanup.
unlink 'pending.data'; unlink qw(pending.data completed.data undo.data backlog.data synch.key args.rc);
ok (!-r 'pending.data', 'Removed pending.data'); ok (! -r 'pending.data' &&
! -r 'completed.data' &&
unlink 'completed.data'; ! -r 'undo.data' &&
ok (!-r 'completed.data', 'Removed completed.data'); ! -r 'backlog.data' &&
! -r 'synch_key.data' &&
unlink 'undo.data'; ! -r 'args.rc', 'Cleanup');
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 'args.rc';
ok (!-r 'args.rc', 'Removed args.rc');
exit 0; exit 0;

View file

@ -28,7 +28,7 @@
use strict; use strict;
use warnings; use warnings;
use Test::More tests => 12; use Test::More tests => 7;
# Create the rc file. # Create the rc file.
if (open my $fh, '>', 'args.rc') if (open my $fh, '>', 'args.rc')
@ -67,23 +67,13 @@ $output = qx{../src/task rc:args.rc 5 info};
like ($output, qr/Project\s+A/, 'done enpassant project'); like ($output, qr/Project\s+A/, 'done enpassant project');
# Cleanup. # Cleanup.
unlink 'pending.data'; unlink qw(pending.data completed.data undo.data backlog.data synch.key args.rc);
ok (!-r 'pending.data', 'Removed pending.data'); ok (! -r 'pending.data' &&
! -r 'completed.data' &&
unlink 'completed.data'; ! -r 'undo.data' &&
ok (!-r 'completed.data', 'Removed completed.data'); ! -r 'backlog.data' &&
! -r 'synch_key.data' &&
unlink 'undo.data'; ! -r 'args.rc', 'Cleanup');
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 'args.rc';
ok (!-r 'args.rc', 'Removed args.rc');
exit 0; exit 0;

View file

@ -28,7 +28,7 @@
use strict; use strict;
use warnings; use warnings;
use Test::More tests => 12; use Test::More tests => 7;
# Create the rc file. # Create the rc file.
if (open my $fh, '>', 'args.rc') if (open my $fh, '>', 'args.rc')
@ -67,23 +67,13 @@ $output = qx{../src/task rc:args.rc 5 info};
like ($output, qr/Project\s+A/, 'delete enpassant project'); like ($output, qr/Project\s+A/, 'delete enpassant project');
# Cleanup. # Cleanup.
unlink 'pending.data'; unlink qw(pending.data completed.data undo.data backlog.data synch.key args.rc);
ok (!-r 'pending.data', 'Removed pending.data'); ok (! -r 'pending.data' &&
! -r 'completed.data' &&
unlink 'completed.data'; ! -r 'undo.data' &&
ok (!-r 'completed.data', 'Removed completed.data'); ! -r 'backlog.data' &&
! -r 'synch_key.data' &&
unlink 'undo.data'; ! -r 'args.rc', 'Cleanup');
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 'args.rc';
ok (!-r 'args.rc', 'Removed args.rc');
exit 0; exit 0;

View file

@ -28,7 +28,7 @@
use strict; use strict;
use warnings; use warnings;
use Test::More tests => 12; use Test::More tests => 7;
# Create the rc file. # Create the rc file.
if (open my $fh, '>', 'args.rc') if (open my $fh, '>', 'args.rc')
@ -67,23 +67,13 @@ $output = qx{../src/task rc:args.rc 5 info};
like ($output, qr/Project\s+A/, 'start enpassant project'); like ($output, qr/Project\s+A/, 'start enpassant project');
# Cleanup. # Cleanup.
unlink 'pending.data'; unlink qw(pending.data completed.data undo.data backlog.data synch.key args.rc);
ok (!-r 'pending.data', 'Removed pending.data'); ok (! -r 'pending.data' &&
! -r 'completed.data' &&
unlink 'completed.data'; ! -r 'undo.data' &&
ok (!-r 'completed.data', 'Removed completed.data'); ! -r 'backlog.data' &&
! -r 'synch_key.data' &&
unlink 'undo.data'; ! -r 'args.rc', 'Cleanup');
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 'args.rc';
ok (!-r 'args.rc', 'Removed args.rc');
exit 0; exit 0;

View file

@ -28,7 +28,7 @@
use strict; use strict;
use warnings; use warnings;
use Test::More tests => 12; use Test::More tests => 7;
# Create the rc file. # Create the rc file.
if (open my $fh, '>', 'args.rc') if (open my $fh, '>', 'args.rc')
@ -73,23 +73,13 @@ $output = qx{../src/task rc:args.rc 5 info};
like ($output, qr/Project\s+A/, 'stop enpassant project'); like ($output, qr/Project\s+A/, 'stop enpassant project');
# Cleanup. # Cleanup.
unlink 'pending.data'; unlink qw(pending.data completed.data undo.data backlog.data synch.key args.rc);
ok (!-r 'pending.data', 'Removed pending.data'); ok (! -r 'pending.data' &&
! -r 'completed.data' &&
unlink 'completed.data'; ! -r 'undo.data' &&
ok (!-r 'completed.data', 'Removed completed.data'); ! -r 'backlog.data' &&
! -r 'synch_key.data' &&
unlink 'undo.data'; ! -r 'args.rc', 'Cleanup');
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 'args.rc';
ok (!-r 'args.rc', 'Removed args.rc');
exit 0; exit 0;

View file

@ -28,7 +28,7 @@
use strict; use strict;
use warnings; use warnings;
use Test::More tests => 12; use Test::More tests => 7;
# Create the rc file. # Create the rc file.
if (open my $fh, '>', 'args.rc') if (open my $fh, '>', 'args.rc')
@ -61,23 +61,13 @@ $output = qx{../src/task rc:args.rc info 1};
like ($output, qr/Description\s+project:p\spri:H\s\+tag\sfoo\n/ms, 'task 1 modify -- project:p pri:H +tag foo'); like ($output, qr/Description\s+project:p\spri:H\s\+tag\sfoo\n/ms, 'task 1 modify -- project:p pri:H +tag foo');
# Cleanup. # Cleanup.
unlink 'pending.data'; unlink qw(pending.data completed.data undo.data backlog.data synch.key args.rc);
ok (!-r 'pending.data', 'Removed pending.data'); ok (! -r 'pending.data' &&
! -r 'completed.data' &&
unlink 'completed.data'; ! -r 'undo.data' &&
ok (!-r 'completed.data', 'Removed completed.data'); ! -r 'backlog.data' &&
! -r 'synch_key.data' &&
unlink 'undo.data'; ! -r 'args.rc', 'Cleanup');
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 'args.rc';
ok (!-r 'args.rc', 'Removed args.rc');
exit 0; exit 0;