summaryrefslogtreecommitdiff
path: root/lib/version.t
diff options
context:
space:
mode:
authorSteve Peters <steve@fisharerojo.org>2006-01-11 03:22:57 +0000
committerSteve Peters <steve@fisharerojo.org>2006-01-11 03:22:57 +0000
commitcd57dc11b379d64c4f58020ac5a49cbd7893e35a (patch)
tree7c9dcc425b6402d8d9a61d265c9b20598adc36c2 /lib/version.t
parent37b8b4c96b95703d956822dafbbd43c0dc3ac882 (diff)
downloadperl-cd57dc11b379d64c4f58020ac5a49cbd7893e35a.tar.gz
Upgrade to version-0.53
p4raw-id: //depot/perl@26777
Diffstat (limited to 'lib/version.t')
-rw-r--r--lib/version.t21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/version.t b/lib/version.t
index 16f306cd82..9ed5d5bde4 100644
--- a/lib/version.t
+++ b/lib/version.t
@@ -98,12 +98,31 @@ sub BaseTests {
like($@, qr/alpha without decimal/,
"Invalid version format (alpha without decimal)");
- $version = $CLASS->new("99 and 44/100 pure");
+ # for this first test, just upgrade the warn() to die()
+ eval {
+ local $SIG{__WARN__} = sub { die $_[0] };
+ $version = $CLASS->new("1.2b3");
+ };
+ my $warnregex = "Version string '.+' contains invalid data; ".
+ "ignoring: '.+'";
+
+ like($@, qr/$warnregex/,
+ "Version string contains invalid data; ignoring");
+
+ # from here on out capture the warning and test independently
+ my $warning;
+ local $SIG{__WARN__} = sub { $warning = $_[0] };
+ $version = $CLASS->new("99 and 44/100 pure");
+
+ like($warning, qr/$warnregex/,
+ "Version string contains invalid data; ignoring");
ok ("$version" eq "99.000", '$version eq "99.000"');
ok ($version->numify == 99.0, '$version->numify == 99.0');
ok ($version->normal eq "v99.0.0", '$version->normal eq v99.0.0');
$version = $CLASS->new("something");
+ like($warning, qr/$warnregex/,
+ "Version string contains invalid data; ignoring");
ok (defined $version, 'defined $version');
# reset the test object to something reasonable