Hello community, here is the log from the commit of package perl-Test-Script for openSUSE:Factory checked in at 2017-07-17 09:12:30 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Test-Script (Old) and /work/SRC/openSUSE:Factory/.perl-Test-Script.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Test-Script" Mon Jul 17 09:12:30 2017 rev:25 rq:510426 version:1.20 Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Test-Script/perl-Test-Script.changes 2017-05-16 14:33:53.086139365 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Test-Script.new/perl-Test-Script.changes 2017-07-17 09:12:30.828480792 +0200 @@ -1,0 +2,38 @@ +Fri Jul 14 06:14:56 UTC 2017 - [email protected] + +- updated to 1.20 + see /usr/share/doc/packages/perl-Test-Script/Changes + + 1.20 2017-07-13 11:17:42 -0400 + - Production release identical to 1.19_08 release. + + 1.19_08 2017-07-12 08:22:41 -0400 + - Diagnostic release + + 1.19_07 2017-07-12 07:53:55 -0400 + - Diagnostic release + + 1.19_06 2017-07-11 05:34:30 -0400 + - Diagnostic release + + 1.19_05 2017-07-09 11:35:59 -0400 + - Diagnostic release + + 1.19_04 2017-07-07 16:26:41 -0400 + - Add support for stdin option that was lost in the Capture::Tiny migration + - Officially drop support for Perl 5.6 (support for 5.6 was already + implicitly dropped when we migrated to Capture::Tiny). + - A near term future version will also drop support for the old pre-Test2 + Test::Builder. + + 1.19_03 2017-07-07 10:14:25 -0400 + - Use Test2::V0 instead of Test2::Bundle::Extended for Test2 tests + + 1.19_02 2017-06-21 17:06:47 -0400 + - Identical to 1.19_01 + + 1.19_01 2017-05-01 06:12:01 -0400 + - Use Capture::Tiny instead of IPC::Run3 (Paul Cochrane/PTC++ gh#4, gh#15) + - Minor documentation fixes (Paul Cochrane/PTC++) + +------------------------------------------------------------------- Old: ---- Test-Script-1.18.tar.gz New: ---- Test-Script-1.20.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Test-Script.spec ++++++ --- /var/tmp/diff_new_pack.sdI5Sl/_old 2017-07-17 09:12:31.324410938 +0200 +++ /var/tmp/diff_new_pack.sdI5Sl/_new 2017-07-17 09:12:31.324410938 +0200 @@ -17,7 +17,7 @@ Name: perl-Test-Script -Version: 1.18 +Version: 1.20 Release: 0 %define cpan_name Test-Script Summary: Basic cross-platform tests for scripts @@ -30,11 +30,11 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros -BuildRequires: perl(IPC::Run3) >= 0.034 +BuildRequires: perl(Capture::Tiny) BuildRequires: perl(Probe::Perl) >= 0.01 BuildRequires: perl(Test::More) >= 0.96 BuildRequires: perl(Test::Tester) -Requires: perl(IPC::Run3) >= 0.034 +Requires: perl(Capture::Tiny) Requires: perl(Probe::Perl) >= 0.01 Requires: perl(Test::More) >= 0.96 %{perl_requires} @@ -75,7 +75,7 @@ %files -f %{name}.files %defattr(-,root,root,755) -%doc author.yml Changes README t2 +%doc author.yml Changes README %license LICENSE %changelog ++++++ Test-Script-1.18.tar.gz -> Test-Script-1.20.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/Changes new/Test-Script-1.20/Changes --- old/Test-Script-1.18/Changes 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/Changes 2017-07-13 17:17:45.000000000 +0200 @@ -1,5 +1,37 @@ Revision history for Perl extension Test-Script +1.20 2017-07-13 11:17:42 -0400 + - Production release identical to 1.19_08 release. + +1.19_08 2017-07-12 08:22:41 -0400 + - Diagnostic release + +1.19_07 2017-07-12 07:53:55 -0400 + - Diagnostic release + +1.19_06 2017-07-11 05:34:30 -0400 + - Diagnostic release + +1.19_05 2017-07-09 11:35:59 -0400 + - Diagnostic release + +1.19_04 2017-07-07 16:26:41 -0400 + - Add support for stdin option that was lost in the Capture::Tiny migration + - Officially drop support for Perl 5.6 (support for 5.6 was already + implicitly dropped when we migrated to Capture::Tiny). + - A near term future version will also drop support for the old pre-Test2 + Test::Builder. + +1.19_03 2017-07-07 10:14:25 -0400 + - Use Test2::V0 instead of Test2::Bundle::Extended for Test2 tests + +1.19_02 2017-06-21 17:06:47 -0400 + - Identical to 1.19_01 + +1.19_01 2017-05-01 06:12:01 -0400 + - Use Capture::Tiny instead of IPC::Run3 (Paul Cochrane/PTC++ gh#4, gh#15) + - Minor documentation fixes (Paul Cochrane/PTC++) + 1.18 2017-04-12 07:01:14 -0400 - Production release identical to 1.17_02 release. @@ -33,11 +65,11 @@ - Check for IO errors on temporary .pm file 1.11_02 2016-04-27 13:15:35 -0400 - - One possible fix for gh#5 + - One possible fix for gh#5 (see https://github.com/plicease/Test-Script/issues/5) 1.11_01 2016-04-27 12:28:33 -0400 - - Including some optional Test2 based tests that should + - Including some optional Test2 based tests that should only be run with a merged Test2 / Test::Builder (currently a dev release as Test::Simple on CPAN) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/LICENSE new/Test-Script-1.20/LICENSE --- old/Test-Script-1.18/LICENSE 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/LICENSE 2017-07-13 17:17:45.000000000 +0200 @@ -1,4 +1,4 @@ -This software is copyright (c) 2006 by Adam Kennedy. +This software is copyright (c) 2017 by Adam Kennedy. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. @@ -12,7 +12,7 @@ --- The GNU General Public License, Version 1, February 1989 --- -This software is Copyright (c) 2006 by Adam Kennedy. +This software is Copyright (c) 2017 by Adam Kennedy. This is free software, licensed under: @@ -272,7 +272,7 @@ --- The Artistic License 1.0 --- -This software is Copyright (c) 2006 by Adam Kennedy. +This software is Copyright (c) 2017 by Adam Kennedy. This is free software, licensed under: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/MANIFEST new/Test-Script-1.20/MANIFEST --- old/Test-Script-1.18/MANIFEST 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/MANIFEST 2017-07-13 17:17:45.000000000 +0200 @@ -1,4 +1,4 @@ -# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.009. +# This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.010. Changes INSTALL LICENSE @@ -28,6 +28,8 @@ t/bin/good.pl t/bin/print.pl t/bin/signal.pl +t/bin/stdin.pl +t/bin/stdin.txt t/bin/taint.pl t2/bug_gh9.t t2/test_script__exports.t diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/META.json new/Test-Script-1.20/META.json --- old/Test-Script-1.18/META.json 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/META.json 2017-07-13 17:17:45.000000000 +0200 @@ -5,7 +5,7 @@ "Adam Kennedy" ], "dynamic_config" : 0, - "generated_by" : "Dist::Zilla version 6.009, CPAN::Meta::Converter version 2.150010", + "generated_by" : "Dist::Zilla version 6.010, CPAN::Meta::Converter version 2.150010", "license" : [ "perl_5" ], @@ -18,7 +18,7 @@ "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0", - "perl" : "5.006" + "perl" : "5.008001" } }, "develop" : { @@ -37,12 +37,13 @@ }, "runtime" : { "requires" : { + "Capture::Tiny" : "0", "File::Spec" : "0.80", - "IPC::Run3" : "0.034", + "IO::Handle" : "0", "Probe::Perl" : "0.01", "Test::Builder" : "0.32", "Test::More" : "0.96", - "perl" : "5.006" + "perl" : "5.008001" } }, "test" : { @@ -51,10 +52,16 @@ "Test::Builder::Tester" : "1.02", "Test::More" : "0.96", "Test::Tester" : "0", - "perl" : "5.006" + "perl" : "5.008001" } } }, + "provides" : { + "Test::Script" : { + "file" : "lib/Test/Script.pm", + "version" : "1.20" + } + }, "release_status" : "stable", "resources" : { "bugtracker" : { @@ -67,7 +74,12 @@ "web" : "https://github.com/plicease/Test-Script" } }, - "version" : "1.18", - "x_serialization_backend" : "Cpanel::JSON::XS version 3.023" + "version" : "1.20", + "x_contributors" : [ + "Adam Kennedy", + "Graham Ollis <[email protected]>", + "Brendan Byrd" + ], + "x_serialization_backend" : "Cpanel::JSON::XS version 3.0233" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/META.yml new/Test-Script-1.20/META.yml --- old/Test-Script-1.18/META.yml 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/META.yml 2017-07-13 17:17:45.000000000 +0200 @@ -8,27 +8,36 @@ Test::Builder::Tester: '1.02' Test::More: '0.96' Test::Tester: '0' - perl: '5.006' + perl: '5.008001' configure_requires: ExtUtils::MakeMaker: '0' - perl: '5.006' + perl: '5.008001' dynamic_config: 0 -generated_by: 'Dist::Zilla version 6.009, CPAN::Meta::Converter version 2.150010' +generated_by: 'Dist::Zilla version 6.010, CPAN::Meta::Converter version 2.150010' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: '1.4' name: Test-Script +provides: + Test::Script: + file: lib/Test/Script.pm + version: '1.20' requires: + Capture::Tiny: '0' File::Spec: '0.80' - IPC::Run3: '0.034' + IO::Handle: '0' Probe::Perl: '0.01' Test::Builder: '0.32' Test::More: '0.96' - perl: '5.006' + perl: '5.008001' resources: bugtracker: https://github.com/plicease/Test-Script/issues homepage: https://metacpan.org/pod/Test::Script repository: git://github.com/plicease/Test-Script.git -version: '1.18' +version: '1.20' +x_contributors: + - 'Adam Kennedy' + - 'Graham Ollis <[email protected]>' + - 'Brendan Byrd' x_serialization_backend: 'YAML::Tiny version 1.70' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/Makefile.PL new/Test-Script-1.20/Makefile.PL --- old/Test-Script-1.18/Makefile.PL 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/Makefile.PL 2017-07-13 17:17:45.000000000 +0200 @@ -5,16 +5,16 @@ my(undef, $perl, undef) = @_; "\t$perl run_test.pl"; } - unless(eval q{ use 5.006; 1}) { - print "Perl 5.006 or better required\n"; + unless(eval q{ use 5.008001; 1}) { + print "Perl 5.008001 or better required\n"; exit; } } -# This file was automatically generated by Dist::Zilla::Plugin::Author::Plicease::MakeMaker v2.12. +# This file was automatically generated by Dist::Zilla::Plugin::Author::Plicease::MakeMaker v2.20. use strict; use warnings; -use 5.006; +use 5.008001; use ExtUtils::MakeMaker; @@ -26,14 +26,15 @@ }, "DISTNAME" => "Test-Script", "LICENSE" => "perl", - "MIN_PERL_VERSION" => "5.006", + "MIN_PERL_VERSION" => "5.008001", "NAME" => "Test::Script", "PM" => { "lib/Test/Script.pm" => "\$(INST_LIB)/Test/Script.pm" }, "PREREQ_PM" => { + "Capture::Tiny" => 0, "File::Spec" => "0.80", - "IPC::Run3" => "0.034", + "IO::Handle" => 0, "Probe::Perl" => "0.01", "Test::Builder" => "0.32", "Test::More" => "0.96" @@ -44,7 +45,7 @@ "Test::More" => "0.96", "Test::Tester" => 0 }, - "VERSION" => "1.18", + "VERSION" => "1.20", "test" => { "TESTS" => "t/*.t" } @@ -52,8 +53,9 @@ my %FallbackPrereqs = ( + "Capture::Tiny" => 0, "File::Spec" => "0.80", - "IPC::Run3" => "0.034", + "IO::Handle" => 0, "Probe::Perl" => "0.01", "Test::Builder" => "0.32", "Test::Builder::Tester" => "1.02", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/README new/Test-Script-1.20/README --- old/Test-Script-1.18/README 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/README 2017-07-13 17:17:45.000000000 +0200 @@ -4,7 +4,7 @@ VERSION - version 1.18 + version 1.20 SYNOPSIS @@ -44,7 +44,7 @@ The "script_compiles" test calls the script with "perl -c script.pl", and checks that it returns without error. - The path it should be passed is a relative unix-format script name. + The path it should be passed is a relative Unix-format script name. This will be localised when running perl -c and if the test fails the local name used will be shown in the diagnostic output. @@ -97,7 +97,8 @@ the referenced scalar. The behavior for any other types is undefined (the current - implementation uses IPC::Run3, but that may change in the future). + implementation uses Capture::Tiny). Any already opened stdin will be + closed. stdout @@ -115,7 +116,7 @@ scalar The behavior for any other types is undefined (the current - implementation uses IPC::Run3, but that may change in the future). + implementation uses Capture::Tiny). stderr @@ -179,19 +180,14 @@ CAVEATS - This module is fully supported back to Perl 5.8.1. It may work on - 5.8.0. It should work on Perl 5.6.x and I may even test on 5.6.2. I - will accept patches to maintain compatibility for such older Perls, but - you may need to fix it on 5.6.x / 5.8.0 and send me a patch. - - This module uses IPC::Run3 to compile and run scripts. There are a - number of outstanding issues with this module, and maintenance for - IPC::Run3 is not swift. One of these is that IPC::Run3 incorrectly - throws an exception on Windows when you feed it a Perl script with a - compile error. Currently Test::Script probes for this bug (it checks - for the bug, not for a specific version) and applies a workaround in - that case. I am hoping to remove the work around once the bug is fixed - in IPC::Run3. + This module is fully supported back to Perl 5.8.1. In the near future, + support for the older pre-Test2 Test::Builer will be dropped. + + The STDIN handle will be closed when using script_runs with the stdin + option. An older version used IPC::Run3, which attempted to save STDIN, + but apparently this cannot be done consistently or portably. We now use + Capture::Tiny instead and explicitly do not support saving STDIN + handles. SEE ALSO @@ -209,7 +205,7 @@ COPYRIGHT AND LICENSE - This software is copyright (c) 2006 by Adam Kennedy. + This software is copyright (c) 2017 by Adam Kennedy. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/cpanfile new/Test-Script-1.20/cpanfile --- old/Test-Script-1.18/cpanfile 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/cpanfile 2017-07-13 17:17:45.000000000 +0200 @@ -1,21 +1,22 @@ +requires "Capture::Tiny" => "0"; requires "File::Spec" => "0.80"; -requires "IPC::Run3" => "0.034"; +requires "IO::Handle" => "0"; requires "Probe::Perl" => "0.01"; requires "Test::Builder" => "0.32"; requires "Test::More" => "0.96"; -requires "perl" => "5.006"; +requires "perl" => "5.008001"; on 'test' => sub { requires "Test::Builder" => "0.32"; requires "Test::Builder::Tester" => "1.02"; requires "Test::More" => "0.96"; requires "Test::Tester" => "0"; - requires "perl" => "5.006"; + requires "perl" => "5.008001"; }; on 'configure' => sub { requires "ExtUtils::MakeMaker" => "0"; - requires "perl" => "5.006"; + requires "perl" => "5.008001"; }; on 'develop' => sub { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/dist.ini new/Test-Script-1.20/dist.ini --- old/Test-Script-1.18/dist.ini 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/dist.ini 2017-07-13 17:17:45.000000000 +0200 @@ -3,24 +3,14 @@ author = Adam Kennedy license = Perl_5 copyright_holder = Adam Kennedy -copyright_year = 2006 -version = 1.18 +copyright_year = 2017 +version = 1.20 [@Author::Plicease] -:version = 2.12 +:version = 2.19 travis_status = 1 release_tests = 1 -diag_preamble = | $post_diag = sub -diag_preamble = | { -diag_preamble = | eval { -diag_preamble = | require Test::Script; -diag_preamble = | diag "probing IPC::Run3 for rt94685 rt46333 rt95308 gh#9"; -diag_preamble = | diag "IPC::Run3 is ", Test::Script::_borked_ipc_run3() ? 'borked' : 'good'; -diag_preamble = | 1; -diag_preamble = | } || diag "eval failed: $@"; -diag_preamble = | }; - preamble = | sub MY::test_via_harness preamble = | { preamble = | my(undef, $perl, undef) = @_; @@ -40,16 +30,18 @@ remove = File::Path [Prereqs] -File::Spec = 0.80 -IPC::Run3 = 0.034 -Test::More = 0.96 -Probe::Perl = 0.01 +File::Spec = 0.80 +Test::More = 0.96 +Probe::Perl = 0.01 +Capture::Tiny = 0 [Prereqs / TestPrereqs] -phase = test Test::Builder = 0.32 Test::Builder::Tester = 1.02 +[MetaProvides::Package] + [Author::Plicease::Upload] cpan = 1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/lib/Test/Script.pm new/Test-Script-1.20/lib/Test/Script.pm --- old/Test-Script-1.18/lib/Test/Script.pm 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/lib/Test/Script.pm 2017-07-13 17:17:45.000000000 +0200 @@ -1,21 +1,22 @@ package Test::Script; # ABSTRACT: Basic cross-platform tests for scripts -our $VERSION = '1.18'; # VERSION +our $VERSION = '1.20'; # VERSION -use 5.006; +use 5.008001; use strict; use warnings; -use Carp (); -use Exporter (); -use File::Spec (); -use File::Spec::Unix (); -use Probe::Perl (); -use IPC::Run3 qw( run3 ); -use Test::Builder (); -use File::Temp (); -use File::Path (); +use Carp qw( croak ); +use Exporter; +use File::Spec; +use File::Spec::Unix; +use Probe::Perl; +use Capture::Tiny qw( capture ); +use Test::Builder (); +use File::Temp qw( tempdir ); +use File::Path qw( rmtree ); +use IO::Handle; our @ISA = 'Exporter'; our @EXPORT = qw{ @@ -56,10 +57,10 @@ sub path ($) { my $path = shift; unless ( defined $path ) { - Carp::croak("Did not provide a script name"); + croak("Did not provide a script name"); } if ( File::Spec::Unix->file_name_is_absolute($path) ) { - Carp::croak("Script name must be relative"); + croak("Script name must be relative"); } File::Spec->catfile( File::Spec->curdir, @@ -67,24 +68,6 @@ ); } -## This can and should be removed if/when IPC::Run3 is fixed on MSWin32 -## See rt94685, rt46333, rt95308 and IPC-Run3/gh#9" -sub _borked_ipc_run3 () { - $^O eq 'MSWin32' && - ! eval { IPC::Run3::run3 [ perl, -e => 'BEGIN {die}' ], \undef, \undef, \undef; 1 } -} - -if(_borked_ipc_run3()) -{ - no warnings 'redefine'; - *run3 = sub { - $! = 0; - my $r = IPC::Run3::run3(@_, { return_if_system_error => 1 }); - Carp::croak($!) if $! && $! !~ /Inappropriate I\/O control operation/; - $r; - }; -} - ##################################################################### # Test Functions @@ -94,22 +77,16 @@ my $unix = shift @$args; my $path = path( $unix ); my $pargs = _perl_args($path); - my @libs = map { "-I$_" } grep {!ref($_)} @INC; my $dir = _preload_module(); my $cmd = [ perl, @$pargs, "-I$dir", '-M__TEST_SCRIPT__', '-c', $path, @$args ]; - my $stdin = ''; - my $stdout = ''; - my $stderr = ''; - my $rv = eval { run3( $cmd, \$stdin, \$stdout, \$stderr ) }; + my ($stdout, $stderr) = capture { system(@$cmd) }; my $error = $@; my $exit = $? ? ($? >> 8) : 0; my $signal = $? ? ($? & 127) : 0; my $ok = !! ( - $error eq '' and $rv and $exit == 0 and $signal == 0 and $stderr =~ /syntax OK\s+\z/si + $error eq '' and $exit == 0 and $signal == 0 and $stderr =~ /syntax OK\s+\z/si ); - File::Path::rmtree($dir); - my $test = Test::Builder->new; $test->ok( $ok, $_[0] || "Script $unix compiles" ); $test->diag( "$exit - $stderr" ) unless $ok; @@ -119,20 +96,26 @@ return $ok; } -# this is noticably slower for long @INC lists (sometimes present in cpantesters +# this is noticeably slower for long @INC lists (sometimes present in cpantesters # boxes) than the previous implementation, which added a -I for every element in -# @INC. (also slower for more reasonable @INCs, but not noticably). But it is +# @INC. (also slower for more reasonable @INCs, but not noticeably). But it is # safer as very long argument lists can break calls to system sub _preload_module { - my $dir = File::Temp::tempdir( CLEANUP => 1 ); + my @opts = ( '.test-script-XXXXXXXX', CLEANUP => 1); + if(-w File::Spec->curdir) + { push @opts, DIR => File::Spec->curdir } + else + { push @opts, DIR => File::Spec->tmpdir } + my $dir = tempdir(@opts); + $dir = File::Spec->rel2abs($dir); # this is hopefully a pm file that nobody would use my $filename = File::Spec->catfile($dir, '__TEST_SCRIPT__.pm'); my $fh; - open($fh, '>', $filename) + open($fh, '>', $filename) || die "unable to open $filename: $!"; print($fh 'unshift @INC, ', - join ',', + join ',', # quotemeta is overkill, but it will make sure that characters # like " are quoted map { '"' . quotemeta($_) . '"' } @@ -154,15 +137,44 @@ my $pargs = _perl_args($path); my $dir = _preload_module(); my $cmd = [ perl, @$pargs, "-I$dir", '-M__TEST_SCRIPT__', $path, @$args ]; - $stdout = ''; - $stderr = ''; - my $rv = eval { run3( $cmd, $opt->{stdin}, $opt->{stdout}, $opt->{stderr} ) }; + $stdout = ''; + $stderr = ''; + + if($opt->{stdin}) + { + my $filename; + + if(ref($opt->{stdin}) eq 'SCALAR') + { + $filename = File::Spec->catfile( + tempdir(CLEANUP => 1), + 'stdin.txt', + ); + my $tmp; + open($tmp, '>', $filename) || die "unable to write to $filename"; + print $tmp ${ $opt->{stdin} }; + close $tmp; + } + elsif(ref($opt->{stdin}) eq '') + { + $filename = $opt->{stdin}; + } + else + { + croak("stdin MUST be either a scalar reference or a string filename"); + } + + my $fh; + open($fh, '<', $filename) || die "unable to open $filename $!"; + STDIN->fdopen( $fh, 'r' ) or die "unable to reopen stdin to $filename $!"; + } + + (${$opt->{stdout}}, ${$opt->{stderr}}) = capture { system(@$cmd) }; + my $error = $@; my $exit = $? ? ($? >> 8) : 0; my $signal = $? ? ($? & 127) : 0; - my $ok = !! ( $error eq '' and $rv and $exit == $opt->{exit} and $signal == $opt->{signal} ); - - File::Path::rmtree($dir); + my $ok = !! ( $error eq '' and $exit == $opt->{exit} and $signal == $opt->{signal} ); my $test = Test::Builder->new; $test->ok( $ok, $_[0] || "Script $unix runs" ); @@ -176,10 +188,10 @@ sub _like { my($text, $pattern, $regex, $not, $name) = @_; - + my $ok = $regex ? $text =~ $pattern : $text eq $pattern; $ok = !$ok if $not; - + my $test = Test::Builder->new; $test->ok( $ok, $name ); unless($ok) { @@ -192,7 +204,7 @@ $test->diag( " $_" ) for split /\n/, $pattern; } } - + $ok; } @@ -215,7 +227,7 @@ sub script_stdout_like { - my($pattern, $name) = @_; + my($pattern, $name) = @_; @_ = ($stdout, $pattern, 1, 0, $name || 'stdout matches' ); goto &_like; } @@ -247,7 +259,7 @@ sub script_stderr_like { - my($pattern, $name) = @_; + my($pattern, $name) = @_; @_ = ($stderr, $pattern, 1, 0, $name || 'stderr matches' ); goto &_like; } @@ -275,7 +287,7 @@ return [ @$in ]; } } - Carp::croak("Invalid command parameter"); + croak("Invalid command parameter"); } # Determine any extra arguments that need to be passed into Perl. @@ -296,11 +308,11 @@ sub _options { my %options = ref($_[0]->[0]) eq 'HASH' ? %{ shift @{ $_[0] } }: (); - + $options{exit} = 0 unless defined $options{exit}; $options{signal} = 0 unless defined $options{signal}; my $stdin = ''; - $options{stdin} = \$stdin unless defined $options{stdin}; + #$options{stdin} = \$stdin unless defined $options{stdin}; $options{stdout} = \$stdout unless defined $options{stdout}; $options{stderr} = \$stderr unless defined $options{stderr}; @@ -334,7 +346,7 @@ =head1 VERSION -version 1.18 +version 1.20 =head1 SYNOPSIS @@ -373,7 +385,7 @@ The L</script_compiles> test calls the script with "perl -c script.pl", and checks that it returns without error. -The path it should be passed is a relative unix-format script name. This +The path it should be passed is a relative Unix-format script name. This will be localised when running C<perl -c> and if the test fails the local name used will be shown in the diagnostic output. @@ -431,13 +443,13 @@ =back The behavior for any other types is undefined (the current implementation uses -L<IPC::Run3>, but that may change in the future). +L<Capture::Tiny>). Any already opened stdin will be closed. =item stdout Where to send the standard output to. If you use this option, then the the behavior of the C<script_stdout_> functions below are undefined. The value -may be one of +may be one of =over 4 @@ -452,7 +464,7 @@ In which case the standard output will be places into the referenced scalar The behavior for any other types is undefined (the current implementation uses -L<IPC::Run3>, but that may change in the future). +L<Capture::Tiny>). =item stderr @@ -464,14 +476,14 @@ script_stdout_is $expected_stdout, $test_name; -Tests if the output to stdout from the previous L</script_runs> matches the +Tests if the output to stdout from the previous L</script_runs> matches the expected value exactly. =head2 script_stdout_isnt script_stdout_is $expected_stdout, $test_name; -Tests if the output to stdout from the previous L</script_runs> does NOT match the +Tests if the output to stdout from the previous L</script_runs> does NOT match the expected value exactly. =head2 script_stdout_like @@ -492,14 +504,14 @@ script_stderr_is $expected_stderr, $test_name; -Tests if the output to stderr from the previous L</script_runs> matches the +Tests if the output to stderr from the previous L</script_runs> matches the expected value exactly. =head2 script_stderr_isnt script_stderr_is $expected_stderr, $test_name; -Tests if the output to stderr from the previous L</script_runs> does NOT match the +Tests if the output to stderr from the previous L</script_runs> does NOT match the expected value exactly. =head2 script_stderr_like @@ -518,18 +530,13 @@ =head1 CAVEATS -This module is fully supported back to Perl 5.8.1. It may work on 5.8.0. -It should work on Perl 5.6.x and I may even test on 5.6.2. I will accept -patches to maintain compatibility for such older Perls, but you may -need to fix it on 5.6.x / 5.8.0 and send me a patch. - -This module uses L<IPC::Run3> to compile and run scripts. There are a number of -outstanding issues with this module, and maintenance for L<IPC::Run3> is not swift. -One of these is that L<IPC::Run3> incorrectly throws an exception on Windows when -you feed it a Perl script with a compile error. Currently L<Test::Script> probes -for this bug (it checks for the bug, not for a specific version) and applies a -workaround in that case. I am hoping to remove the work around once the bug is -fixed in L<IPC::Run3>. +This module is fully supported back to Perl 5.8.1. In the near future, support +for the older pre-Test2 Test::Builer will be dropped. + +The STDIN handle will be closed when using script_runs with the stdin option. +An older version used L<IPC::Run3>, which attempted to save STDIN, but +apparently this cannot be done consistently or portably. We now use +L<Capture::Tiny> instead and explicitly do not support saving STDIN handles. =head1 SEE ALSO @@ -547,7 +554,7 @@ =head1 COPYRIGHT AND LICENSE -This software is copyright (c) 2006 by Adam Kennedy. +This software is copyright (c) 2017 by Adam Kennedy. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/run_test.pl new/Test-Script-1.20/run_test.pl --- old/Test-Script-1.18/run_test.pl 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/run_test.pl 2017-07-13 17:17:45.000000000 +0200 @@ -7,7 +7,7 @@ my $test2 = eval { require Test2; - require Test2::Suite; + require Test2::V0; require Test::Builder; Test::Builder->can('context'); }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/t/00_diag.t new/Test-Script-1.20/t/00_diag.t --- old/Test-Script-1.18/t/00_diag.t 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/t/00_diag.t 2017-07-13 17:17:45.000000000 +0200 @@ -10,25 +10,18 @@ my $post_diag; $modules{$_} = $_ for qw( + Capture::Tiny ExtUtils::MakeMaker File::Spec - IPC::Run3 + IO::Handle Probe::Perl Test::Builder Test::Builder::Tester Test::More Test::Tester ); +eval q{ require Test::Tester; }; -$post_diag = sub -{ - eval { - require Test::Script; - diag "probing IPC::Run3 for rt94685 rt46333 rt95308 gh#9"; - diag "IPC::Run3 is ", Test::Script::_borked_ipc_run3() ? 'borked' : 'good'; - 1; - } || diag "eval failed: $@"; -}; my @modules = sort keys %modules; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/t/06_exception.t new/Test-Script-1.20/t/06_exception.t --- old/Test-Script-1.18/t/06_exception.t 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/t/06_exception.t 2017-07-13 17:17:45.000000000 +0200 @@ -3,9 +3,6 @@ use Test::Tester; use Test::More tests => 2; use Test::Script; -use IPC::Run3 (); - -do { no warnings; sub IPC::Run3::run3 { die "an exception" } }; subtest script_compiles => sub { @@ -30,7 +27,7 @@ name => 'Script t/bin/missing.pl runs', }, ); - + note $result->{diag}; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/t/07_signal.t new/Test-Script-1.20/t/07_signal.t --- old/Test-Script-1.18/t/07_signal.t 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/t/07_signal.t 2017-07-13 17:17:45.000000000 +0200 @@ -25,7 +25,7 @@ ok => 0, }, ); - + note $r->{diag}; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/t/09_capture_output.t new/Test-Script-1.20/t/09_capture_output.t --- old/Test-Script-1.18/t/09_capture_output.t 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/t/09_capture_output.t 2017-07-13 17:17:45.000000000 +0200 @@ -40,7 +40,7 @@ }, 'script_stdout_is', ); - note $r->{diag}; + note $r->{diag}; }; subtest 'not isnt' => sub { @@ -52,7 +52,7 @@ }, 'script_stdout_isnt', ); - note $r->{diag}; + note $r->{diag}; }; subtest 'like' => sub { @@ -65,7 +65,7 @@ }, 'script_stdout_like', ); - + }; subtest 'not like' => sub { @@ -79,8 +79,8 @@ 'script_stdout_like', ); - note $r->{diag}; - + note $r->{diag}; + }; subtest 'unlike' => sub { @@ -93,7 +93,7 @@ }, 'script_stdout_unlike', ); - + }; subtest 'not unlike' => sub { @@ -106,8 +106,8 @@ }, 'script_stdout_unlike', ); - - note $r->{diag}; + + note $r->{diag}; }; }; @@ -146,7 +146,7 @@ }, 'script_stderr_is', ); - note $r->{diag}; + note $r->{diag}; }; subtest 'not isnt' => sub { @@ -158,7 +158,7 @@ }, 'script_stderr_isnt', ); - note $r->{diag}; + note $r->{diag}; }; subtest 'like' => sub { @@ -171,7 +171,7 @@ }, 'script_stderr_like', ); - + }; subtest 'not like' => sub { @@ -185,8 +185,8 @@ 'script_stderr_like', ); - note $r->{diag}; - + note $r->{diag}; + }; subtest 'unlike' => sub { @@ -199,7 +199,7 @@ }, 'script_stderr_unlike', ); - + }; subtest 'not unlike' => sub { @@ -212,8 +212,8 @@ }, 'script_stderr_unlike', ); - - note $r->{diag}; + + note $r->{diag}; }; }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/t/bin/stdin.pl new/Test-Script-1.20/t/bin/stdin.pl --- old/Test-Script-1.18/t/bin/stdin.pl 1970-01-01 01:00:00.000000000 +0100 +++ new/Test-Script-1.20/t/bin/stdin.pl 2017-07-13 17:17:45.000000000 +0200 @@ -0,0 +1,11 @@ +#!perl + +use strict; + +while(<STDIN>) +{ + s/oo/bb/g; + print; +} + +1; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/t/bin/stdin.txt new/Test-Script-1.20/t/bin/stdin.txt --- old/Test-Script-1.18/t/bin/stdin.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/Test-Script-1.20/t/bin/stdin.txt 2017-07-13 17:17:45.000000000 +0200 @@ -0,0 +1 @@ +foobaz diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/t2/bug_gh9.t new/Test-Script-1.20/t2/bug_gh9.t --- old/Test-Script-1.18/t2/bug_gh9.t 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/t2/bug_gh9.t 2017-07-13 17:17:45.000000000 +0200 @@ -1,12 +1,12 @@ -use Test2::Bundle::Extended; +use Test2::V0; use Test::Script; subtest 'non-distructive' => sub { my @foo = qw( foo bar baz ); - + my $bar = Test::Script::_script \@foo; - + is( $bar, [qw( foo bar baz )], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/t2/test_script__import.t new/Test-Script-1.20/t2/test_script__import.t --- old/Test-Script-1.18/t2/test_script__import.t 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/t2/test_script__import.t 2017-07-13 17:17:45.000000000 +0200 @@ -1,4 +1,4 @@ -use Test2::Bundle::Extended; +use Test2::V0; use Test::Script (); is( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/t2/test_script__script_compiles.t new/Test-Script-1.20/t2/test_script__script_compiles.t --- old/Test-Script-1.18/t2/test_script__script_compiles.t 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/t2/test_script__script_compiles.t 2017-07-13 17:17:45.000000000 +0200 @@ -1,118 +1,151 @@ -use strict; -use warnings; -use Test2::Bundle::Extended; +use Test2::V0; use Test::Script; use File::Spec; use File::Temp qw( tempdir ); +use Data::Dumper qw( Dumper ); + # the first subtest replaces t/02_compiles_good.t subtest 'good' => sub { - my $rv; - is( - intercept { $rv = script_compiles 't/bin/good.pl' }, - array { - event Ok => sub { - call pass => T(); - call name => 'Script t/bin/good.pl compiles'; - }; - end; - }, - 'script_compiles t/bin/good.pl', - ); - - is $rv, T(), 'script_compiles_ok returns true as convenience'; - - is( - intercept { $rv = script_compiles 't/bin/good.pl', 'It worked' }, - array { - event Ok => sub { - call pass => T(); - call name => 'It worked'; - }; - end; - }, - 'script_compiles t/bin/good.pl It worked', - ); + subtest 'default name' => sub { + + my $events; + my $rv; + is( + $events = intercept { $rv = script_compiles 't/bin/good.pl' }, + array { + event Ok => sub { + call pass => T(); + call name => 'Script t/bin/good.pl compiles'; + }; + end; + }, + 'script_compiles t/bin/good.pl', + ); + + diag Dumper($events) unless $rv; + + is $rv, T(), 'script_compiles_ok returns true as convenience'; + }; + + subtest 'with different name' => sub { - is $rv, T(), 'script_compiles_ok returns true as convenience'; + my $events; + my $rv; + + is( + $events = intercept { $rv = script_compiles 't/bin/good.pl', 'It worked' }, + array { + event Ok => sub { + call pass => T(); + call name => 'It worked'; + }; + end; + }, + 'script_compiles t/bin/good.pl It worked', + ); + + diag Dumper($events) unless $rv; + + is $rv, T(), 'script_compiles_ok returns true as convenience'; + }; + }; # second subtest replaces t/03_compiles_bad.t subtest 'bad' => sub { - my $rv; my $bad = File::Spec->catfile(qw( t bin bad.pl )); ok -f $bad, 'found bad script'; - is( - intercept { $rv = script_compiles 't/bin/bad.pl' }, - array { - event Ok => sub { - call pass => F(); - call name => 'Script t/bin/bad.pl compiles'; - }; - event Diag => sub { - # generated by TB / T2 - }; - event Diag => sub { - # generated by TB / T2 - }; - event Diag => sub { - call message => match qr{\d+ - (?:Using.*\n# )?Bad at \Q$bad\E line 4\.\n}; - call message => match qr{BEGIN failed--compilation aborted at \Q$bad\E line 5.}; - }; - end; - }, - 'script_compiles t/bin/bad.pl', - ); - - is $rv, F(), 'script_compiles_ok returns false as convenience'; - - is( - intercept { $rv = script_compiles 't/bin/bad.pl', 'It worked' }, - array { - event Ok => sub { - call pass => F(); - call name => 'It worked'; - }; - event Diag => sub { - # generated by TB / T2 - }; - event Diag => sub { - # generated by TB / T2 - }; - event Diag => sub { - call message => match qr{\d+ - (?:Using.*\n# )?Bad at \Q$bad\E line 4\.\n}; - call message => match qr{BEGIN failed--compilation aborted at \Q$bad\E line 5\.}; - }; - end; - }, - 'script_compiles t/bin/bad.pl It worked', - ); + subtest 'default name' => sub { + + my $rv; + my $events; + + my $rv2 = is( + $events = intercept { $rv = script_compiles 't/bin/bad.pl' }, + array { + event Ok => sub { + call pass => F(); + call name => 'Script t/bin/bad.pl compiles'; + }; + event Diag => sub { + # generated by TB / T2 + }; + event Diag => sub { + # generated by TB / T2 + }; + event Diag => sub { + call message => match qr{\d+ - (?:Using.*\n# )?Bad at \Q$bad\E line 4\.\n}; + call message => match qr{BEGIN failed--compilation aborted at \Q$bad\E line 5.}; + }; + end; + }, + 'script_compiles t/bin/bad.pl', + ); + + diag Dumper($events) unless $rv2; + + is $rv, F(), 'script_compiles_ok returns false as convenience'; + + }; - is $rv, F(), 'script_compiles_ok returns false as convenience'; + subtest 'custom name' => sub { + + my $rv; + my $events; + + my $rv2 = is( + $events = intercept { $rv = script_compiles 't/bin/bad.pl', 'It worked' }, + array { + event Ok => sub { + call pass => F(); + call name => 'It worked'; + }; + event Diag => sub { + # generated by TB / T2 + }; + event Diag => sub { + # generated by TB / T2 + }; + event Diag => sub { + call message => match qr{\d+ - (?:Using.*\n# )?Bad at \Q$bad\E line 4\.\n}; + call message => match qr{BEGIN failed--compilation aborted at \Q$bad\E line 5\.}; + }; + end; + }, + 'script_compiles t/bin/bad.pl It worked', + ); + + diag Dumper($events) unless $rv2; + + is $rv, F(), 'script_compiles_ok returns false as convenience'; + + }; }; subtest 'unreasonable number of libs' => sub { skip_all 'developer only test' unless $ENV{TEST_SCRIPT_DEV_TEST}; - + local @INC = @INC; - + my $dir = tempdir( CLEANUP => 1 ); - + for(map { File::Spec->catfile($dir, $_) } 1..1000000) { #mkdir; push @INC, $_; } - + script_compiles 't/bin/good.pl'; }; done_testing; + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Test-Script-1.18/t2/test_script__script_runs.t new/Test-Script-1.20/t2/test_script__script_runs.t --- old/Test-Script-1.18/t2/test_script__script_runs.t 2017-04-12 13:01:18.000000000 +0200 +++ new/Test-Script-1.20/t2/test_script__script_runs.t 2017-07-13 17:17:45.000000000 +0200 @@ -1,89 +1,120 @@ -use strict; -use warnings; -use Test2::Bundle::Extended; +use Test2::V0; use Test::Script; use File::Temp qw( tempdir ); +use Data::Dumper qw( Dumper ); # the first subtest replaces t/04_runs_good.t subtest 'good' => sub { - my $rv; - - is( - intercept { $rv = script_runs 't/bin/good.pl' }, - array { - event Ok => sub { - call pass => T(); - call name => 'Script t/bin/good.pl runs'; - }; - end; - }, - 'script_runs t/bin/good.pl', - ); - - is $rv, T(), 'script_compiles_ok returns true as convenience'; + subtest 'default name' => sub { + + my $rv; + my $events; + + is( + $events = intercept { $rv = script_runs 't/bin/good.pl' }, + array { + event Ok => sub { + call pass => T(); + call name => 'Script t/bin/good.pl runs'; + }; + end; + }, + 'script_runs t/bin/good.pl', + ); + + diag Dumper($events) unless $rv; + + is $rv, T(), 'script_compiles_ok returns true as convenience'; + + }; + + subtest 'custom name' => sub { + + my $rv; + my $events; + + is( + $events = intercept { $rv = script_runs 't/bin/good.pl', 'It worked' }, + array { + event Ok => sub { + call pass => T(); + call name => 'It worked'; + }; + end; + }, + 'script_runs t/bin/good.pl It worked', + ); + + diag Dumper($events) unless $rv; + + is $rv, T(), 'script_compiles_ok returns true as convenience'; + + }; + - is( - intercept { $rv = script_runs 't/bin/good.pl', 'It worked' }, - array { - event Ok => sub { - call pass => T(); - call name => 'It worked'; - }; - end; - }, - 'script_runs t/bin/good.pl It worked', - ); - - is $rv, T(), 'script_compiles_ok returns true as convenience'; - - }; -subtest 'good' => sub { +subtest 'bad: returns 4' => sub { + + subtest 'default name' => sub { + + my $rv; + my $events; + + my $rv2 = is( + $events = intercept { $rv = script_runs 't/bin/four.pl' }, + array { + event Ok => sub { + call pass => F(); + call name => 'Script t/bin/four.pl runs'; + }; + event Diag => sub {}; + event Diag => sub {}; + event Diag => sub { + call message => match qr{4 - (?:Using.*\n# )?Standard Error\n}; + }; + end; + }, + 'script_runs t/bin/good.pl', + ); + + diag Dumper($events) unless $rv2; + + is $rv, F(), 'script_compiles_ok returns false as convenience'; + + }; + + subtest 'custom name' => sub { + + my $rv; + my $events; + + my $rv2 = is( + $events = intercept { $rv = script_runs 't/bin/four.pl', 'It worked' }, + array { + event Ok => sub { + call pass => F(); + call name => 'It worked'; + }; + event Diag => sub {}; + event Diag => sub {}; + event Diag => sub { + call message => match qr{4 - (?:Using.*\n# )?Standard Error\n}; + }; + end; + }, + 'script_runs t/bin/good.pl It worked', + ); + + diag Dumper($events) unless $rv2; + + is $rv, F(), 'script_compiles_ok returns false as convenience'; + + }; - my $rv; - - is( - intercept { $rv = script_runs 't/bin/four.pl' }, - array { - event Ok => sub { - call pass => F(); - call name => 'Script t/bin/four.pl runs'; - }; - event Diag => sub {}; - event Diag => sub {}; - event Diag => sub { - call message => match qr{4 - (?:Using.*\n# )?Standard Error\n}; - }; - end; - }, - 'script_runs t/bin/good.pl', - ); - - is $rv, F(), 'script_compiles_ok returns false as convenience'; - is( - intercept { $rv = script_runs 't/bin/four.pl', 'It worked' }, - array { - event Ok => sub { - call pass => F(); - call name => 'It worked'; - }; - event Diag => sub {}; - event Diag => sub {}; - event Diag => sub { - call message => match qr{4 - (?:Using.*\n# )?Standard Error\n}; - }; - end; - }, - 'script_runs t/bin/good.pl It worked', - ); - - is $rv, F(), 'script_compiles_ok returns false as convenience'; - - }; subtest 'unreasonable number of libs' => sub { @@ -97,9 +128,31 @@ #mkdir; push @INC, $_; } - + script_runs 't/bin/good.pl'; }; +subtest 'stdin' => sub { + + script_compiles 't/bin/stdin.pl'; + + # see https://github.com/plicease/Test-Script/issues/23 + + subtest 'filename' => sub { + + script_runs 't/bin/stdin.pl', { stdin => 't/bin/stdin.txt' }; + script_stdout_like qr{fbbbaz}; + + }; + + subtest 'scalar ref' => sub { + + script_runs 't/bin/stdin.pl', { stdin => \'helloooo there' }; + script_stdout_like qr{hellbbbb there}; + + }; + +}; + done_testing;
