diff options
author | John Peacock <jpeacock@rowman.com> | 2004-04-13 16:51:31 -0400 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2004-04-14 07:26:04 +0000 |
commit | 13f8f3987335c6eed94bd796ae4e7be8f788fdbf (patch) | |
tree | 36257ab1ba4d78ddee06f5aafdecdccc2eb24c25 /lib/version.t | |
parent | 1928965c335b0bc2a3df245c2070b6e4b7bfad99 (diff) | |
download | perl-13f8f3987335c6eed94bd796ae4e7be8f788fdbf.tar.gz |
's to bring bleadperl up to version-0.39
Message-ID: <407C8B13.9020104@rowman.com>
p4raw-id: //depot/perl@22692
Diffstat (limited to 'lib/version.t')
-rw-r--r-- | lib/version.t | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/lib/version.t b/lib/version.t index dd8cb67300..c91d988c23 100644 --- a/lib/version.t +++ b/lib/version.t @@ -4,7 +4,7 @@ ######################### -use Test::More tests => 164; +use Test::More tests => 168; diag "Tests with base class" unless $ENV{PERL_CORE}; @@ -43,12 +43,12 @@ sub BaseTests { $version = $CLASS->new(5.005_03); is ( "$version" , "5.5.30" , '5.005_03 eq 5.5.30' ); $version = $CLASS->new(1.23); - is ( "$version" , "1.23" , '1.23 eq "1.23"' ); + is ( "$version" , "1.230" , '1.23 eq "1.230"' ); # Test quoted number processing diag "tests with quoted numbers" unless $ENV{PERL_CORE}; $version = $CLASS->new("5.005_03"); - is ( "$version" , "5.5_3" , '"5.005_03" eq "5.5_3"' ); + is ( "$version" , "5.5_30" , '"5.005_03" eq "5.5_30"' ); $version = $CLASS->new("v1.23"); is ( "$version" , "1.23.0" , '"v1.23" eq "1.23.0"' ); @@ -72,7 +72,7 @@ sub BaseTests { "Invalid version format (underscores before decimal)"); $version = $CLASS->new("99 and 44/100 pure"); - ok ("$version" eq "99", '$version eq "99.0.0"'); + ok ("$version" eq "99.000", '$version eq "99.000"'); ok ($version->numify == 99.0, '$version->numify == 99.0'); $version = $CLASS->new("something"); @@ -177,22 +177,22 @@ sub BaseTests { ok ( $new_version < $version, '$new_version < $version' ); ok ( $version != $new_version, '$version != $new_version' ); - $version = $CLASS->new("1.2.4"); - $new_version = $CLASS->new("1.2_4"); + $version = $CLASS->new("1.2.3.4"); + $new_version = $CLASS->new("1.2.3_4"); diag "tests with alpha-style objects with same subversion" unless $ENV{PERL_CORE}; ok ( $version > $new_version, '$version > $new_version' ); ok ( $new_version < $version, '$new_version < $version' ); ok ( $version != $new_version, '$version != $new_version' ); diag "test implicit [in]equality" unless $ENV{PERL_CORE}; - $version = $CLASS->new("v1.2"); - $new_version = $CLASS->new("1.2.0"); + $version = $CLASS->new("v1.2.3"); + $new_version = $CLASS->new("1.2.3.0"); ok ( $version == $new_version, '$version == $new_version' ); - $new_version = $CLASS->new("1.2_0"); + $new_version = $CLASS->new("1.2.3_0"); ok ( $version == $new_version, '$version == $new_version' ); - $new_version = $CLASS->new("1.2.1"); + $new_version = $CLASS->new("1.2.3.1"); ok ( $version < $new_version, '$version < $new_version' ); - $new_version = $CLASS->new("1.2_1"); + $new_version = $CLASS->new("1.2.3_1"); ok ( $version < $new_version, '$version < $new_version' ); $new_version = $CLASS->new("1.1.999"); ok ( $version > $new_version, '$version > $new_version' ); @@ -212,6 +212,12 @@ sub BaseTests { $version = qv(1.2); ok ( $version eq "1.2.0", 'qv(1.2) eq "1.2.0"' ); + # test creation from existing version object + diag "create new from existing version" unless $ENV{PERL_CORE}; + ok (eval {$new_version = version->new($version)}, + "new from existing object"); + ok ($new_version == $version, "duped object identical"); + # test the CVS revision mode diag "testing CVS Revision" unless $ENV{PERL_CORE}; $version = new version qw$Revision: 1.2$; @@ -221,16 +227,13 @@ sub BaseTests { diag "Replacement UNIVERSAL::VERSION tests" unless $ENV{PERL_CORE}; # we know this file is here since we require it ourselves - $version = $CLASS->new( $Test::More::VERSION ); + $version = $Test::More::VERSION; eval "use Test::More $version"; unlike($@, qr/Test::More version $version/, 'Replacement eval works with exact version'); - $version = $CLASS->new( $Test::More::VERSION+0.01 ); # this should fail even with old UNIVERSAL::VERSION - my $testeval = "use Test::More ". - ( $]<5.6 ? $version->numify() #why is this a problem??? - : $version ); - eval $testeval; + $version = $Test::More::VERSION+0.01; # this should fail even with old UNIVERSAL::VERSION + eval "use Test::More $version"; like($@, qr/Test::More version $version/, 'Replacement eval works with incremented version'); |