Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added tests for STDIN, and fix the STDIN reading along the way
- Loading branch information
Showing
8 changed files
with
94 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package main; | ||
|
||
use File::Next; | ||
|
||
sub slurp { | ||
my $iter = shift; | ||
my @files; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ t/pod-coverage.t | |
t/pod.t | ||
t/process-substitution.t | ||
t/sort.t | ||
t/swamp/perl-test.t | ||
t/zero.t |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!perl | ||
|
||
use strict; | ||
use warnings; | ||
use Test::More tests => 2; | ||
|
||
use lib 't'; | ||
use Util; | ||
|
||
my $CAT = "$^X -pe1"; | ||
|
||
my @expected = qw( | ||
t/00-load.t | ||
t/api.t | ||
t/basic.t | ||
t/dirs.t | ||
t/dot.t | ||
t/everything.t | ||
t/follow.t | ||
t/from_file.t | ||
t/methods.t | ||
t/parms.t | ||
t/pod-coverage.t | ||
t/pod.t | ||
t/process-substitution.t | ||
t/sort.t | ||
t/swamp/perl-test.t | ||
t/zero.t | ||
); | ||
|
||
FROM_STDIN: { | ||
# Pipe stuff into the iterator | ||
my @actual = `$CAT t/filelist.txt | $^X -Mblib t/stdin-iterator.pl`; | ||
chomp @actual; | ||
sets_match( \@actual, \@expected, 'FROM_STDIN' ); | ||
} | ||
|
||
FROM_STDIN_NUL: { | ||
# Pipe nul-separated stuff into the iterator that handles nul-separated | ||
my @actual = `$CAT t/filelist-nul.txt | $^X -Mblib t/stdin-iterator.pl 1`; | ||
chomp @actual; | ||
sets_match( \@actual, \@expected, 'FROM_STDIN_NUL' ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env perl | ||
|
||
use strict; | ||
use warnings; | ||
|
||
use File::Next; | ||
|
||
my $nul = shift; | ||
|
||
my $iter = File::Next::from_file( { nul_separated => $nul }, '-' ); | ||
while ( my $file = $iter->() ) { | ||
print "$file\n"; | ||
} |