MIME-AltWords

 view release on metacpan or  search on metacpan

testlib/PtsTestLib.pm  view on Meta::CPAN

#! /bin/sh
eval '(exit $?0)' && eval 'PERL_BADLANG=x;PATH="$PATH:.";export PERL_BADLANG\
 PATH;exec perl -x -S -- "$0" ${1+"$@"};#'if 0;eval 'setenv PERL_BADLANG x\
;setenv PATH "$PATH":.;exec perl -x -S -- "$0" $argv:q;#'.q
#!perl -w
+push@INC,'.';$0=~/(.*)/s;do(index($1,"/")<0?"./$1":$1);die$@if$@__END__+if 0
;#Don't touch/remove lines 1--7: http://www.inf.bme.hu/~pts/Magic.Perl.Header
#
# pts-test-lib.t -- a simple Perl test framework based on Test::More + aspects of Test::Inline
# by pts@fazekas.hu at Mon Dec 26 17:27:27 CET 2005
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# Dat: perl -MTest::Harness "-eruntests@ARGV" test1.t
#      test1.t:
#      use Test::More qw(no_plan);
#      BEGIN { use_ok( 'integer' ); }
#      is(1, 1.0, "foo");
#      isnt(1, '1.0', "bar");
# Dat: --harness should display: "pts-test....ok\n"
# Imp: plan the # tests for Test::
# Imp: skip "=begin" inside strings or otherwise quoted
# 

package PtsTestLib;
use integer;
use strict;
BEGIN {
  $main::Id='$Id: pts-test.pl,v 1.2 2006/04/26 07:42:33 pts Exp $';
  $main::VERSION=$1 if $main::Id=~/,v *([\d.]+)/;
}
my $SELF='pts-test.pl';

#** @param $_[0] output filehandle
sub banner($) {
  my $fh=$_[0];
  print $fh "This is $SELF, version $main::VERSION, by <pts\@fazekas.hu>\n"
           ."The license is GNU GPL >=2.0. It comes without warranty. USE AT YOUR OWN RISK!\n\n";
}
#** @param $_[0] output filehandle
sub usage($) {
  my $fh=$_[0];
  print $fh "Usage: $0 [<option> ...] [--] { <script.pl> | <script.t> } ...\n",
            "Options:\n",
	    "--help  this help\n",
	    "--harness  run whole test through Test::Harness\n";
}

my $do_help=0;
my $do_harness=0;
my $do_work=(defined $ENV{PTS_TEST_DO});
@ARGV=split("\n",$ENV{PTS_TEST_DO}) if !@ARGV and $do_work;

{ my $I;
  for ($I=0;$I<@ARGV;$I++) {
    if ($ARGV[$I]eq'--') { $I++; last }
    elsif (substr($ARGV[$I],0,1)ne'-') { last }
    elsif ($ARGV[$I]eq'--help') { $do_help++ }
    elsif ($ARGV[$I]eq'--harness') { $do_harness++ }
    elsif ($ARGV[$I]eq'--work') { $do_work++ }
    else { die "$SELF: unknown option: $ARGV[$I]\n" }
  }



( run in 0.722 second using v1.01-cache-2.11-cpan-39bf76dae61 )