1#!/usr/bin/perl -w
2
3use strict;
4use warnings;
5use Test::More tests => 12;
6
7use Test::Harness;
8
9sub _has_module {
10    my $module = shift;
11    eval "use $module";
12    return $@ ? 0 : 1;
13}
14
15{
16
17    # Should add a fake home dir? to test the rc stuff..
18    local $ENV{HARNESS_OPTIONS} = 'j4:c';
19
20    ok my $harness = Test::Harness::_new_harness, 'made harness';
21    is( $harness->color, 1, "set color correctly" );
22    is( $harness->jobs,  4, "set jobs correctly" );
23}
24SKIP: {
25    skip 'Can\'t locate object method "color" via package "TAP::Formatter::HTML" (RT 82738)',4;
26    skip "requires TAP::Formatter::HTML", 4
27      unless _has_module('TAP::Formatter::HTML');
28
29    local $ENV{HARNESS_OPTIONS} = 'j4:c:fTAP-Formatter-HTML';
30
31    ok my $harness = Test::Harness::_new_harness, 'made harness';
32    is( $harness->color, 1, "set color correctly" );
33    is( $harness->jobs,  4, "set jobs correctly" );
34    is( $harness->formatter_class, "TAP::Formatter::HTML",
35        "correct formatter" );
36
37}
38SKIP: {
39    skip "requires TAP::Harness::Archive", 5
40      unless _has_module('TAP::Harness::Archive');
41
42    # Test archive
43    local $ENV{HARNESS_OPTIONS} = 'j4:c:a/archive.tgz';
44
45    ok my $harness = Test::Harness::_new_harness, 'made harness';
46    is( $harness->color, 1, "set color correctly" );
47    is( $harness->jobs,  4, "set jobs correctly" );
48    isa_ok( $harness, "TAP::Harness::Archive", "correct harness subclass" );
49
50    # XXX: this is nasty :(
51    is( $harness->{__archive_file}, "/archive.tgz", "correct archive found" );
52
53}
54
55