Skip to content

Commit

Permalink
PATCH: Synchronize version.pm CPAN with core
Browse files Browse the repository at this point in the history
Date: Fri, 16 Aug 2013 08:59:49 -0400
Message-ID: <[email protected]>

(Amended by the committer to preserve local changes in 07locale.t from
3fca3d6 (the first part of hunk #2 is not
in 0.9903) and 02aba72 (not in 0.9903 at
all), and to fix a "tab after spaces" problem in version.pm. These changes
are being sent back upstream in CPAN RT#87513.)
  • Loading branch information
John Peacock authored and steve-m-hay committed Aug 19, 2013
1 parent 5ef2a01 commit 5027b3a
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 50 deletions.
8 changes: 4 additions & 4 deletions cpan/version/lib/version.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use strict;

use vars qw(@ISA $VERSION $CLASS $STRICT $LAX *declare *qv);

$VERSION = 0.9902;
$VERSION = 0.9903;

$CLASS = 'version';

Expand Down Expand Up @@ -131,17 +131,17 @@ sub import {
map { $args{$_} = 1 } @_
}
else { # no parameters at all on use line
%args =
%args =
(
qv => 1,
'UNIVERSAL::VERSION' => 1,
);
}

my $callpkg = caller();

if (exists($args{declare})) {
*{$callpkg.'::declare'} =
*{$callpkg.'::declare'} =
sub {return $class->declare(shift) }
unless defined(&{$callpkg.'::declare'});
}
Expand Down
5 changes: 3 additions & 2 deletions cpan/version/t/01base.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
#########################

use Test::More qw/no_plan/;
my $Verbose;

BEGIN {
(my $coretests = $0) =~ s'[^/]+\.t'coretests.pm';
require $coretests;
use_ok('version', 0.9902);
use_ok('version', 0.9903);
}

diag "Tests with base class" unless $ENV{PERL_CORE};
diag "Tests with base class" if $Verbose;

BaseTests("version","new","qv");
BaseTests("version","new","declare");
Expand Down
7 changes: 4 additions & 3 deletions cpan/version/t/02derived.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@

use Test::More qw/no_plan/;
use File::Temp qw/tempfile/;
my $Verbose;

BEGIN {
(my $coretests = $0) =~ s'[^/]+\.t'coretests.pm';
require $coretests;
use_ok("version", 0.9902);
use_ok("version", 0.9903);
# If we made it this far, we are ok.
}

Expand Down Expand Up @@ -57,7 +58,7 @@ sub main_reset {
undef &declare; undef *::declare; # avoid 'used once' warning
}

diag "Tests with empty derived class" unless $ENV{PERL_CORE};
diag "Tests with empty derived class" if $Verbose;

use_ok($package, 0.001);
my $testobj = $package->new(1.002_003);
Expand All @@ -80,7 +81,7 @@ main_reset;
use_ok($package, 0.001, "declare");
BaseTests($package, "parse", "declare");

diag "tests with bad subclass" unless $ENV{PERL_CORE};
diag "tests with bad subclass" if $Verbose;
$testobj = version::Bad->new(1.002_003);
isa_ok( $testobj, "version::Bad" );
eval { my $string = $testobj->numify };
Expand Down
5 changes: 3 additions & 2 deletions cpan/version/t/03require.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#########################

use Test::More qw/no_plan/;
my $Verbose;

BEGIN {
(my $coretests = $0) =~ s'[^/]+\.t'coretests.pm';
Expand All @@ -14,12 +15,12 @@ BEGIN {
# Don't want to use, because we need to make sure that the import doesn't
# fire just yet (some code does this to avoid importing qv() and delare()).
require_ok("version");
is $version::VERSION, 0.9902, "Make sure we have the correct class";
is $version::VERSION, 0.9903, "Make sure we have the correct class";
ok(!"main"->can("qv"), "We don't have the imported qv()");
ok(!"main"->can("declare"), "We don't have the imported declare()");


diag "Tests with base class" unless $ENV{PERL_CORE};
diag "Tests with base class" if $Verbose;

BaseTests("version","new",undef);
BaseTests("version","parse",undef);
1 change: 1 addition & 0 deletions cpan/version/t/04strict_lax.t
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#########################

use Test::More qw/no_plan/;
my $Verbose;

# do strict lax tests in a sub to isolate a package to test importing
SKIP: {
Expand Down
2 changes: 1 addition & 1 deletion cpan/version/t/05sigdie.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ BEGIN {


BEGIN {
use version 0.9902;
use version 0.9903;
}

pass "Didn't get caught by the wrong DIE handler, which is a good thing";
2 changes: 1 addition & 1 deletion cpan/version/t/06noop.t
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Test::More qw/no_plan/;

BEGIN {
use_ok('version', 0.9902);
use_ok('version', 0.9903);
}

my $v1 = version->new('1.2');
Expand Down
21 changes: 12 additions & 9 deletions cpan/version/t/07locale.t
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,31 @@ use File::Temp qw/tempfile/;
use POSIX qw/locale_h/;
use Test::More tests => 7;
use Config;
my $Verbose;

BEGIN {
use_ok('version', 0.9902);
use_ok('version', 0.9903);
}

SKIP: {
skip 'No locale testing for Perl < 5.6.0', 6 if $] < 5.006;
skip 'No locale testing without d_setlocale', 6 if(!$Config{d_setlocale});
skip 'No locale testing for Perl < 5.6.0', 6 if $] < 5.006;
skip 'No locale testing without d_setlocale', 6
if(!$Config{d_setlocale});

# test locale handling
my $warning;

use locale;
use locale;

local $SIG{__WARN__} = sub { $warning = $_[0] };

my $ver = 1.23; # has to be floating point number
my $loc;
my $orig_loc = setlocale(LC_NUMERIC);
ok ($ver eq "1.23", 'Not using locale yet'); # Don't use is(),
# because have to
# evaluate in current
# scope
# because have to
# evaluate in current
# scope
while (<DATA>) {
chomp;
$loc = setlocale( LC_ALL, $_);
Expand All @@ -39,9 +42,9 @@ SKIP: {
skip 'Cannot test locale handling without a comma locale', 5
unless $loc and localeconv()->{decimal_point} eq ',';

diag ("Testing locale handling with $loc") unless $ENV{PERL_CORE};
diag ("Testing locale handling with $loc") if $Verbose;

setlocale(LC_NUMERIC, $loc);
setlocale(LC_NUMERIC, $loc);
ok ($ver eq "1,23", "Using locale: $loc");
$v = version->new($ver);
unlike($warning, qr/Version string '1,23' contains invalid data/,
Expand Down
Loading

0 comments on commit 5027b3a

Please sign in to comment.