use strict;
use lib 't/lib';
-use MBTest tests => 15 + 12;
+use MBTest tests => 25;
-use_ok 'Module::Build';
-ensure_blib('Module::Build');
-
-my $tmp = MBTest->tmpdir;
+blib_load('Module::Build');
use DistGen;
-my $dist = DistGen->new(dir => $tmp);
+my $dist = DistGen->new()->chdir_in;
$dist->add_file('t/special_ext.st', <<'---');
-#!perl
+#!perl
use Test::More tests => 2;
ok(1, 'first test in special_ext');
ok(1, 'second test in special_ext');
---
$dist->add_file('t/another_ext.at', <<'---');
-#!perl
+#!perl
use Test::More tests => 2;
ok(1, 'first test in another_ext');
ok(1, 'second test in another_ext');
---
$dist->add_file('t/foo.txt', <<'---');
-#!perl
+#!perl
use Test::More tests => 1;
ok 0, "don't run this non-test file";
die "don't run this non-test file";
---
$dist->regen;
-$dist->chdir_in;
#########################
my $mb = Module::Build->subclass(
code => q#
- sub ACTION_testspecial {
+ sub ACTION_testspecial {
shift->generic_test(type => 'special');
}
- sub ACTION_testanother {
+ sub ACTION_testanother {
shift->generic_test(type => 'another');
}
#
is(scalar(@{[$all_output =~ m/OK/mg]}), 8 );
is(scalar(@{[$all_output =~ m/ALL TESTS SUCCESSFUL\./mg]}), 1);
-$dist->remove;
-
{ # once-again
+$dist->revert;
+
$dist->add_file('t/foo/special.st', <<'---');
-#!perl
+#!perl
use Test::More tests => 2;
ok(1, 'first test in special_ext');
ok(1, 'second test in special_ext');
ok 1;
---
$dist->regen;
-$dist->chdir_in;
my $mb = Module::Build->subclass(
code => q#
- sub ACTION_testspecial {
+ sub ACTION_testspecial {
shift->generic_test(type => 'special');
}
- sub ACTION_testanother {
+ sub ACTION_testanother {
shift->generic_test(type => 'another');
}
#
is(scalar(@{[$all_output =~ m/(OK 1)/mg]}), 5 );
is(scalar(@{[$all_output =~ m/(OK)/mg]}), 13 );
-$dist->remove;
} # end once-again
# vim:ts=4:sw=4:et:sta