allow /0|NaN/ on some bigfloatpm.t tests for portability; other
[p5sagit/p5-mst-13.2.git] / t / lib / h2ph.t
CommitLineData
1d2dff63 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';
93430cb4 8 unshift @INC, '../lib';
1d2dff63 9}
10
1d2dff63 11print "1..2\n";
12
a1737d5b 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 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 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 30 print(($ok == 0 ? "" : "not "), "ok 2\n");
31
32 # cleanup - should this be in an END block?
33 unlink("lib/h2ph.ph");
181ea953 34 unlink("_h2ph_pre.ph");
1d2dff63 35}