Unit Tests

- More robust tests strategy: captured outputs are always compared to some
  expected result.
- Clearer and more consistent test.

Signed-off-by: Paul Beckingham <paul@beckingham.net>
This commit is contained in:
Louis-Claude Canon
2013-01-19 12:38:25 -05:00
committed by Paul Beckingham
parent ee7fd7add0
commit a0d6b3198e
16 changed files with 67 additions and 35 deletions

View File

@@ -28,7 +28,7 @@
use strict;
use warnings;
use Test::More tests => 5;
use Test::More tests => 7;
# Create the rc file.
if (open my $fh, '>', 'bug.rc')
@@ -45,9 +45,11 @@ my $output = qx{../src/task rc:bug.rc _aliases 2>&1};
like ($output, qr/samplealias/, 'aliases are listed in _aliases');
$output = qx{../src/task rc:bug.rc _commands 2>&1};
like ($output, qr/^information$/m, 'info is listed in _commands');
unlike ($output, qr/samplealias/, 'aliases are not listed in _commands');
$output = qx{../src/task rc:bug.rc _zshcommands 2>&1};
like ($output, qr/^information:/m, 'info is listed in _zshcommands');
unlike ($output, qr/samplealias/, 'aliases are not listed in _zshcommands');
# Cleanup.