Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

workaround for Test::Builder2

  • Loading branch information...
commit 2ba71a518cbfe08ea2ac6bf6c92efdfa20e23a53 1 parent ebcf6ca
@xaicron authored
Showing with 24 additions and 3 deletions.
  1. +3 −2 t/02_parse_envfile.t
  2. +2 −1  t/03_run_with_env.t
  3. +19 −0 t/Util.pm
View
5 t/02_parse_envfile.t
@@ -2,6 +2,7 @@ use strict;
use warnings;
use Test::More;
use File::Temp qw(tempfile tempdir);
+use t::Util;
use App::envfile;
@@ -10,7 +11,7 @@ sub test_parse_envfile {
my ($input, $expects, $desc) = @specs{qw/input expects desc/};
local $Test::Builder::Level = $Test::Builder::Level + 1;
- subtest $desc => sub {
+ runtest $desc => sub {
my $tempfile = write_envfile($input);
my $envf = App::envfile->new;
my $got = $envf->parse_envfile($tempfile);
@@ -87,7 +88,7 @@ FOO = bar
ENV
-subtest 'file not found' => sub {
+runtest 'file not found' => sub {
eval { App::envfile->new->parse_envfile('foo.bar') };
ok $@, 'throw error';
};
View
3  t/03_run_with_env.t
@@ -1,6 +1,7 @@
use strict;
use warnings;
use Test::More;
+use t::Util;
plan skip_all => 'MSWin32 not process' if $^O eq 'MSWin32';
@@ -30,7 +31,7 @@ sub test_run_with_env {
my ($input, $expects, $desc) = @specs{qw/input expects desc/};
my $command = join ',', map { "\$ENV{$_}" } sort keys %$input;
- subtest $desc => sub {
+ runtest $desc => sub {
my $envf = App::envfile->new;
my $buf = $envf->run_with_env($input, [$^X, '-e', "print qq|$command|"]);
is $buf, $expects, 'child ok';
View
19 t/Util.pm
@@ -0,0 +1,19 @@
+package t::Util;
+
+use strict;
+use warnings;
+use base 'Exporter';
+use Test::More;
+
+our @EXPORT = 'runtest';
+
+# subtest like function
+sub runtest {
+ my ($desc, $code) = @_;
+ note '-'x80;
+ note $desc;
+ note '-'x80;
+ $code->();
+}
+
+1;
Please sign in to comment.
Something went wrong with that request. Please try again.