250205.6 · a678e32a27ffdf3adbce246bf59c3df0dfbed9b9
Convert ack-i to YAML
reading declarations
@@ -47,8 +47,7 @@ t/ack-group.t t/ack-h.yaml t/ack-help-types.t t/ack-help.t-t/ack-i.barfly-t/ack-i.t+t/ack-i.yaml t/ack-ignore-dir.t t/ack-ignore-file.t t/ack-k.yaml
@@ -1341,6 +1341,7 @@ sub _validate_test { indent-stdout name ordered+ stdin stderr stdout );
t/ack-i.barfly
@@ -1,140 +0,0 @@-BEGIN No -i, or -I--RUN-ack foo-ack -I foo-ack --no-smart-case foo--YES-football-foo bar--NO-Football-foOtball--END---BEGIN Normal -i--RUN-ack -i foo-ack -i Foo-ack --ignore-case foo-ack --ignore-case Foo--YES-football-foo bar-Football-foOtball--NO--END---BEGIN --smart-case invoked--RUN-ack --smart-case foo-ack -S foo--YES-football-foo bar-Football-foOtball--NO--END---BEGIN --smart-case bypassed--RUN-ack --smart-case Foo-ack -S Foo--YES-Football--NO-football-foo bar-foOtball--END---BEGIN --smart-case overrides -i--RUN-ack -i --smart-case Foo-ack -i -S Foo--YES-Football--NO-football-foo bar-foOtball--END---BEGIN -i overrides --smart-case--RUN-ack --smart-case -i Foo-ack --smart-case -i foo-ack -S -i Foo-ack -S -i foo--YES-Football-football-foo bar-foOtball--NO--END---BEGIN -I overrides -i--RUN-ack -i -I Foo--YES-Football--NO-foOtball-football-foo bar--END---BEGIN -I overrides --smart-case--RUN-ack --smart-case -I Foo-ack -S -I Foo--YES-Football--NO-football-foo bar-foOtball--END--# vi:set ft=barfly:
t/ack-i.t
@@ -1,39 +0,0 @@-#!perl--use strict;-use warnings;-use lib 't';--use Test::More tests => 9;--use Util;-use Barfly;--prep_environment();--Barfly->run_tests( 't/ack-i.barfly' );--subtest 'Straight -i' => sub {- plan tests => 4;-- my @expected = (- 't/swamp/groceries/fruit:1:apple',- 't/swamp/groceries/junk:1:apple fritters',- );-- my @targets = map { "t/swamp/groceries/$_" } qw( fruit junk meat );-- my @args = qw( --nocolor APPLE -i );- my @results = run_ack( @args, @targets );-- lists_match( \@results, \@expected, '-i flag' );-- @args = qw( --nocolor APPLE --ignore-case );- @results = run_ack( @args, @targets );-- lists_match( \@results, \@expected, '--ignore-case flag' );-};--done_testing();--exit 0;
@@ -0,0 +1,125 @@+---+name: Straight -i+args:+ - APPLE t/swamp/groceries/fruit t/swamp/groceries/junk t/swamp/groceries/meat -i+ - APPLE t/swamp/groceries/fruit t/swamp/groceries/junk t/swamp/groceries/meat --ignore-case+ordered: true+stdout: |+ t/swamp/groceries/fruit:1:apple+ t/swamp/groceries/junk:1:apple fritters++---+name: No -i or -I+args:+ - foo+ - foo -I+ - foo --no-smart-case+ordered: true+stdin: |+ Football+ foo bar+ foOtball+ bluhblah+ football+stdout: |+ foo bar+ football++---+name: Normal -i+args:+ - foo -i+ - foo --ignore-case+ - Foo -i+ - Foo --ignore-case+ordered: true+stdin: |+ Football+ foo bar+ pickles+ foOtball+ bluhblah+ football+stdout: |+ Football+ foo bar+ foOtball+ football++---+name: Smartcase invoked+args:+ - foo --smart-case+ - foo -S+ordered: true+stdin: |+ football+ foo bar+ Football+ foOtball+stdout: |+ football+ foo bar+ Football+ foOtball++---+name: Smartcase invoked because of the case of the search string+args:+ - Foo --smart-case+ - Foo -S+ordered: true+stdin: |+ football+ foo bar+ Football+ foOtball+stdout: |+ Football++---+name: -i overrides --smart-case+args:+ - Foo --smart-case -i+ - foo --smart-case -i+ - Foo -S -i+ - foo -S -i+ordered: true+stdin: |+ football+ foo bar+ Football+ foOtball+stdout: |+ football+ foo bar+ Football+ foOtball++---+name: -I overrides -i+args:+ - Foo -i -I+ - Foo --ignore-case -I+ordered: true+stdin: |+ Football+ football+ foo bar+ foOtball+stdout: |+ Football++---+name: -I overrides --smart-case+args:+ - Foo --smart-case -I+ - Foo -S -I+ordered: true+stdin: |+ Football+ football+ foo bar+ foOtball+stdout: |+ Football
@@ -3,7 +3,7 @@ use warnings; use strict; -use Test::More tests => 15;+use Test::More tests => 16; use lib 't'; use Util;@@ -18,7 +18,17 @@ MAIN: { my @tests = read_tests( $file ); for my $test ( @tests ) {+ my $tempfilename;+ if ( my $stdin = $test->{stdin} ) {+ my $fh = File::Temp->new( UNLINK => 0 ); # We'll delete it ourselves.+ $tempfilename = $fh->filename;+ print {$fh} $stdin;+ close $fh;+ } for my $args ( @{$test->{args}} ) {+ if ( $tempfilename ) {+ $args = [ @{$args}, $tempfilename ];+ } subtest $test->{name} . ' ' . join( ', ', @{$args} ) => sub { if ( $test->{ordered} ) { ack_lists_match( $args, $test->{stdout}, $test->{name} );@@ -29,6 +39,9 @@ MAIN: { is( get_rc(), $test->{exitcode} ); } }+ if ( $tempfilename ) {+ unlink( $tempfilename );+ } } }; }