1 ################################################################################
3 # mktests.PL -- generate test files for Devel::PPPort
5 ################################################################################
9 # $Date: 2005/01/31 08:10:50 +0100 $
11 ################################################################################
13 # Version 3.x, Copyright (C) 2004-2005, Marcus Holland-Moritz.
14 # Version 2.x, Copyright (C) 2001, Paul Marquess.
15 # Version 1.x, Copyright (C) 1999, Kenneth Albanowski.
17 # This program is free software; you can redistribute it and/or
18 # modify it under the same terms as Perl itself.
20 ################################################################################
24 require "parts/ppptools.pl";
26 my $template = do { local $/; <DATA> };
29 for $file (glob 'parts/inc/*') {
30 my($testfile) = $file =~ /(\w+)$/;
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 $tmpl =~ s/__SOURCE__/$file/mg;
45 $tmpl =~ s/__PLAN__/$spec->{OPTIONS}{tests}{plan}/mg;
46 $tmpl =~ s/^__TESTS__$/$spec->{tests}/mg;
48 open FH, ">$testfile" or die "$testfile: $!\n";
57 ################################################################################
59 # !!!!! Do NOT edit this file directly! !!!!!
61 # Edit mktests.PL and/or __SOURCE__ instead.
63 ################################################################################
66 if ($ENV{'PERL_CORE'}) {
68 @INC = ('../lib', '../ext/Devel/PPPort/t') if -d '../lib' && -d '../ext';
69 require Config; import Config;
71 if (" $Config{'extensions'} " !~ m[ Devel/PPPort ]) {
72 print "1..0 # Skip -- Perl configured without Devel::PPPort module\n";
82 require 'testutil.pl';
83 print "1..__PLAN__\n";
86 plan(tests => __PLAN__);