File: use_tap_harness.t

package info (click to toggle)
perl 5.10.1-17squeeze6
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 74,280 kB
  • ctags: 49,087
  • sloc: perl: 319,380; ansic: 193,238; sh: 37,981; pascal: 8,830; lisp: 7,515; cpp: 3,893; makefile: 2,375; xml: 1,972; yacc: 1,555
file content (61 lines) | stat: -rwxr-xr-x 1,645 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/perl -w

use strict;
use Test::More;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
if (eval { require TAP::Harness } && TAP::Harness->VERSION >= 3) {
    plan tests => 8;
} else {
    plan skip_all => 'TAP::Harness 3+ not installed'
}

use MBTest;
use DistGen;

use_ok 'Module::Build';
ensure_blib('Module::Build');
my $tmp = MBTest->tmpdir;
my $dist = DistGen->new( dir => $tmp );
$dist->regen;

$dist->chdir_in;
#########################

# Make sure that TAP::Harness properly does its thing.
ok my $mb = Module::Build->new(
    module_name     => $dist->name,
    use_tap_harness => 1,
    quiet           => 1,
), 'Construct build object with test_file_exts parameter';

$mb->add_to_cleanup('save_out');
# Use uc() so we don't confuse the current test output
my $out = uc(stdout_of(
    sub {$mb->dispatch('test', verbose => 1)}
));

like $out, qr/^OK 1/m, 'Should see first test output';
like $out, qr/^ALL TESTS SUCCESSFUL/m, 'Should see test success message';

#########################

# Make sure that arguments are passed through to TAP::Harness.
ok $mb = Module::Build->new(
    module_name     => $dist->name,
    use_tap_harness => 1,
    tap_harness_args => { verbosity => 0 },
    quiet           => 1,
), 'Construct build object with test_file_exts parameter';

$mb->add_to_cleanup('save_out');
# Use uc() so we don't confuse the current test output
$out = uc(stdout_of(
    sub {$mb->dispatch('test', verbose => 1)}
));

unlike $out, qr/^OK 1/m, 'Should not see first test output';
like $out, qr/^ALL TESTS SUCCESSFUL/m, 'Should see test success message';

$dist->remove;

# vim:ts=4:sw=4:et:sta