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