# $Id: /mirror/trunk/languages/urm/t/harness 11501 2006-02-10T18:27:13.457666Z particle  $

=head1 NAME

languages/urm/t/harness - A harness for urm

=head1 SYNOPSIS

  cd languages && perl -I../lib urm/t/harness ---files

  cd languages && perl -I../lib urm/t/harness 

  cd languages && perl -I../lib urm/t/harness urm/t/testmmu.t urm/t/testmmu2.t 

=head1 DESCRIPTION

If I'm called with a single argument of "--files",
 I just return a list of files to process.
This list is one per line, and is relative to the languages dir.

If I'm called with no args, I run the complete suite.

Otherwise I run the tests that were passed on the command line.

=cut

use strict;
use FindBin;

use lib '../../lib';
use Parrot::Config;
use Test::Harness();

my $language = 'urm';

if ( grep { m/^--files$/ } @ARGV ) {
    # Only the Makefile in 'parrot/languages' uses --files
    my $dir = File::Spec->catfile( $language, 't' );
    my @files = glob( File::Spec->catfile( $dir, '*.t' ) );
    print join( "\n", @files );
    print "\n" if scalar(@files);
} else { 
    my @files;
    if ( scalar(@ARGV) ) {
        # Someone specified tests for me to run.
        @files = grep { -f $_ } @ARGV
  }
  else 
  {
      ( undef, undef, my $current_dir ) = File::Spec->splitpath( Cwd::getcwd() );
      if ( $current_dir eq 'languages' ) {
          @files = glob( File::Spec->catfile( $language, 't', '*.t' ) );
      }
      elsif ( $current_dir eq $language ) {
          @files = glob( File::Spec->catfile( 't', '*.t' ) );
      }
  }
  Test::Harness::runtests( @files ) if scalar( @files );
}
