When an XS module’s version is checked when it is loading, the string
"version" should be treated the same way as "versions" and emit the
‘Invalid version format’ error, instead of being treated as a version
object at first and then rejected by the validator with the ‘Invalid
version object’ error.
See also perl #102586.
'Time::HiRes'=> q| ::can_ok( 'Time::HiRes' => 'usleep' ) |, # 5.7.3
);
-plan tests => keys(%modules) * 3 + 7;
+plan tests => keys(%modules) * 3 + 8;
# Try to load the module
use_ok( 'XSLoader' );
}
}
+SKIP: {
+ skip "Needs 5.15.6", 1 unless $] > 5.0150051;
+ skip "List::Util not available", 1 if $extensions !~ /\bList::Util\b/;
+ eval 'package List::Util; XSLoader::load(__PACKAGE__, "version")';
+ like $@, "/^Invalid version format/",
+ 'correct error msg for invalid versions';
+}
}
if (sv) {
SV *xssv = Perl_newSVpvn_flags(aTHX_ xs_p, xs_len, SVs_TEMP);
- SV *pmsv = sv_derived_from(sv, "version")
+ SV *pmsv = sv_derived_from(sv, "version") && SvROK(sv)
? sv : sv_2mortal(new_version(sv));
xssv = upg_version(xssv, 0);
if ( vcmp(pmsv,xssv) ) {