File Coverage

File:lib/Parrot/Harness/DefaultTests.pm
Coverage:100.0%

linestmtbrancondsubcode
1# Copyright (C) 2006-2011, Parrot Foundation.
2
3 - 29
=head1 NAME

Parrot::Harness::DefaultTests - Tests run by default by F<t/harness>

=head1 DESCRIPTION

Upon request, this package exports four arrays holding glob patterns for
directories holding test files:

    @runcore_tests
    @core_tests
    @library_tests
    @configure_tests

The package also exports one array holding a list of test files:

    @developing_tests

The definition of these lists is found in
F<lib/Parrot/Harness/TestSets.pm>.

In addition, Parrot::Harness::DefaultTests exports B<by default> one
subroutine:  C<get_common_tests()>.  In list context, C<get_common_tests()>
returns a list of shell-expandable paths to the most common tests.  In scalar
context it returns a reference to that list.

=cut
30
31package Parrot::Harness::DefaultTests;
32
33
8
8
8
use strict;
34
8
8
8
use warnings;
35
36our (
37    @runcore_tests,
38    @core_tests,
39    @library_tests,
40    @configure_tests,
41    @developing_tests
42);
43
8
8
8
use base qw( Exporter );
44our @EXPORT = qw( get_common_tests );
45our @EXPORT_OK = qw(
46    @runcore_tests
47    @core_tests
48    @library_tests
49    @configure_tests
50    @developing_tests
51);
52
8
8
8
use lib qw( ./lib );
53
8
use Parrot::Harness::TestSets qw(
54    %test_groups
55    @major_test_group
56    @near_core_test_group
57
8
8
);
58
59# runcore tests are always run.
60@runcore_tests = @{ $test_groups{runcore} };
61
62# core tests are run unless --runcore-tests is present. Typically
63# this list and the list above are run in response to --core-tests
64foreach my $el (@near_core_test_group) {
65    push @core_tests, @{$el};
66}
67
68# library tests are run unless --runcore-tests or --core-tests is present.
69foreach my $el (@major_test_group) {
70    push @library_tests, @{$el};
71}
72
73# configure tests are tests to be run at the beginning of 'make test';
74@configure_tests = @{ $test_groups{configure} };
75
76@developing_tests = glob("@{ $test_groups{codingstd} }");
77
78sub get_common_tests {
79
8
    my ($longopts) = @_;
80
81
8
    my @common_tests = @runcore_tests;
82
8
    unless ($longopts->{runcore_tests_only}) {
83
6
       push @common_tests, @core_tests;
84
6
       unless ($longopts->{core_tests_only}) {
85
4
           push @common_tests, @library_tests;
86
4
           unshift @common_tests, @configure_tests;
87       }
88    }
89    wantarray
90        ? return @common_tests
91
8
        : return [ @common_tests ];
92}
93
941;
95
96# Local Variables:
97# mode: cperl
98# cperl-indent-level: 4
99# fill-column: 100
100# End:
101# vim: expandtab shiftwidth=4: