5 print '1..0 # Child test output confuses harness';
11 use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
12 use MBTest tests => 8;
16 my $tmp = MBTest->tmpdir;
20 my $dist = DistGen->new( dir => $tmp );
23 $dist->add_file('t/special_ext.st', <<'---' );
25 use Test::More tests => 2;
26 ok(1, 'first test in special_ext');
27 ok(1, 'second test in special_ext');
32 chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!";
34 #########################
36 use_ok 'Module::Build';
38 # Here we make sure we can define an action that will test a particular type
40 my $mb = Module::Build->subclass(
42 sub ACTION_testspecial {
44 shift->generic_test(type => 'special');
48 module_name => $dist->name,
49 test_types => { special => '.st' }
54 $mb->dispatch('testspecial');
55 is($::x, 1, "called once");
58 $mb->add_to_cleanup('save_out');
59 # Use uc() so we don't confuse the current test output
60 my $verbose_output = uc(stdout_of(
61 sub {$mb->dispatch('testspecial', verbose => 1)}
64 like($verbose_output, qr/^OK 1 - FIRST TEST IN SPECIAL_EXT/m);
65 like($verbose_output, qr/^OK 2 - SECOND TEST IN SPECIAL_EXT/m);
67 is( $::x, 2, "called again");
69 my $output = uc(stdout_of(
70 sub {$mb->dispatch('testspecial', verbose => 0)}
72 like($output, qr/\.\.OK/);
74 is($::x, 3, "called a third time");
76 chdir( $cwd ) or die "Can't chdir to '$cwd': $!";
79 # vim:ts=4:sw=4:et:sta