Skip to content

Commit cb3db80

Browse files
committed
Open $^X instead of $0 in tests to create glob filehandle
Apparently when running coverage tests using $0 doesn't work. I'm guessing this is because $0 is a relative path (`t/union.t`) and Devel::Cover is probably changing the current directory.
1 parent d4a3f19 commit cb3db80

10 files changed

+10
-10
lines changed

lib/Test/Specio.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1517,5 +1517,5 @@ If you want to create a glob overloading object that returns a filehandle, do
15171517
this:
15181518
15191519
local *BAR;
1520-
open BAR, '<', $0 or die "Could not open $0 for the test";
1520+
open BAR, '<', $^X or die "Could not open $^X for the test";
15211521
my $GLOB_OVERLOAD_FH = _T::GlobOverload->new( \*BAR );

t/builtins-sanity.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ my $GLOB_OVERLOAD = _T::GlobOverload->new( \*FOO );
2323
local *BAR;
2424
{
2525
## no critic (InputOutput::ProhibitBarewordFileHandles, InputOutput::RequireBriefOpen)
26-
open BAR, '<', $0 or die "Could not open $0 for the test";
26+
open BAR, '<', $^X or die "Could not open $^X for the test";
2727
}
2828
my $GLOB_OVERLOAD_FH = _T::GlobOverload->new( \*BAR );
2929

t/declare-helpers.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ my $GLOB_OVERLOAD = _T::GlobOverload->new( \*FOO );
2323
local *BAR;
2424
{
2525
## no critic (InputOutput::ProhibitBarewordFileHandles, InputOutput::RequireBriefOpen)
26-
open BAR, '<', $0 or die "Could not open $0 for the test";
26+
open BAR, '<', $^X or die "Could not open $^X for the test";
2727
}
2828
my $GLOB_OVERLOAD_FH = _T::GlobOverload->new( \*BAR );
2929

t/dict.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ my $GLOB_OVERLOAD = _T::GlobOverload->new( \*FOO );
7575
local *BAR;
7676
{
7777
## no critic (InputOutput::ProhibitBarewordFileHandles, InputOutput::RequireBriefOpen)
78-
open BAR, '<', $0 or die "Could not open $0 for the test";
78+
open BAR, '<', $^X or die "Could not open $^X for the test";
7979
}
8080
my $GLOB_OVERLOAD_FH = _T::GlobOverload->new( \*BAR );
8181

t/intersection.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ my $GLOB_OVERLOAD = _T::GlobOverload->new( \*FOO );
3838
local *BAR;
3939
{
4040
## no critic (InputOutput::ProhibitBarewordFileHandles, InputOutput::RequireBriefOpen)
41-
open BAR, '<', $0 or die "Could not open $0 for the test";
41+
open BAR, '<', $^X or die "Could not open $^X for the test";
4242
}
4343
my $GLOB_OVERLOAD_FH = _T::GlobOverload->new( \*BAR );
4444

t/map.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ my $GLOB_OVERLOAD = _T::GlobOverload->new( \*FOO );
4545
local *BAR;
4646
{
4747
## no critic (InputOutput::ProhibitBarewordFileHandles, InputOutput::RequireBriefOpen)
48-
open BAR, '<', $0 or die "Could not open $0 for the test";
48+
open BAR, '<', $^X or die "Could not open $^X for the test";
4949
}
5050
my $GLOB_OVERLOAD_FH = _T::GlobOverload->new( \*BAR );
5151

t/string-sanity.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ my $GLOB_OVERLOAD = _T::GlobOverload->new( \*FOO );
2323
local *BAR;
2424
{
2525
## no critic (InputOutput::ProhibitBarewordFileHandles, InputOutput::RequireBriefOpen)
26-
open BAR, '<', $0 or die "Could not open $0 for the test";
26+
open BAR, '<', $^X or die "Could not open $^X for the test";
2727
}
2828
my $GLOB_OVERLOAD_FH = _T::GlobOverload->new( \*BAR );
2929

t/subs.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ my $GLOB_OVERLOAD = _T::GlobOverload->new( \*FOO );
2828
local *BAR;
2929
{
3030
## no critic (InputOutput::ProhibitBarewordFileHandles, InputOutput::RequireBriefOpen)
31-
open BAR, '<', $0 or die "Could not open $0 for the test";
31+
open BAR, '<', $^X or die "Could not open $^X for the test";
3232
}
3333
my $GLOB_OVERLOAD_FH = _T::GlobOverload->new( \*BAR );
3434

t/tuple.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ my $GLOB_OVERLOAD = _T::GlobOverload->new( \*FOO );
8282
local *BAR;
8383
{
8484
## no critic (InputOutput::ProhibitBarewordFileHandles, InputOutput::RequireBriefOpen)
85-
open BAR, '<', $0 or die "Could not open $0 for the test";
85+
open BAR, '<', $^X or die "Could not open $^X for the test";
8686
}
8787
my $GLOB_OVERLOAD_FH = _T::GlobOverload->new( \*BAR );
8888

t/union.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ my $GLOB_OVERLOAD = _T::GlobOverload->new( \*FOO );
3838
local *BAR;
3939
{
4040
## no critic (InputOutput::ProhibitBarewordFileHandles, InputOutput::RequireBriefOpen)
41-
open BAR, '<', $0 or die "Could not open $0 for the test";
41+
open BAR, '<', $^X or die "Could not open $^X for the test";
4242
}
4343
my $GLOB_OVERLOAD_FH = _T::GlobOverload->new( \*BAR );
4444

0 commit comments

Comments
 (0)