xref: /openbsd/gnu/usr.bin/perl/cpan/Pod-Simple/t/output.t (revision 274d7c50)
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 lib '../lib';
11use Test::More tests => 36;
12#use Test::More 'no_plan';
13use File::Spec;
14
15for 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}
37