print "1..1\n";

# This test creates a file and then try to parse it using the
# parse_htmlfile() function.


use HTML::Parse qw(parse_htmlfile);

$file = "lwp-test-$$";

open(F, ">$file") or die "Can't open $file: $!";

print F <<EOT;
<!-- This is a test file generated by $0 -->
<title>Libwww-perl test</title>
<isindex>

<body>

This is some text and this is a simple <a
href="http://www.sn.no/libwww-perl/">link</a> back to the
<b>libwww-perl</b> site.

<foo a=b

EOT
close(F);

$h = parse_htmlfile($file);
unlink($file);

$_ = $h->as_HTML;
print $_;

# Just make a few samples to check that we got what we expected
/<head>/i || $bad++;
/<isindex>/i || $bad++;
/this is a simple/ || $bad++;
/foo\s*a=b/ || $bad++;

print "not " if $bad;
print "ok 1\n";

