-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #814 from gugod/replace-test-output
Replace Test::Output
- Loading branch information
Showing
12 changed files
with
72 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# This Build.PL for App-perlbrew was generated by mbtiny 0.041. | ||
# This Build.PL for App-perlbrew was generated by mbtiny 0.047. | ||
use 5.008; | ||
use Module::Build::Tiny 0.039; | ||
Build_PL(); |
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
"Kang-min Liu C<< <[email protected]> >>" | ||
], | ||
"dynamic_config" : 0, | ||
"generated_by" : "App::ModuleBuildTiny version 0.041", | ||
"generated_by" : "App::ModuleBuildTiny version 0.047", | ||
"license" : [ | ||
"mit" | ||
], | ||
|
@@ -21,7 +21,7 @@ | |
}, | ||
"develop" : { | ||
"requires" : { | ||
"App::ModuleBuildTiny" : "0.041", | ||
"App::ModuleBuildTiny" : "0.047", | ||
"Pod::Markdown" : "2.002" | ||
} | ||
}, | ||
|
@@ -48,7 +48,6 @@ | |
"Test2::V0" : "0.000163", | ||
"Test::More" : "1.001002", | ||
"Test::NoWarnings" : "1.04", | ||
"Test::Output" : "1.03", | ||
"Test::Simple" : "1.001002", | ||
"Test::TempDir::Tiny" : "0.016" | ||
} | ||
|
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 |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package PerlbrewTestHelpers; | ||
use Test2::V0; | ||
use Test2::Plugin::IOEvents; | ||
|
||
use Exporter 'import'; | ||
our @EXPORT_OK = qw(stderr_from stderr_is stderr_like stdout_from stdout_is stdout_like); | ||
|
||
# Replacements of Test::Output made by using Test2::Plugin::IOEvents | ||
|
||
sub ioevents_from { | ||
my ($cb) = @_; | ||
return grep { $_->tag eq 'STDOUT' || $_->tag eq 'STDERR' } | ||
map { @{ $_->facets->{info} } } | ||
@{ intercept(sub { $cb->() }) }; | ||
} | ||
|
||
sub stderr_from (&) { | ||
my ($cb) = @_; | ||
join "", map { $_->details } grep { $_->tag eq 'STDERR' } ioevents_from($cb); | ||
} | ||
|
||
sub stderr_is (&$;$) { | ||
my ($cb, $expected, $desc) = @_; | ||
is(stderr_from(sub { $cb->() }), $expected, $desc); | ||
} | ||
|
||
sub stderr_like (&$;$) { | ||
my ($cb, $re, $desc) = @_; | ||
like(stderr_from(sub { $cb->() }), $re, $desc); | ||
} | ||
|
||
sub stdout_from (&) { | ||
my ($cb) = @_; | ||
return join "", map { $_->details } grep { $_->tag eq 'STDOUT' } ioevents_from($cb); | ||
} | ||
|
||
sub stdout_is (&$;$) { | ||
my ($cb, $expected, $desc) = @_; | ||
is(stdout_from(sub { $cb->() }), $expected, $desc); | ||
} | ||
|
||
sub stdout_like (&$;$) { | ||
my ($cb, $re, $desc) = @_; | ||
like(stdout_from(sub { $cb->() }), $re, $desc); | ||
} | ||
|
||
|
||
1; |
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
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
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