pablrod / p5-Chart-Plotly

Generate html/javascript charts with perl data using javascript library Plotly.js
MIT License
9 stars 4 forks source link

t/Devel-IPerl-Plugin/01-basic-use.t: skip does not work for perl 5.16 and older #42

Closed eserte closed 4 years ago

eserte commented 4 years ago

With older perls (e.g. perl 5.12.5) the test suite may fail:

...
t/Devel-IPerl-Plugin/00-load-devel_iperl_plugin.t .. skipped: Devel::IPerl not installed
Can't locate Devel/IPerl/Plugin/Chart/Plotly/Plot/Trace/IPerlRole.pm in @INC (@INC contains: /data/home/cpansand/.cpan/build/2019120214/Chart-Plotly-0.033-3/blib/lib /data/home/cpansand/.cpan/build/2019120214/Chart-Plotly-0.033-3/blib/arch /opt/perl-5.12.5/lib/site_perl/5.12.5/x86_64-linux /opt/perl-5.12.5/lib/site_perl/5.12.5 /opt/perl-5.12.5/lib/5.12.5/x86_64-linux /opt/perl-5.12.5/lib/5.12.5 .) at /opt/perl-5.12.5/lib/site_perl/5.12.5/Role/Tiny.pm line 52.
t/Devel-IPerl-Plugin/01-basic-use.t ................ 
Dubious, test returned 2 (wstat 512, 0x200)
No subtests run 
...

The problem is that the error message for module load errors changed between perl 5.16 and 5.18:

$ perl5.14.4 -Mblib -e 'use Devel::IPerl::Plugin::Chart::Plotly' 
Can't locate Devel/IPerl/Display/HTML.pm in @INC (@INC contains: /data/home/cpansand/.cpan/build/2019120513/Chart-Plotly-0.033-0/blib/arch /data/home/cpansand/.cpan/build/2019120513/Chart-Plotly-0.033-0/blib/lib /opt/perl-5.14.4/lib/site_perl/5.14.4/x86_64-linux /opt/perl-5.14.4/lib/site_perl/5.14.4 /opt/perl-5.14.4/lib/5.14.4/x86_64-linux /opt/perl-5.14.4/lib/5.14.4 .) at /data/home/cpansand/.cpan/build/2019120513/Chart-Plotly-0.033-0/blib/lib/Devel/IPerl/Plugin/Chart/Plotly.pm line 61.
BEGIN failed--compilation aborted at /data/home/cpansand/.cpan/build/2019120513/Chart-Plotly-0.033-0/blib/lib/Devel/IPerl/Plugin/Chart/Plotly.pm line 61.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
$ perl5.18.4  -Mblib -e 'use Devel::IPerl::Plugin::Chart::Plotly'
Can't locate Devel/IPerl/Display/HTML.pm in @INC (you may need to install the Devel::IPerl::Display::HTML module) (@INC contains: /data/home/cpansand/.cpan/build/2019120513/Chart-Plotly-0.033-0/blib/arch /data/home/cpansand/.cpan/build/2019120513/Chart-Plotly-0.033-0/blib/lib /opt/perl-5.18.4/lib/site_perl/5.18.4/x86_64-linux /opt/perl-5.18.4/lib/site_perl/5.18.4 /opt/perl-5.18.4/lib/5.18.4/x86_64-linux /opt/perl-5.18.4/lib/5.18.4 .) at /data/home/cpansand/.cpan/build/2019120513/Chart-Plotly-0.033-0/blib/lib/Devel/IPerl/Plugin/Chart/Plotly.pm line 61.
BEGIN failed--compilation aborted at /data/home/cpansand/.cpan/build/2019120513/Chart-Plotly-0.033-0/blib/lib/Devel/IPerl/Plugin/Chart/Plotly.pm line 61.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

The following diff seems to fix the problem:

diff --git a/t/Devel-IPerl-Plugin/01-basic-use.t b/t/Devel-IPerl-Plugin/01-basic-use.t
index f15dcc3..86e61c8 100644
--- a/t/Devel-IPerl-Plugin/01-basic-use.t
+++ b/t/Devel-IPerl-Plugin/01-basic-use.t
@@ -6,7 +6,7 @@ use Test::More;

 eval 'use Devel::IPerl::Plugin::Chart::Plotly';
 plan skip_all => "Can't load Devel::IPerl::Plugin::Chart::Plotly. Devel::IPerl not installed"
-  if ( $@ =~ /Display::HTML/ );
+  if ( $@ =~ /Display.*HTML/ );

 # Loading errors are tested by 00-load-devel_iperl_plugin.t

(or just check for $@ being set)

pablrod commented 4 years ago

Thank you for reporting this!!

I'm going to fix it ASAP with your suggested diff! But changing .* by (::|\/|\\)

I discarded the option of just checking $@ because different problems could be missed.