summaryrefslogtreecommitdiff
path: root/cpan/Test-Harness/t/compat/env_opts.t
blob: 6acd1fab99da666bf1d6320270b9b5e63cc6347c (plain)
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
#!/usr/bin/perl -w

use strict;
use warnings;
use Test::More tests => 12;

use Test::Harness;

sub _has_module {
    my $module = shift;
    eval "use $module";
    return $@ ? 0 : 1;
}

{

    # Should add a fake home dir? to test the rc stuff..
    local $ENV{HARNESS_OPTIONS} = 'j4:c';

    ok my $harness = Test::Harness::_new_harness, 'made harness';
    is( $harness->color, 1, "set color correctly" );
    is( $harness->jobs,  4, "set jobs correctly" );
}
SKIP: {
    skip 'Can\'t locate object method "color" via package "TAP::Formatter::HTML" (RT 82738)',4;
    skip "requires TAP::Formatter::HTML", 4
      unless _has_module('TAP::Formatter::HTML');

    local $ENV{HARNESS_OPTIONS} = 'j4:c:fTAP-Formatter-HTML';

    ok my $harness = Test::Harness::_new_harness, 'made harness';
    is( $harness->color, 1, "set color correctly" );
    is( $harness->jobs,  4, "set jobs correctly" );
    is( $harness->formatter_class, "TAP::Formatter::HTML",
        "correct formatter" );

}
SKIP: {
    skip "requires TAP::Harness::Archive", 5
      unless _has_module('TAP::Harness::Archive');

    # Test archive
    local $ENV{HARNESS_OPTIONS} = 'j4:c:a/archive.tgz';

    ok my $harness = Test::Harness::_new_harness, 'made harness';
    is( $harness->color, 1, "set color correctly" );
    is( $harness->jobs,  4, "set jobs correctly" );
    isa_ok( $harness, "TAP::Harness::Archive", "correct harness subclass" );

    # XXX: this is nasty :(
    is( $harness->{__archive_file}, "/archive.tgz", "correct archive found" );

}