| 1 | #! perl |
| 2 | # Copyright (C) 2009, Parrot Foundation. |
| 3 | =head1 NAME |
| 4 | |
| 5 | t/tools/pgegrep.t - test the script tools/utils/pgegrep |
| 6 | |
| 7 | =head1 SYNOPSIS |
| 8 | |
| 9 | % prove t/tools/pgegrep.t |
| 10 | |
| 11 | =head1 DESCRIPTION |
| 12 | |
| 13 | Tests the features of of the C<pgegrep> utility. |
| 14 | |
| 15 | =cut |
| 16 | |
| 17 | use strict; |
| 18 | use warnings; |
| 19 | use lib qw( . lib ../lib ../../lib ); |
| 20 | |
| 21 | use Fatal qw{open close}; |
| 22 | use Test::More; |
| 23 | use Parrot::Test tests => 1; |
| 24 | use Parrot::Config; |
| 25 | use File::Spec (); |
| 26 | |
| 27 | sub pgegrep_output_like { |
| 28 | my ($options, $snippet, $desc) = @_; |
| 29 | |
| 30 | my $PARROT = ".$PConfig{slash}$PConfig{test_prog}"; |
| 31 | my $pgegrep = File::Spec->catfile( qw{. tools util pgegrep} ); |
| 32 | my $out = `$PARROT $pgegrep $options`; |
| 33 | |
| 34 | like( $out, $snippet, $desc ); |
| 35 | |
| 36 | return; |
| 37 | } |
| 38 | |
| 39 | pgegrep_output_like( |
| 40 | '-V', |
| 41 | qr!\Qpgegrep v0.0.1\E!, |
| 42 | 'pge reports correct version' |
| 43 | ); |
| 44 | |
| 45 | # Local Variables: |
| 46 | # mode: cperl |
| 47 | # cperl-indent-level: 4 |
| 48 | # fill-column: 100 |
| 49 | # End: |
| 50 | # vim: expandtab shiftwidth=4: |