Commit | Line | Data |
c3398f5b |
1 | use inc::Module::Install; |
9e3c345e |
2 | use 5.008; |
c3398f5b |
3 | |
4 | name 'Mouse'; |
5 | all_from 'lib/Mouse.pm'; |
6 | |
b9add211 |
7 | tests 't/*.t t/*/*.t'; |
8 | |
ec53d678 |
9 | # Scalar::Util < 1.14 has a bug. |
10 | # > Fixed looks_like_number(undef) to return false for perl >= 5.009002 |
11 | requires 'Scalar::Util' => 1.14; |
272a1930 |
12 | |
1397be4c |
13 | build_requires 'Test::Exception' => 0.21; |
14 | build_requires 'Test::More' => 0.80; |
c3398f5b |
15 | |
314fe304 |
16 | if ($Module::Install::AUTHOR) { |
17 | if (eval "package foo; use Moose; 1;") { |
18 | if (eval 'use Module::Install::AuthorTests; 1') { |
19 | create_moose_compatibility_test(); |
20 | recursive_author_tests('xt'); |
21 | } else { |
22 | print "you don't have a M::I::AuthorTests.\n"; |
23 | } |
24 | } else { |
25 | print "you don't have a moose. skipping moose compatibility test\n"; |
26 | } |
27 | } |
28 | |
654a7eeb |
29 | auto_include; |
74f2f839 |
30 | WriteAll; |
314fe304 |
31 | |
32 | sub create_moose_compatibility_test { |
98bbe659 |
33 | require File::Path; |
34 | require File::Spec; |
35 | require File::Basename; |
314fe304 |
36 | |
37 | # some test does not pass... currently skip it. |
38 | my %SKIP_TEST = ( |
39 | '016-trigger.t' => "trigger's argument is incompatble :(", |
40 | '020-load-class.t' => "&Moose::is_class_loaded doesn't exists", |
41 | '019-handles.t' => 'incompatible', |
42 | '025-more-isa.t' => 'Class::MOP::is_class_loaded is not compatible with Mouse::is_class_loaded', |
43 | '029-new.t' => 'Class->new(undef) incompatible', |
44 | '010-isa-or.t' => 'Mouse has a [BUG]', |
45 | '044-attribute-metaclass.t' => 'Moose::Meta::Attribute does not have a "create"', |
46 | '047-attribute-metaclass-role.t' => 'Moose::Meta::Attribute does not have a "create"', |
47 | '201-squirrel.t' => 'skip Squirrel', |
48 | '202-squirrel-role.t' => 'Squirrel is ...', |
49 | '400-define-role.t' => 'incompatibility', |
50 | '600-tiny-tiny.t' => "Moose doesn't support ::Tiny", |
51 | '601-tiny-mouse.t' => "Moose doesn't support ::Tiny", |
52 | '602-mouse-tiny.t' => "Moose doesn't support ::Tiny", |
53 | '031_roles_applied_in_create.t' => 'wtf?', |
54 | ); |
55 | |
98bbe659 |
56 | File::Find::find( |
57 | { |
58 | wanted => sub { |
59 | return unless -f $_; |
60 | my $basename = File::Basename::basename($_); |
61 | return if $basename =~ /^\./; |
62 | return if $SKIP_TEST{$basename}; |
63 | |
64 | my $dirname = File::Basename::dirname($_); |
314fe304 |
65 | |
98bbe659 |
66 | my $tmpdir = File::Spec->catfile('xt', 'compatibility', $dirname); |
67 | File::Path::make_path($tmpdir); |
314fe304 |
68 | |
98bbe659 |
69 | my $tmpfile = File::Spec->catfile($tmpdir, $basename); |
70 | open my $wfh, '>', $tmpfile or die $!; |
71 | print $wfh do { |
72 | my $src = do { |
73 | open my $rfh, '<', $_ or die $!; |
74 | my $s = do { local $/; <$rfh> }; |
75 | close $rfh; |
76 | $s; |
77 | }; |
1763d4d6 |
78 | $src =~ s/Mouse::is_class_loaded/Class::MOP::is_class_loaded/g; |
98bbe659 |
79 | $src =~ s/Mouse/Moose/g; |
80 | $src; |
81 | }; |
82 | close $wfh; |
83 | }, |
84 | no_chdir => 1 |
314fe304 |
85 | }, |
98bbe659 |
86 | 't', |
314fe304 |
87 | ); |
88 | } |
89 | |