5 languages/pipp/t/harness - A harness for Pipp
9 cd languages && perl -I../lib pipp/t/harness --files
11 cd languages && perl -I../lib pipp/t/harness
13 cd languages && perl -I../lib pipp/t/harness --with-php
15 cd languages && perl -I../lib pipp/t/harness --with-phc
17 cd languages && perl -I../lib pipp/t/harness --with-antlr3
19 cd languages && perl -I../lib pipp/t/harness --with-pct
21 cd languages && perl -I../lib pipp/t/harness \
26 If I'm called with a single
27 argument of "--files", I just return a list of files to process.
28 This list is one per line, and is relative to the languages dir.
30 If I'm called with no args, I run the complete suite.
32 Otherwise I run the tests that were passed on the command line.
45 my $language = 'pipp';
47 if ( grep { m/^--files$/ } @ARGV ) {
48 # Only the Makefile in 'parrot/languages' uses --files
49 my $dir = File::Spec->catfile( $language, 't' );
50 my @files = glob( File::Spec->catfile( $dir, '*/*.t' ) );
51 print join( "\n", @files );
52 print "\n" if scalar(@files);
55 # TODO: use Getopt::Long or such
56 my $with_php = ( grep { m/^--with-php$/ } @ARGV ) ? 1 : 0;
57 @ARGV = grep { ! m/^--with-php$/ } @ARGV;
59 my $with_phc = ( grep { m/^--with-phc$/ } @ARGV ) ? 1 : 0;
60 @ARGV = grep { ! m/^--with-phc$/ } @ARGV;
62 my $with_antlr3 = ( grep { m/^--with-antlr3$/ } @ARGV ) ? 1 : 0;
63 @ARGV = grep { ! m/^--with-antlr3$/ } @ARGV;
65 my $with_pct = ( grep { m/^--with-pct$/ } @ARGV ) ? 1 : 0;
66 @ARGV = grep { ! m/^--with-pct$/ } @ARGV;
68 if ( scalar(@ARGV) ) {
69 # Someone specified tests for me to run.
70 @files = grep { -f $_ } @ARGV
72 ( undef, undef, my $current_dir ) = File::Spec->splitpath( Cwd::getcwd() );
73 if ( $current_dir eq 'languages' ) {
74 @files = glob( File::Spec->catfile( $language, 't', '*/*.t' ) );
76 elsif ( $current_dir eq $language ) {
77 @files = glob( File::Spec->catfile( 't', '*/*.t' ) );
84 # XXX There should be a better to indicate which implementation should be used
86 $ENV{PARROT_PIPP_TEST_MODULE} = 'Parrot::Test::Pipp::PHP';
89 $ENV{PARROT_PIPP_TEST_MODULE} = 'Parrot::Test::Pipp::Phc';
91 elsif ( $with_antlr3 ) {
92 $ENV{PARROT_PIPP_TEST_MODULE} = 'Parrot::Test::Pipp::Antlr3';
95 $ENV{PARROT_PIPP_TEST_MODULE} = 'Parrot::Test::Pipp::PCT';
98 $ENV{PARROT_PIPP_TEST_MODULE} = 'Parrot::Test::Pipp::PCT';
101 Test::Harness::runtests( @files ) if scalar( @files );
106 Mostly taken from bc/t/harness.
110 F<languages/perl6/t/harness>
114 Bernhard Schmalhofer - <Bernhard.Schmalhofer@gmx.de>
120 # cperl-indent-level: 4
123 # vim: expandtab shiftwidth=4: