tagged release 0.7.1
[parrot.git] / languages / scheme / t / harness
blob0191cc4b13b3745e2c5f33d537e9b76992d4674f
1 # $Id$
3 =head1 NAME
5 languages/scheme/t/harness - A harness for scheme
7 =head1 SYNOPSIS
9   cd languages && perl -I../lib scheme/t/harness --files
11   cd languages && perl -I../lib scheme/t/harness 
13   cd languages && perl -I../lib scheme/t/harness \
14                    scheme/t/logic/basic.t \
15                    scheme/t/logic/defines.t
17 =head1 DESCRIPTION
19 If I'm called with a single
20 argument of "--files", I just return a list of files to process.
21 This list is one per line, and is relative to the languages dir.
23 If I'm called with no args, I run the complete suite.
25 Otherwise I run the tests that were passed on the command line.
27 =cut
29 use strict;
30 use FindBin;
31 use lib "$FindBin::Bin/../../../lib", "$FindBin::Bin/..";;
33 use Cwd();
34 use File::Spec;
35 use Test::Harness();
37 my $language = 'scheme';
39 if ( grep { m/^--files$/ } @ARGV ) {
40     # Only the Makefile in 'parrot/languages' uses --files
41     my $dir = File::Spec->catfile( $language, 't' );
42     my @files = glob( File::Spec->catfile( $dir, '*', '*.t' ) );
43     print join( "\n", @files );
44     print "\n" if scalar(@files);
45 } else { 
46     my @files;
47     if ( scalar(@ARGV) ) {
48         # Someone specified tests for me to run.
49         @files = grep { -f $_ } @ARGV
50     } else {
51         ( undef, undef, my $current_dir ) = File::Spec->splitpath( Cwd::getcwd() );
52         if ( $current_dir eq 'languages' ) {
53             @files = glob( File::Spec->catfile( $language, 't', '*', '*.t' ) );
54         }
55         elsif ( $current_dir eq $language ) {
56             @files = glob( File::Spec->catfile( 't', '*', '*.t' ) );
57         }
58     }
59     Test::Harness::runtests( @files ) if scalar( @files );
62 =head1 SEE ALSO
64   F<languages/tcl/t/harness>, F<languages/scheme/t/harness>, F<languages/m4/t/harness>, F<languages/python/t/harness>
66 =cut