3 use inc::Module::Install;
6 all_from 'lib/Mouse.pm';
10 # Scalar::Util < 1.14 has a bug.
11 # > Fixed looks_like_number(undef) to return false for perl >= 5.009002
12 requires 'Scalar::Util' => 1.14;
14 test_requires 'Test::More' => 0.88;
15 test_requires 'Test::Exception' => 0.27;
16 # test_requires 'Test::Output' => 0.16; # too many dependencies!
18 include 'Test::Exception'; # work around 0.27_0x (its use of diehook might be wrong)
20 recommends 'MRO::Compat' if $] < 5.010;
22 makemaker_args PL_FILES => { 'author/generate-mouse-tiny.pl' => 'lib/Mouse/Tiny.pm' };
24 if ($Module::Install::AUTHOR) {
25 local @INC = ('lib', @INC);
26 require 'lib/Mouse/Spec.pm';
27 my $require_version = Mouse::Spec->MooseVersion;
29 if (eval{ require Moose; Moose->VERSION($require_version) }) {
30 if (eval 'use Module::Install::AuthorTests; 1') {
31 create_moose_compatibility_test();
32 recursive_author_tests('xt');
34 print "you don't have a M::I::AuthorTests.\n";
37 print "you don't have Moose $require_version. skipping moose compatibility test\n";
41 WriteAll check_nmake => 0;
43 sub create_moose_compatibility_test {
46 require File::Basename;
48 print "Creating compatibility tests in xt/compatibility/* ...\n";
50 File::Path::rmtree(File::Spec->catfile('xt', 'compatibility'));
52 # some test does not pass... currently skip it.
54 '016-trigger.t' => "trigger's argument is incompatble :(",
55 '010-isa-or.t' => "Mouse has a [BUG]",
57 '052-undefined-type-in-union.t' => "Mouse accepts undefined type as a member of union types",
58 '054-anon-leak.t' => 'Moose has memory leaks',
60 '600-tiny-tiny.t' => "Moose doesn't support ::Tiny",
61 '601-tiny-mouse.t' => "Moose doesn't support ::Tiny",
62 '602-mouse-tiny.t' => "Moose doesn't support ::Tiny",
64 '031_roles_applied_in_create.t' => 't/lib/* classes are not Moose classes/roles',
74 return if /failing/; # skip tests in failing/ directories which are Moose specific
76 return if /100_with_moose/; # tests with Moose
77 return if /deprecated/;
79 my $basename = File::Basename::basename($_);
80 return if $basename =~ /^\./;
82 if(exists $SKIP_TEST{$basename}){
83 print "# skip $basename because: $SKIP_TEST{$basename}\n";
87 my $dirname = File::Basename::dirname($_);
89 my $tmpdir = File::Spec->catfile('xt', 'compatibility', $dirname);
90 File::Path::mkpath($tmpdir);
92 my $tmpfile = File::Spec->catfile($tmpdir, $basename);
93 open my $wfh, '>', $tmpfile or die $!;
96 open my $rfh, '<', $_ or die $!;
97 my $s = do { local $/; <$rfh> };
101 $src =~ s/Mouse::(?:Util::)?is_class_loaded/Class::MOP::is_class_loaded/g;
102 $src =~ s/Mouse::(?:Util::)?load_class/Class::MOP::load_class/g;
103 $src =~ s/Mouse/Moose/g;
107 push @compat_tests, $tmpfile;
113 print "Compatibility tests created.\n";
115 clean_files "@compat_tests";