2 # Copyright (C) 2009, Parrot Foundation.
7 t/tools/pgegrep.t - test the script tools/utils/pgegrep
11 % prove t/tools/pgegrep.t
15 Tests the features of of the C<pgegrep> utility.
21 use lib qw( . lib ../lib ../../lib );
23 use Fatal qw{open close};
25 use Parrot::Test tests => 10;
29 my $testdata = File::Spec->catfile(qw{. t tools testdata });
30 my $testdata_escaped = $testdata;
31 $testdata_escaped =~ s!\\!\\\\!g;
33 sub pgegrep_output_like {
34 my ($options, $snippet, $desc) = @_;
36 my $PARROT = ".$PConfig{slash}$PConfig{test_prog}";
37 my $pgegrep = File::Spec->catfile( qw{. tools util pgegrep} );
38 my $out = `$PARROT $pgegrep $options`;
40 like( $out, $snippet, $desc );
47 qr!\Qpgegrep v0.0.1\E!,
48 'pge reports correct version'
54 'basic sanity of matching a literal'
60 'matching a literal with line number'
64 "--line-number cat $testdata",
66 'matching a literal with line number with long option'
71 qr!$testdata_escaped:keyboardcat!,
72 'matching a literal with file name'
76 "--with-filename cat $testdata",
77 qr!$testdata_escaped:keyboardcat!,
78 'matching a literal with file name with long option'
85 'test inversion of match'
89 "--invert-match cat $testdata",
91 'test inversion of match with long option'
96 qr!$testdata_escaped!,
97 'find files that match'
101 "--files-with-matches cat $testdata",
102 qr!$testdata_escaped!,
103 'find files that match with long option'
108 # cperl-indent-level: 4
111 # vim: expandtab shiftwidth=4: