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 | } |
df9418cf |
27 | system("author/generate-mouse-tiny.pl"); |
314fe304 |
28 | } |
29 | |
654a7eeb |
30 | auto_include; |
74f2f839 |
31 | WriteAll; |
314fe304 |
32 | |
33 | sub create_moose_compatibility_test { |
98bbe659 |
34 | require File::Path; |
35 | require File::Spec; |
36 | require File::Basename; |
314fe304 |
37 | |
ff687069 |
38 | print "Creating xt/compatibility/* ...\n"; |
39 | |
314fe304 |
40 | # some test does not pass... currently skip it. |
41 | my %SKIP_TEST = ( |
42 | '016-trigger.t' => "trigger's argument is incompatble :(", |
43 | '020-load-class.t' => "&Moose::is_class_loaded doesn't exists", |
44 | '019-handles.t' => 'incompatible', |
314fe304 |
45 | '029-new.t' => 'Class->new(undef) incompatible', |
46 | '010-isa-or.t' => 'Mouse has a [BUG]', |
47 | '044-attribute-metaclass.t' => 'Moose::Meta::Attribute does not have a "create"', |
48 | '047-attribute-metaclass-role.t' => 'Moose::Meta::Attribute does not have a "create"', |
49 | '201-squirrel.t' => 'skip Squirrel', |
50 | '202-squirrel-role.t' => 'Squirrel is ...', |
314fe304 |
51 | '600-tiny-tiny.t' => "Moose doesn't support ::Tiny", |
52 | '601-tiny-mouse.t' => "Moose doesn't support ::Tiny", |
53 | '602-mouse-tiny.t' => "Moose doesn't support ::Tiny", |
ff687069 |
54 | '031_roles_applied_in_create.t' => 't/lib/* classes are not Moose classes/roles', |
314fe304 |
55 | ); |
56 | |
98bbe659 |
57 | File::Find::find( |
58 | { |
59 | wanted => sub { |
60 | return unless -f $_; |
ff687069 |
61 | |
62 | return if /failing/; # skip tests in failing/ directories |
63 | |
98bbe659 |
64 | my $basename = File::Basename::basename($_); |
65 | return if $basename =~ /^\./; |
66 | return if $SKIP_TEST{$basename}; |
ff687069 |
67 | |
98bbe659 |
68 | my $dirname = File::Basename::dirname($_); |
314fe304 |
69 | |
98bbe659 |
70 | my $tmpdir = File::Spec->catfile('xt', 'compatibility', $dirname); |
6d68b100 |
71 | File::Path::mkpath($tmpdir); |
314fe304 |
72 | |
98bbe659 |
73 | my $tmpfile = File::Spec->catfile($tmpdir, $basename); |
74 | open my $wfh, '>', $tmpfile or die $!; |
75 | print $wfh do { |
76 | my $src = do { |
77 | open my $rfh, '<', $_ or die $!; |
78 | my $s = do { local $/; <$rfh> }; |
79 | close $rfh; |
80 | $s; |
81 | }; |
1763d4d6 |
82 | $src =~ s/Mouse::is_class_loaded/Class::MOP::is_class_loaded/g; |
98bbe659 |
83 | $src =~ s/Mouse/Moose/g; |
84 | $src; |
85 | }; |
86 | close $wfh; |
87 | }, |
88 | no_chdir => 1 |
314fe304 |
89 | }, |
98bbe659 |
90 | 't', |
314fe304 |
91 | ); |
92 | } |
93 | |