1#!/usr/bin/perl -w 2 3# t/output.t - Check output_string. 4 5BEGIN { 6 chdir 't' if -d 't'; 7} 8 9use strict; 10use warnings; 11use lib '../lib'; 12use Test::More tests => 36; 13#use Test::More 'no_plan'; 14use File::Spec; 15 16for my $format (qw(XHTML HTML Text RTF)) { 17 my $class = "Pod::Simple::$format"; 18 use_ok $class or next; 19 ok my $parser = $class->new, "Construct $format parser"; 20 21 # Try parse_string_document(). 22 my $output = ''; 23 ok $parser->output_string(\$output), "Set $format output string"; 24 ok $parser->parse_string_document( "=head1 Poit!" ), 25 "Parse to $format via parse_string_document()"; 26 like $output, qr{Poit!}, 27 "Should have $format output from parse_string_document()"; 28 29 # Try parse_file(). 30 ok $parser = $class->new, "Construct another $format parser"; 31 $output = ''; 32 ok $parser->output_string(\$output), "Set $format output string again"; 33 ok $parser->parse_file(File::Spec->catfile(qw(testlib1 zikzik.pod))), 34 "Parse to $format via parse_file()"; 35 like $output, qr{This is just a test file}, 36 "Should have $format output from parse_file"; 37} 38