Skip to content

Commit

Permalink
add failing test for debugger bug in perl >= 5.22:
Browse files Browse the repository at this point in the history
  • Loading branch information
chocolateboy committed Apr 20, 2018
1 parent d5bcaa8 commit 26af50b
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 20 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ MYMETA.yml
*.o
*.bs
autobox.c
dev/
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ language: perl
perl:
- "5.8"
- "5.10"
- "5.20"
- "5.22"
- "5.24"
- "5.26"
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ README
t/all.t
t/autoref.t
t/coderef.t
t/debugger.pl
t/debugger.t
t/default.t
t/export.t
t/hints.t
Expand Down
46 changes: 26 additions & 20 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,33 @@ if ($Config{gccversion}) {
$OPTIMIZE = $Config{optimize};
}

my $META_MERGE = {
resources => {
repository => 'https://github.com/chocolateboy/autobox',
bugtracker => 'https://github.com/chocolateboy/autobox/issues',
},
};

my $TEST_REQUIRES = {
'IPC::System::Simple' => '1.25',
};

WriteMakefile(
NAME => 'autobox',
VERSION_FROM => 'lib/autobox.pm',
NAME => 'autobox',
VERSION_FROM => 'lib/autobox.pm',

# compatibility in case module was previously installed to lib
INSTALLDIRS => ($] >= 5.011 ? 'site' : 'perl'),
PREREQ_PM => {
'Scope::Guard' => '0.21',
INSTALLDIRS => ($] >= 5.011 ? 'site' : 'perl'),

PREREQ_PM => {
'Scope::Guard' => '0.21',
},
ABSTRACT_FROM => 'lib/autobox.pod',
AUTHOR => 'chocolateboy <chocolate@cpan.org>',
INC => '-I.',
OPTIMIZE => $OPTIMIZE,
($EUMM_VERSION >= 6.48 ? (MIN_PERL_VERSION => '5.8.0') : ()),
($EUMM_VERSION >= 6.31 ? (LICENSE => 'perl') : ()),
($EUMM_VERSION >= 6.46 ?
(META_MERGE => {
resources => {
repository => 'https://github.com/chocolateboy/autobox',
bugtracker => 'https://github.com/chocolateboy/autobox/issues',
},
})
: ()
),
ABSTRACT_FROM => 'lib/autobox.pod',
AUTHOR => 'chocolateboy <chocolate@cpan.org>',
INC => '-I.',
OPTIMIZE => $OPTIMIZE,
($EUMM_VERSION >= 6.5503 ? (BUILD_REQUIRES => $TEST_REQUIRES) : ()),
($EUMM_VERSION >= 6.31 ? (LICENSE => 'artistic_2') : ()),
($EUMM_VERSION >= 6.46 ? (META_MERGE => $META_MERGE) : ()),
($EUMM_VERSION >= 6.48 ? (MIN_PERL_VERSION => '5.8.0') : ()),
);
30 changes: 30 additions & 0 deletions t/debugger.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env perl

use strict;
use warnings;
use blib;

use autobox { DEFAULT => __PACKAGE__ };

# helper for t/debugger.t
#
# this prints "foo -> bar -> baz -> quux"
# on perl < 5.22 and fails with the following error on newer perls:
#
# Can't locate object method "baz" via package "foo -> bar"
#
# https://github.com/scrottie/autobox-Core/issues/34

sub bar {
return "$_[0] -> bar";
}

sub baz {
return "$_[0] -> baz";
}

sub quux {
print "$_[0] -> quux", $/;
}

'foo'->bar->baz->quux;
15 changes: 15 additions & 0 deletions t/debugger.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env perl

use strict;
use warnings;

use FindBin qw($Bin);
use IPC::System::Simple qw(capturex);
use Test::More tests => 1;

# https://github.com/scrottie/autobox-Core/issues/34

$ENV{PERLDB_OPTS} = 'NonStop=1';

chomp(my $got = capturex($^X, '-d', "$Bin/debugger.pl"));
is $got, 'foo -> bar -> baz -> quux', 'runs under perl -d';

0 comments on commit 26af50b

Please sign in to comment.