1 ################################################################################
3 # mktests.PL -- generate test files for Devel::PPPort
5 ################################################################################
7 # Version 3.x, Copyright (C) 2004-2013, Marcus Holland-Moritz.
8 # Version 2.x, Copyright (C) 2001, Paul Marquess.
9 # Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
11 # This program is free software; you can redistribute it and/or
12 # modify it under the same terms as Perl itself.
14 ################################################################################
18 require "./parts/ppptools.pl";
20 my $template = do { local $/; <DATA> };
29 for $file (all_files_in_dir('parts/inc')) {
30 my($testfile) = $file =~ /(\w+)\.?$/; # VMS has a trailing dot
31 $testfile = "t/$testfile.t";
33 my $spec = parse_partspec($file);
36 if (exists $spec->{tests}) {
37 exists $spec->{OPTIONS}{tests} &&
38 exists $spec->{OPTIONS}{tests}{plan}
39 or die "No plan for tests in $file\n";
41 print "generating $testfile\n";
44 my $canonfile = $file;
45 $canonfile =~ tr!\\!/!; # MSWin32 use backslashes
46 $tmpl =~ s/__SOURCE__/$canonfile/mg;
47 $tmpl =~ s/__PLAN__/$spec->{OPTIONS}{tests}{plan}/mg;
48 $tmpl =~ s/^__TESTS__$/$spec->{tests}/mg;
50 open FH, ">$testfile" or die "$testfile: $!\n";
55 push @tests, $testfile;
63 ################################################################################
65 # !!!!! Do NOT edit this file directly! !!!!!
67 # Edit mktests.PL and/or __SOURCE__ instead.
69 # This file was automatically generated from the definition files in the
70 # parts/inc/ subdirectory by mktests.PL. To learn more about how all this
71 # works, please read the F<HACKERS> file that came with this distribution.
73 ################################################################################
78 if ($ENV{'PERL_CORE'}) {
80 unshift @INC, '../lib' if -d '../lib' && -d '../ext';
81 require Config; Config->import;
83 if (" $Config{'extensions'} " !~ m[ Devel/PPPort ]) {
84 print "1..0 # Skip -- Perl configured without Devel::PPPort module\n";
89 use lib "$FindBin::Bin";
90 use lib "$FindBin::Bin/../parts/inc";
92 die qq[Cannot find "$FindBin::Bin/../parts/inc"] unless -d "$FindBin::Bin/../parts/inc";
95 require 'testutil.pl';
101 plan(tests => __PLAN__);
109 package Devel::PPPort;
112 @ISA = qw(DynaLoader);
113 Devel::PPPort->bootstrap;