diff options
author | Nicholas Clark <nick@ccl4.org> | 2001-05-05 15:46:39 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-05-05 13:24:21 +0000 |
commit | d3837a338fc7bfc4bb6ab1c7efbea9a7bd386416 (patch) | |
tree | eb7ab0a7b3b3b96f7517591806c5ea58a4eeff00 /utils | |
parent | 38535c9801a7c2795e463ba640cc0cfb5a99bd59 (diff) | |
download | perl-d3837a338fc7bfc4bb6ab1c7efbea9a7bd386416.tar.gz |
Re: h2xs [was Re: HEAR YE, HEAR YE!]
Message-ID: <20010505144639.O53513@plum.flirble.org>
Add a test for the constants (if any) being processed correctly.
p4raw-id: //depot/perl@9995
Diffstat (limited to 'utils')
-rw-r--r-- | utils/h2xs.PL | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/utils/h2xs.PL b/utils/h2xs.PL index 55356ab4a3..4333c0fd88 100644 --- a/utils/h2xs.PL +++ b/utils/h2xs.PL @@ -1853,24 +1853,46 @@ unless (-d "$testdir") { mkdir "$testdir" or die "Cannot mkdir $testdir: $!\n"; } warn "Writing $ext$modpname/$testfile\n"; +my $tests = @const_names ? 2 : 1; + open EX, ">$testfile" or die "Can't create $ext$modpname/$testfile: $!\n"; -print EX <<'_END_'; +print EX <<_END_; # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl 1.t' ######################### -# change 'tests => 1' to 'tests => last_test_to_print'; +# change 'tests => $tests' to 'tests => last_test_to_print'; use Test; -BEGIN { plan tests => 1 }; -_END_ -print EX <<_END_; +BEGIN { plan tests => $tests }; use $module; -_END_ -print EX <<'_END_'; ok(1); # If we made it this far, we're ok. +_END_ +if (@const_names) { + my $const_names = join " ", @const_names; + print EX <<_END_; + +my \$fail; +foreach my \$constname qw($const_names) { + next if (eval "my \\\$a = \$constname; 1"); + if (\$\@ =~ /^Your vendor has not defined $module macro \$constname/) { + print "# pass: \$\@"; + } else { + print "# fail: \$\@"; + \$fail = 1; + } +} +if (\$fail) { + print "not ok 2\\n"; +} else { + print "ok 2\\n"; +} + +_END_ +} +print EX <<'_END_'; ######################### # Insert your test code below, the Test module is use()ed here so read |