1Test::Harness::Straps(3U)ser Contributed Perl DocumentatiToenst::Harness::Straps(3)
2
3
4

NAME

6       Test::Harness::Straps - detailed analysis of test results
7

SYNOPSIS

9         use Test::Harness::Straps;
10
11         my $strap = Test::Harness::Straps->new;
12
13         # Various ways to interpret a test
14         my $results = $strap->analyze($name, \@test_output);
15         my $results = $strap->analyze_fh($name, $test_filehandle);
16         my $results = $strap->analyze_file($test_file);
17
18         # UNIMPLEMENTED
19         my %total = $strap->total_results;
20
21         # Altering the behavior of the strap  UNIMPLEMENTED
22         my $verbose_output = $strap->dump_verbose();
23         $strap->dump_verbose_fh($output_filehandle);
24

WARNING

26       THIS MODULE IS FOR BACKWARDS COMPATIBILITY ONLY!  No further
27       development is planned, no bugs will be fixed.
28
29       For customizable TAP parsing please use TAP::Parser instead.
30

DESCRIPTION

32       Test::Harness is limited to printing out its results.  This makes
33       analysis of the test results difficult for anything but a human.  To
34       make it easier for programs to work with test results, we provide
35       Test::Harness::Straps.  Instead of printing the results, straps provide
36       them as raw data.  You can also configure how the tests are to be run.
37
38       The interface is currently incomplete.  Please contact the author if
39       you'd like a feature added or something change or just have comments.
40

CONSTRUCTION

42   new()
43         my $strap = Test::Harness::Straps->new;
44
45       Initialize a new strap.
46
47         $strap->_init;
48
49       Initialize the internal state of a strap to make it ready for parsing.
50

ANALYSIS

52   $strap->analyze( $name, \@output_lines )
53           my $results = $strap->analyze($name, \@test_output);
54
55       Analyzes the output of a single test, assigning it the given $name for
56       use in the total report.  Returns the $results of the test.  See
57       Results.
58
59       @test_output should be the raw output from the test, including
60       newlines.
61
62           my $results = $strap->analyze_fh($name, $test_filehandle);
63
64       Like "analyze", but it reads from the given filehandle.
65
66   $strap->analyze_file( $test_file )
67           my $results = $strap->analyze_file($test_file);
68
69       Like "analyze", but it runs the given $test_file and parses its
70       results.  It will also use that name for the total report.
71
72       Returns the full command line that will be run to test $file.
73
74       Returns the command that runs the test.  Combine this with
75       "_switches()" to build a command line.
76
77       Typically this is $^X, but you can set $ENV{HARNESS_PERL} to use a
78       different Perl than what you're running the harness under.  This might
79       be to run a threaded Perl, for example.
80
81       You can also overload this method if you've built your own strap
82       subclass, such as a PHP interpreter for a PHP-based strap.
83
84       Formats and returns the switches necessary to run the test.
85
86       Returns only defined, non-blank, trimmed switches from the parms
87       passed.
88
89         local $ENV{PERL5LIB} = $self->_INC2PERL5LIB;
90
91       Takes the current value of @INC and turns it into something suitable
92       for putting onto "PERL5LIB".
93
94         my @filtered_inc = $self->_filtered_INC;
95
96       Shortens @INC by removing redundant and unnecessary entries.  Necessary
97       for OSes with limited command line lengths, like VMS.
98
99         $self->_restore_PERL5LIB;
100
101       This restores the original value of the "PERL5LIB" environment
102       variable.  Necessary on VMS, otherwise a no-op.
103

Parsing

105       Methods for identifying what sort of line you're looking at.
106
107           my $is_diagnostic = $strap->_is_diagnostic($line, \$comment);
108
109       Checks if the given line is a comment.  If so, it will place it into
110       $comment (sans #).
111
112         my $is_header = $strap->_is_header($line);
113
114       Checks if the given line is a header (1..M) line.  If so, it places how
115       many tests there will be in "$strap->{max}", a list of which tests are
116       todo in "$strap->{todo}" and if the whole test was skipped
117       "$strap->{skip_all}" contains the reason.
118
119         my $is_bail_out = $strap->_is_bail_out($line, \$reason);
120
121       Checks if the line is a "Bail out!".  Places the reason for bailing (if
122       any) in $reason.
123
124         $strap->_reset_file_state;
125
126       Resets things like "$strap->{max}" , "$strap->{skip_all}", etc. so it's
127       ready to parse the next file.
128

EXAMPLES

130       See examples/mini_harness.plx for an example of use.
131

AUTHOR

133       Michael G Schwern "<schwern at pobox.com>", currently maintained by
134       Andy Lester "<andy at petdance.com>".
135

SEE ALSO

137       Test::Harness
138
139
140
141perl v5.28.1                      2019-02-02          Test::Harness::Straps(3)
Impressum