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