generate moose compatibility test automatically
[gitmo/Mouse.git] / Makefile.PL
CommitLineData
c3398f5b 1use inc::Module::Install;
2
3name 'Mouse';
4all_from 'lib/Mouse.pm';
5
b9add211 6tests 't/*.t t/*/*.t';
7
ec53d678 8# Scalar::Util < 1.14 has a bug.
9# > Fixed looks_like_number(undef) to return false for perl >= 5.009002
10requires 'Scalar::Util' => 1.14;
272a1930 11
eab81545 12build_requires 'Test::Exception';
c3398f5b 13build_requires 'Test::More';
c3398f5b 14
314fe304 15if ($Module::Install::AUTHOR) {
16 if (eval "package foo; use Moose; 1;") {
17 if (eval 'use Module::Install::AuthorTests; 1') {
18 create_moose_compatibility_test();
19 recursive_author_tests('xt');
20 } else {
21 print "you don't have a M::I::AuthorTests.\n";
22 }
23 } else {
24 print "you don't have a moose. skipping moose compatibility test\n";
25 }
26}
27
654a7eeb 28auto_include;
74f2f839 29WriteAll;
314fe304 30
31sub create_moose_compatibility_test {
32 require Path::Class;
33 Path::Class->import('file', 'dir');
34
35 # some test does not pass... currently skip it.
36 my %SKIP_TEST = (
37 '016-trigger.t' => "trigger's argument is incompatble :(",
38 '020-load-class.t' => "&Moose::is_class_loaded doesn't exists",
39 '019-handles.t' => 'incompatible',
40 '025-more-isa.t' => 'Class::MOP::is_class_loaded is not compatible with Mouse::is_class_loaded',
41 '029-new.t' => 'Class->new(undef) incompatible',
42 '010-isa-or.t' => 'Mouse has a [BUG]',
43 '044-attribute-metaclass.t' => 'Moose::Meta::Attribute does not have a "create"',
44 '047-attribute-metaclass-role.t' => 'Moose::Meta::Attribute does not have a "create"',
45 '201-squirrel.t' => 'skip Squirrel',
46 '202-squirrel-role.t' => 'Squirrel is ...',
47 '400-define-role.t' => 'incompatibility',
48 '600-tiny-tiny.t' => "Moose doesn't support ::Tiny",
49 '601-tiny-mouse.t' => "Moose doesn't support ::Tiny",
50 '602-mouse-tiny.t' => "Moose doesn't support ::Tiny",
51 '031_roles_applied_in_create.t' => 'wtf?',
52 );
53
54 dir('t')->recurse(
55 callback => sub {
56 my $f = shift;
57 return if $f->is_dir;
58 return if $f =~ /\.sw[po]$/;
59 return if $SKIP_TEST{$f->basename};
60
61 my $dstfile = dir('xt', 'compatibility')->file($f);
62 $dstfile->dir->mkpath();
63
64 my $fh = $dstfile->openw();
65 $fh->print(do {
66 local $_ = $f->slurp;
67 s/Mouse/Moose/g;
68 $_;
69 });
70 $fh->close();
71 },
72 );
73}
74