diff options
author | John Peacock <john.peacock@havurah-software.org> | 2011-07-27 16:16:53 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-07-27 17:45:23 -0700 |
commit | a0e8d7b965a2c48cce7daf93090631f0d7a9a72f (patch) | |
tree | b1161083303c1f90064cc7da4fafcfae1c182da4 /lib | |
parent | 9bf41c1df182ebe0899a6987bf04ea02cb385489 (diff) | |
download | perl-a0e8d7b965a2c48cce7daf93090631f0d7a9a72f.tar.gz |
[perl #95544] Test that UNIVERSAL::VERSION returns $VERSION
Diffstat (limited to 'lib')
-rw-r--r-- | lib/version.t | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/version.t b/lib/version.t index bee90785ac..dd47e87654 100644 --- a/lib/version.t +++ b/lib/version.t @@ -474,6 +474,22 @@ SKIP: { 'Replacement handles modules without VERSION'); unlink $filename; } +SKIP: { # https://rt.perl.org/rt3/Ticket/Display.html?id=95544 + skip "version require'd instead of use'd, cannot test UNIVERSAL::VERSION", 2 + unless defined $qv_declare; + my ($fh, $filename) = tempfile('tXXXXXXX', SUFFIX => '.pm', UNLINK => 1); + (my $package = basename($filename)) =~ s/\.pm$//; + print $fh "package $package;\n\$VERSION = '3alpha';\n1;\n"; + close $fh; + eval "use lib '.'; use $package; die $package->VERSION"; + ok ($@ =~ /3alpha/, 'Even a bad $VERSION is returned'); + eval "use lib '.'; use $package;"; + unlike ($@, qr/Invalid version format \(non-numeric data\)/, + 'Do not warn about bad $VERSION unless asked'); + eval "use lib '.'; use $package 1;"; + like ($@, qr/Invalid version format \(non-numeric data\)/, + 'Warn about bad $VERSION when asked'); + } SKIP: { skip 'Cannot test bare v-strings with Perl < 5.6.0', 4 @@ -624,7 +640,6 @@ SKIP: { my $warning; local $SIG{__WARN__} = sub { $warning = $_[0] }; -$DB::single = 1; my $v = eval { $CLASS->$method('1,7') }; # is( $@, "", 'Directly test comma as decimal compliance'); |