Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some fixes #80

Merged
merged 9 commits into from Nov 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 1 addition & 6 deletions .travis.yml
Expand Up @@ -5,10 +5,5 @@ install:
perl:
- "5.8"
- "5.10"
- "5.12"
- "5.14"
- "5.16"
- "5.18"
- "5.20"
- "5.22"
- "5.24"
- "5.26"
8 changes: 2 additions & 6 deletions builder/MyBuilder.pm
Expand Up @@ -40,19 +40,15 @@ sub ACTION_code {
close($fh);

unless ($self->pureperl_only) {
require ExtUtils::ParseXS;
for my $xs (qw(
xs-src/MouseAccessor.xs
xs-src/MouseAttribute.xs
xs-src/MouseTypeConstraints.xs
xs-src/MouseUtil.xs
)) {
(my $c = $xs) =~ s/\.xs\z/.c/;
print "$xs => $c\n";
ExtUtils::ParseXS::process_file(
filename => $xs,
output => $c,
);
next if $self->up_to_date($xs, $c);
$self->compile_xs($xs, outfile => $c);
}
}

Expand Down
2 changes: 2 additions & 0 deletions cpanfile
Expand Up @@ -10,6 +10,8 @@ on configure => sub {
requires 'Devel::PPPort', '3.33';
requires 'ExtUtils::ParseXS', '3.22';
requires 'Module::Build::XSUtil';
# prevent "Mouse::Deprecated does not define $VERSION" error in test under perl 5.8
requires 'version', '0.9913';
};

on 'test' => sub {
Expand Down
2 changes: 1 addition & 1 deletion lib/Mouse.pm
Expand Up @@ -3,7 +3,7 @@ use 5.008_005;

use Mouse::Exporter; # enables strict and warnings

our $VERSION = 'v2.4.10';
use version; our $VERSION = version->declare('v2.4.10');

use Carp ();
use Scalar::Util ();
Expand Down
2 changes: 1 addition & 1 deletion lib/Mouse/Role.pm
@@ -1,7 +1,7 @@
package Mouse::Role;
use Mouse::Exporter; # enables strict and warnings

our $VERSION = 'v2.4.10';
use version; our $VERSION = version->declare('v2.4.10');

use Carp ();
use Scalar::Util ();
Expand Down
2 changes: 1 addition & 1 deletion lib/Mouse/Spec.pm
Expand Up @@ -2,7 +2,7 @@ package Mouse::Spec;
use strict;
use warnings;

our $VERSION = 'v2.4.10';
use version; our $VERSION = version->declare('v2.4.10');

our $MouseVersion = $VERSION;
our $MooseVersion = '1.13';
Expand Down
2 changes: 1 addition & 1 deletion lib/Mouse/Util.pm
Expand Up @@ -50,7 +50,7 @@ BEGIN{
},
);

our $VERSION = 'v2.4.10';
use version; our $VERSION = version->declare('v2.4.10');

my $xs = !(defined(&is_valid_class_name) || $ENV{MOUSE_PUREPERL} || $ENV{PERL_ONLY});

Expand Down
21 changes: 3 additions & 18 deletions t/000_recipes/moose_cookbook_basics_recipe5.t
@@ -1,23 +1,11 @@
#!/usr/bin/perl -w

use strict;
use Test::More 'no_plan';
use Test::More;
use Test::Exception;
$| = 1;



# =begin testing SETUP
BEGIN {
eval 'use HTTP::Headers; use Params::Coerce; use URI;';
if ($@) {
diag 'HTTP::Headers, Params::Coerce & URI required for this test';
ok(1);
exit 0;
}
}


use Test::Requires qw(HTTP::Headers Params::Coerce URI);

# =begin testing SETUP
{
Expand Down Expand Up @@ -135,7 +123,4 @@ isa_ok( $r, 'Request' );
}
}




1;
done_testing;
4 changes: 2 additions & 2 deletions t/001_mouse/043-parameterized-type.t
Expand Up @@ -228,7 +228,7 @@ is_deeply \%th_clone, \%th, 'the hash iterator is initialized';


for my $i(1 .. 2) {
diag "derived from parameterized types #$i";
note "derived from parameterized types #$i";

my $myhashref = subtype 'MyHashRef',
as 'HashRef[Value]',
Expand Down Expand Up @@ -257,7 +257,7 @@ for my $i(1 .. 2) {
require Data::Dump::Streamer;
my $s = Data::Dump::Streamer::Dump($myhashref)->Out();
$s =~ s/[ ]{4}/ /g;
diag $s;
note $s;
};
}
ok !$myhashref->check({ a => 42, b => [] });
Expand Down
4 changes: 0 additions & 4 deletions t/001_mouse/055-exporter.t
Expand Up @@ -15,8 +15,6 @@ BEGIN{

sub foo{ 100 }

$INC{'MyMouse.pm'}++;

package MyMouseEx;
use Mouse;
Mouse::Exporter->setup_import_methods(
Expand All @@ -29,8 +27,6 @@ BEGIN{
);

sub bar{ 200 }

$INC{'MyMouseEx.pm'}++;
}

can_ok 'MyMouse', qw(import unimport);
Expand Down
10 changes: 10 additions & 0 deletions t/030_roles/role_conflict_and_inheritance.t
Expand Up @@ -6,21 +6,31 @@ use Test::More;
package Role::Foo1;
use Mouse::Role;
sub foo { 'foo1' }
}

{
package Role::Foo2;
use Mouse::Role;
sub foo { 'foo2' }
}

{
package BarSuper;
use Mouse;
sub foo { 'foo3' }
}

my @warn;
{
package BarSub;
use Mouse;
extends 'BarSuper';
local $SIG{__WARN__} = sub { push @warn, @_ };
with 'Role::Foo1', 'Role::Foo2';
}

like $warn[0], qr/\QDue to a method name conflict in roles 'Role::Foo1' and 'Role::Foo2', the behavior of method 'foo' might be incompatible with Moose, check out BarSub/;

is(BarSub->new->foo, "foo3");

done_testing;
7 changes: 5 additions & 2 deletions t/040_type_constraints/018_custom_parameterized_types.t
Expand Up @@ -47,8 +47,9 @@ lives_ok {
ok($t->check({ one => 1, two => 2 }), '... validated it correctly');
ok(!$t->check({ one1 => 1, two2 => 2 }), '... validated it correctly');

local $TODO = 'Mouse does not support equals()';
{ local $TODO = 'Mouse does not support equals()';
ok( $t->equals($t), "equals to self" );
}
ok( !$t->equals($t->parent), "not equal to parent" );
}

Expand All @@ -60,11 +61,13 @@ ok(!$hoi->check({ one => 'uno', two => 'dos' }), '... validated it correctly');
ok(!$hoi->check({ one1 => 'un', two2 => 'deux' }), '... validated it correctly');
{ local $TODO = 'Mouse does not support equals()';
ok( $hoi->equals($hoi), "equals to self" );
}
ok( !$hoi->equals($hoi->parent), "equals to self" );
ok( !$hoi->equals(find_type_constraint('AlphaKeyHash')), "not equal to unparametrized self" );
{ local $TODO = 'Mouse does not support equals()';
ok( $hoi->equals( Mouse::Meta::TypeConstraint->new( name => "Blah", parent => find_type_constraint("AlphaKeyHash"), type_parameter => find_type_constraint("Int") ) ), "equal to clone" );
}
ok( !$hoi->equals( Mouse::Meta::TypeConstraint->new( name => "Oink", parent => find_type_constraint("AlphaKeyHash"), type_parameter => find_type_constraint("Str") ) ), "not equal to different parameter" );
} # end TODO

my $th = Mouse::Util::TypeConstraints::find_or_parse_type_constraint('Trihash[Bool]');
ok(!$th->check({ one => 1, two => 1 }), '... validated it correctly');
Expand Down
3 changes: 2 additions & 1 deletion t/040_type_constraints/021_maybe_type_constraint.t
Expand Up @@ -10,6 +10,7 @@ use Test::More;
use Test::Exception;

use Mouse::Util::TypeConstraints;
use Mouse::Util;

my $type = Mouse::Util::TypeConstraints::find_or_parse_type_constraint('Maybe[Int]');
isa_ok($type, 'Mouse::Meta::TypeConstraint');
Expand Down Expand Up @@ -106,7 +107,7 @@ ok $Maybe_Int->check(1)
ok $obj->Maybe_Int(1)
=> 'assigned (1)';
{
local $TODO = "considered miss design";
local $TODO = "considered miss design" if Mouse::Util::MOUSE_XS();
ok eval { $Maybe_Int->check() }
=> 'passed ()';
}
Expand Down
2 changes: 1 addition & 1 deletion tool/generate-mouse-tiny.pl
Expand Up @@ -102,7 +102,7 @@ sub uniq{
print { $handle } << "EOF";
package Mouse::Tiny;

our \$VERSION = '$Mouse::Spec::VERSION';
use version; our \$VERSION = version->declare('$Mouse::Spec::VERSION');

Mouse::Exporter->setup_import_methods(also => 'Mouse');

Expand Down