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 => 9;
14 use_ok 'Module::Build';
15 ensure_blib('Module::Build');
17 my $tmp = MBTest->tmpdir;
21 my $dist = DistGen->new( dir => $tmp );
24 $dist->add_file('t/special_ext.st', <<'---' );
26 use Test::More tests => 2;
27 ok(1, 'first test in special_ext');
28 ok(1, 'second test in special_ext');
35 #########################
37 # Here we make sure we can define an action that will test a particular type
39 my $mb = Module::Build->subclass(
41 sub ACTION_testspecial {
43 shift->generic_test(type => 'special');
47 module_name => $dist->name,
48 test_types => { special => '.st' }
53 $mb->dispatch('testspecial');
54 is($::x, 1, "called once");
57 $mb->add_to_cleanup('save_out');
58 # Use uc() so we don't confuse the current test output
59 my $verbose_output = uc(stdout_of(
60 sub {$mb->dispatch('testspecial', verbose => 1)}
63 like($verbose_output, qr/^OK 1 - FIRST TEST IN SPECIAL_EXT/m);
64 like($verbose_output, qr/^OK 2 - SECOND TEST IN SPECIAL_EXT/m);
66 is( $::x, 2, "called again");
68 my $output = uc(stdout_of(
69 sub {$mb->dispatch('testspecial', verbose => 0)}
71 like($output, qr/\.\. ?OK/);
73 is($::x, 3, "called a third time");
77 # vim:ts=4:sw=4:et:sta