@ 11d698f

250205.3 · c147822fed260752d7075869de6f75f9fd86972f

Convert ack-m to YAML

reading declarations

MANIFEST

@@ -53,7 +53,7 @@ t/ack-ignore-dir.t t/ack-ignore-file.t t/ack-k.yaml t/ack-l.yaml-t/ack-m.t+t/ack-m.yaml t/ack-man.t t/ack-match.t t/ack-n.t

t/ack-m.t

deleted file mode 100644@@ -1,53 +0,0 @@-#!perl--use strict;-use warnings;--use Test::More tests => 2;--use lib 't';-use Util;--prep_environment();--subtest 'Basic -m' => sub {-    plan tests => 2;--    my @text = sort map { untaint($_) } glob( 't/text/[bc]*.txt' );--    my $bill_ = reslash( 't/text/bill-of-rights.txt' );-    my $const = reslash( 't/text/constitution.txt' );--    my @expected = split( /\n/, <<"HERE" );-$bill_:4:or prohibiting the free exercise thereof; or abridging the freedom of-$bill_:5:speech, or of the press; or the right of the people peaceably to assemble,-$bill_:6:and to petition the Government for a redress of grievances.-$const:3:We the People of the United States, in Order to form a more perfect-$const:4:Union, establish Justice, insure domestic Tranquility, provide for the-$const:5:common defense, promote the general Welfare, and secure the Blessings-HERE--    ack_lists_match( [ '-m', 3, '-w', 'the', @text ], \@expected, 'Should show only 3 lines per file' );--    @expected = split( /\n/, <<"HERE" );-$bill_:4:or prohibiting the free exercise thereof; or abridging the freedom of-HERE--ack_lists_match( [ '-1', '-w', 'the', @text ], \@expected, 'We should only get one line back for the entire run, not just per file.' );-};---subtest '-m with -L' => sub {-    plan tests => 2;--    my @files    = reslash( 't/text' );-    my @args     = ( '-m', 3, '-l', '--sort-files', 'the' );-    my @results  = run_ack( @args, @files );-    my @expected = map { reslash( "t/text/$_" ) } qw( amontillado.txt bill-of-rights.txt constitution.txt );--    is_deeply(\@results, \@expected);-};--done_testing();--exit 0;

t/ack-m.yaml

new file mode 100644@@ -0,0 +1,24 @@+---+name: -m+args: -m 3 -w the t/text/bill-of-rights.txt t/text/constitution.txt+stdout: |+  t/text/bill-of-rights.txt:4:or prohibiting the free exercise thereof; or abridging the freedom of+  t/text/bill-of-rights.txt:5:speech, or of the press; or the right of the people peaceably to assemble,+  t/text/bill-of-rights.txt:6:and to petition the Government for a redress of grievances.+  t/text/constitution.txt:3:We the People of the United States, in Order to form a more perfect+  t/text/constitution.txt:4:Union, establish Justice, insure domestic Tranquility, provide for the+  t/text/constitution.txt:5:common defense, promote the general Welfare, and secure the Blessings++---+name: -1+args: -1 -w the t/text/bill-of-rights.txt t/text/constitution.txt+stdout: |+  t/text/bill-of-rights.txt:4:or prohibiting the free exercise thereof; or abridging the freedom of++---+name: -m with -l+args: -m 3 -l -w --sort the t/text/+stdout: |+  t/text/amontillado.txt+  t/text/bill-of-rights.txt+  t/text/constitution.txt

t/yaml.t

@@ -3,7 +3,7 @@ use warnings; use strict; -use Test::More tests => 12;+use Test::More tests => 13;  use lib 't'; use Util;@@ -19,7 +19,7 @@ MAIN: {              for my $test ( @tests ) {                 for my $args ( @{$test->{args}} ) {-                    subtest $file . ' ' . join( ', ', @{$args} ) => sub {+                    subtest $test->{name} . ' ' . join( ', ', @{$args} ) => sub {                         if ( $test->{ordered} ) {                             ack_lists_match( $args, $test->{stdout}, $test->{name} );                         }