This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Was missing use Text::Wrap.
[perl5.git] / t / lib / h2ph.t
CommitLineData
1d2dff63
GS
1#!./perl
2
3# quickie tests to see if h2ph actually runs and does more or less what is
4# expected
5
6BEGIN {
7 chdir 't' if -d 't';
8 @INC = '../lib';
9}
10
1d2dff63
GS
11print "1..2\n";
12
a1737d5b
GS
13# quickly compare two text files
14sub txt_compare {
15 local ($/, $A, $B);
16 for (($A,$B) = @_) { open(_,"<$_") ? $_ = <_> : die "$_ : $!"; close _ }
17 $A cmp $B;
18}
19
1d2dff63
GS
20unless(-e '../utils/h2ph') {
21 print("ok 1\nok 2\n");
22 # i'll probably get in trouble for this :)
23} else {
24 # does it run?
625ca0ef 25 $ok = system("./perl -I../lib ../utils/h2ph -d. -Q lib/h2ph.h");
1d2dff63
GS
26 print(($ok == 0 ? "" : "not "), "ok 1\n");
27
28 # does it work? well, does it do what we expect? :-)
a1737d5b 29 $ok = txt_compare("lib/h2ph.ph", "lib/h2ph.pht");
1d2dff63
GS
30 print(($ok == 0 ? "" : "not "), "ok 2\n");
31
32 # cleanup - should this be in an END block?
33 unlink("lib/h2ph.ph");
34}