Commit | Line | Data |
d1ef72e8 |
1 | #!/usr/bin/perl -w |
2 | |
3 | use strict; |
4 | use Test::More; |
5 | use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib'; |
6 | if (eval { require TAP::Parser }) { |
7 | plan tests => 8; |
8 | } else { |
9 | plan skip_all => 'TAP::Parser not installed' |
10 | } |
11 | |
12 | use MBTest; |
13 | use DistGen; |
14 | |
15 | use_ok 'Module::Build'; |
16 | ensure_blib('Module::Build'); |
17 | my $tmp = MBTest->tmpdir; |
18 | my $dist = DistGen->new( dir => $tmp ); |
19 | $dist->regen; |
20 | |
21 | $dist->chdir_in; |
22 | ######################### |
23 | |
24 | # Make sure that TAP::Harness properly does its thing. |
25 | ok my $mb = Module::Build->new( |
26 | module_name => $dist->name, |
27 | use_tap_harness => 1, |
28 | quiet => 1, |
29 | ), 'Construct build object with test_file_exts parameter'; |
30 | |
31 | $mb->add_to_cleanup('save_out'); |
32 | # Use uc() so we don't confuse the current test output |
33 | my $out = uc(stdout_of( |
34 | sub {$mb->dispatch('test', verbose => 1)} |
35 | )); |
36 | |
37 | like $out, qr/^OK 1/m, 'Should see first test output'; |
38 | like $out, qr/^ALL TESTS SUCCESSFUL/m, 'Should see test success message'; |
39 | |
40 | ######################### |
41 | |
42 | # Make sure that arguments are passed through to TAP::Harness. |
43 | ok $mb = Module::Build->new( |
44 | module_name => $dist->name, |
45 | use_tap_harness => 1, |
46 | tap_harness_args => { verbosity => 0 }, |
47 | quiet => 1, |
48 | ), 'Construct build object with test_file_exts parameter'; |
49 | |
50 | $mb->add_to_cleanup('save_out'); |
51 | # Use uc() so we don't confuse the current test output |
52 | $out = uc(stdout_of( |
53 | sub {$mb->dispatch('test', verbose => 1)} |
54 | )); |
55 | |
56 | unlike $out, qr/^OK 1/m, 'Should not see first test output'; |
57 | like $out, qr/^ALL TESTS SUCCESSFUL/m, 'Should see test success message'; |
58 | |
59 | $dist->remove; |
60 | |
61 | # vim:ts=4:sw=4:et:sta |