241207.1 · eb723d188ce835d78bc3d644e16c77f65851c2d2
bust out the regex_eq
reading declarations
@@ -29,6 +29,8 @@ our @EXPORT = qw( is_empty_array is_nonempty_array + regex_eq+ first_line_like build_ack_invocation adjust_executable@@ -1232,4 +1234,25 @@ sub adjust_executable { } +sub regex_eq {+ local $Test::Builder::Level = $Test::Builder::Level + 1;++ my $got = shift;+ my $exp = shift;+ my $msg = shift;++ if ( "$]" ge '5.014' ) {+ # Passed in expressions are in Perl 5.10 format. If we are running newer+ # than that, convert the expected string representations.+ for my $re ( $got, $exp ) {+ if ( defined($re) ) {+ $re =~ s/^\(\?([xism]*)-[xism]*:/(?^$1:/;+ }+ }+ }++ return is( $got, $exp, $msg );+}++ 1;
@@ -7,6 +7,9 @@ use Test::More tests => 12; use App::Ack; +use lib 't';+use Util;+ # Note: All of the expected strings have to be in the format before Perl 5.14. # The _check() function does the transformation.@@ -135,17 +138,7 @@ sub _check { my ($match, $scan) = App::Ack::build_regex( $str, $opt ); - if ( "$]" ge '5.014' ) {- # Passed in expressions are in Perl 5.10 format. If we are running newer- # than that, convert the expected string representations.- for my $re ( $exp_match, $exp_scan ) {- if ( defined($re) ) {- $re =~ s/^\(\?([xism]*)-[xism]*:/(?^$1:/;- }- }- }-- is( $match, $exp_match, 'match matches' );- is( $scan, $exp_scan, 'scan matches' );+ regex_eq( $match, $exp_match, 'match matches' );+ regex_eq( $scan, $exp_scan, 'scan matches' ); }; }