summaryrefslogtreecommitdiff
path: root/lib/version.t
diff options
context:
space:
mode:
authorJohn Peacock <jpeacock@rowman.com>2006-06-08 17:14:04 -0400
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-06-09 16:03:03 +0000
commit92dcf8ce268fff64097044a269995ffa27692a3d (patch)
tree7366c02363dc12211bd8168cf4f6a60680d4b1a1 /lib/version.t
parent7e265ef3a760ea72c6406128afc4b4771e71c25e (diff)
downloadperl-92dcf8ce268fff64097044a269995ffa27692a3d.tar.gz
[patch] Fwd: CPAN Upload: J/JP/JPEACOCK/version-0.64.tar.gz
Message-ID: <4488CB5C.4070702@rowman.com> p4raw-id: //depot/perl@28375
Diffstat (limited to 'lib/version.t')
-rw-r--r--lib/version.t32
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/version.t b/lib/version.t
index 055531ce36..c9da642ae2 100644
--- a/lib/version.t
+++ b/lib/version.t
@@ -414,6 +414,23 @@ SKIP: {
$version = $CLASS->new(" 1.7");
ok($version->numify eq "1.700", "leading space ignored");
+ # RT 19517 - deal with undef and 'undef' initialization
+ ok($version ne 'undef', "Undef version comparison #1");
+ ok($version ne undef, "Undef version comparison #2");
+ $version = $CLASS->new('undef');
+ unlike($warning, qr/^Version string 'undef' contains invalid data/,
+ "Version string 'undef'");
+
+ $version = $CLASS->new(undef);
+ like($warning, qr/^Use of uninitialized value/,
+ "Version string 'undef'");
+ ok($version eq 'undef', "Undef version comparison #3");
+ ok($version eq undef, "Undef version comparison #4");
+ eval "\$version = \$CLASS->new()"; # no parameter at all
+ unlike($@, qr/^Bizarre copy of CODE/, "No initializer at all");
+ ok($version eq 'undef', "Undef version comparison #5");
+ ok($version eq undef, "Undef version comparison #6");
+
SKIP: {
# dummy up a legal module for testing RT#19017
@@ -443,6 +460,21 @@ EOF
unlink 'www.pm';
}
+
+ open F, ">vvv.pm" or die "Cannot open vvv.pm: $!\n";
+ print F <<"EOF";
+package vvv;
+use base qw(version);
+1;
+EOF
+ close F;
+ # need to eliminate any other qv()'s
+ undef *main::qv;
+ ok(!defined(&{"main\::qv"}), "make sure we cleared qv() properly");
+ eval "use lib '.'; use vvv;";
+ ok(defined(&{"main\::qv"}), "make sure we exported qv() properly");
+ isa_ok( qv(1.2), "vvv");
+ unlink 'vvv.pm';
}
1;