Upgrade to Devel::PPPort 3.15
[p5sagit/p5-mst-13.2.git] / ext / Devel / PPPort / mktests.PL
CommitLineData
adfe19db 1################################################################################
2#
3# mktests.PL -- generate test files for Devel::PPPort
4#
5################################################################################
6#
51d6c659 7# $Revision: 30 $
adfe19db 8# $Author: mhx $
51d6c659 9# $Date: 2009/01/18 14:10:49 +0100 $
adfe19db 10#
11################################################################################
12#
51d6c659 13# Version 3.x, Copyright (C) 2004-2009, Marcus Holland-Moritz.
adfe19db 14# Version 2.x, Copyright (C) 2001, Paul Marquess.
15# Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
16#
17# This program is free software; you can redistribute it and/or
18# modify it under the same terms as Perl itself.
19#
20################################################################################
21
22use strict;
23$^W = 1;
24require "parts/ppptools.pl";
25
26my $template = do { local $/; <DATA> };
27
236afa0a 28generate_tests();
adfe19db 29
236afa0a 30sub generate_tests
31{
32 my @tests;
33 my $file;
adfe19db 34
1d088ed8 35 for $file (all_files_in_dir('parts/inc')) {
236afa0a 36 my($testfile) = $file =~ /(\w+)\.?$/; # VMS has a trailing dot
37 $testfile = "t/$testfile.t";
38
39 my $spec = parse_partspec($file);
40 my $plan = 0;
41
42 if (exists $spec->{tests}) {
43 exists $spec->{OPTIONS}{tests} &&
44 exists $spec->{OPTIONS}{tests}{plan}
45 or die "No plan for tests in $file\n";
46
47 print "generating $testfile\n";
48
49 my $tmpl = $template;
50 $tmpl =~ s/__SOURCE__/$file/mg;
51 $tmpl =~ s/__PLAN__/$spec->{OPTIONS}{tests}{plan}/mg;
52 $tmpl =~ s/^__TESTS__$/$spec->{tests}/mg;
53
54 open FH, ">$testfile" or die "$testfile: $!\n";
55 print FH $tmpl;
56 close FH;
57
58 push @tests, $testfile;
59 }
adfe19db 60 }
236afa0a 61
62 return @tests;
adfe19db 63}
64
adfe19db 65__DATA__
66################################################################################
67#
68# !!!!! Do NOT edit this file directly! !!!!!
69#
70# Edit mktests.PL and/or __SOURCE__ instead.
71#
cac25305 72# This file was automatically generated from the definition files in the
73# parts/inc/ subdirectory by mktests.PL. To learn more about how all this
74# works, please read the F<HACKERS> file that came with this distribution.
75#
adfe19db 76################################################################################
77
78BEGIN {
79 if ($ENV{'PERL_CORE'}) {
80 chdir 't' if -d 't';
81 @INC = ('../lib', '../ext/Devel/PPPort/t') if -d '../lib' && -d '../ext';
82 require Config; import Config;
83 use vars '%Config';
a745474a 84 if (" $Config{'extensions'} " !~ m[ Devel/PPPort ]) {
adfe19db 85 print "1..0 # Skip -- Perl configured without Devel::PPPort module\n";
86 exit 0;
87 }
88 }
89 else {
90 unshift @INC, 't';
91 }
92
c07deaaf 93 sub load {
94 eval "use Test";
95 require 'testutil.pl' if $@;
adfe19db 96 }
c07deaaf 97
98 if (__PLAN__) {
99 load();
adfe19db 100 plan(tests => __PLAN__);
101 }
102}
103
104use Devel::PPPort;
105use strict;
106$^W = 1;
107
236afa0a 108package Devel::PPPort;
109use vars '@ISA';
110require DynaLoader;
111@ISA = qw(DynaLoader);
112bootstrap Devel::PPPort;
113
114package main;
115
adfe19db 116__TESTS__