Skip to content

Commit

Permalink
t/run/options: test -V and -h
Browse files Browse the repository at this point in the history
Run the tests for --version and --help again.
  • Loading branch information
Benabik committed Jan 28, 2012
1 parent 7ef799e commit f83019f
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions t/run/options.t
Expand Up @@ -19,17 +19,19 @@ use strict;
use warnings;
use lib qw( lib . ../lib ../../lib );

use Test::More tests => 35;
use Test::More tests => 38;
use Parrot::Config;
use File::Temp 0.13 qw/tempfile/;
use File::Spec;

my $PARROT = ".$PConfig{slash}$PConfig{test_prog}";

# looking at the help message
my $help_message = `$PARROT --help`;
is( substr( $help_message, 0, 23 ), 'parrot [Options] <file>', 'Start of help message' );
ok( index( $help_message, '-t --trace [flags]' ) > 0, 'help for --trace' );
for my $help ('-h', '--help') {
my $help_message = `$PARROT $help`;
is( substr( $help_message, 0, 23 ), 'parrot [Options] <file>', "Start of $help message" );
ok( index( $help_message, '-t --trace [flags]' ) > 0, '$help for --trace' );
}

# setup PIR files for tests below
my $first_pir_file = create_pir_file('first');
Expand Down Expand Up @@ -145,13 +147,12 @@ open(my $version_fh, "<", "VERSION") or die "couldn't open VERSION: $!";
my $file_version = <$version_fh>;
chomp($file_version);
close($version_fh);
like( qx{$PARROT --version}, qr/.*${file_version}.*/, "VERSION matches --version" );
for my $version ('-V', '--version') {
like( qx{$PARROT $version}, qr/.*${file_version}.*/, "VERSION matches $version" );
}

## GH #346 test remaining options

# TODO: Add tests for short options
# -h --help
# -V --version
# TODO: Add tests for long options
# -D --parrot-debug
# TODO: Add tests for attached options
Expand Down

0 comments on commit f83019f

Please sign in to comment.