4 use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
9 my $tmp = MBTest->tmpdir;
13 my $dist = DistGen->new( dir => $tmp );
16 $dist->add_file('t/special_ext.st', <<'---' );
18 use Test::More tests => 2;
19 ok(1, 'first test in special_ext');
20 ok(1, 'second test in special_ext');
25 chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
27 #########################
29 use_ok 'Module::Build';
31 # Here we make sure we can define an action that will test a particular type
33 my $mb = Module::Build->subclass(
35 sub ACTION_testspecial {
37 shift->generic_test(type => 'special');
41 module_name => $dist->name,
42 test_types => { special => '.st' }
47 $mb->dispatch('testspecial');
48 is($::x, 1, "called once");
51 $mb->add_to_cleanup('save_out');
52 # Use uc() so we don't confuse the current test output
53 my $verbose_output = uc(stdout_of(
54 sub {$mb->dispatch('testspecial', verbose => 1)}
57 like($verbose_output, qr/^OK 1 - FIRST TEST IN SPECIAL_EXT/m);
58 like($verbose_output, qr/^OK 2 - SECOND TEST IN SPECIAL_EXT/m);
60 is( $::x, 2, "called again");
62 my $output = uc(stdout_of(
63 sub {$mb->dispatch('testspecial', verbose => 0)}
65 like($output, qr/\.\.OK/);
67 is($::x, 3, "called a third time");
69 chdir( $cwd ) or die "Can't chdir to '$cwd': $!";
72 # vim:ts=4:sw=4:et:sta