1N/A#!/usr/bin/perl -w
1N/A# $Id: text.t,v 1.1 2002/06/23 19:16:25 eagle Exp $
1N/A#
1N/A# text.t -- Additional specialized tests for Pod::Text.
1N/A#
1N/A# Copyright 2002 by Russ Allbery <rra@stanford.edu>
1N/A#
1N/A# This program is free software; you may redistribute it and/or modify it
1N/A# under the same terms as Perl itself.
1N/A
1N/ABEGIN {
1N/A chdir 't' if -d 't';
1N/A if ($ENV{PERL_CORE}) {
1N/A @INC = '../lib';
1N/A } else {
1N/A unshift (@INC, '../blib/lib');
1N/A }
1N/A unshift (@INC, '../blib/lib');
1N/A $| = 1;
1N/A print "1..2\n";
1N/A}
1N/A
1N/AEND {
1N/A print "not ok 1\n" unless $loaded;
1N/A}
1N/A
1N/Ause Pod::Text;
1N/A
1N/A$loaded = 1;
1N/Aprint "ok 1\n";
1N/A
1N/Amy $n = 2;
1N/Awhile (<DATA>) {
1N/A next until $_ eq "###\n";
1N/A open (TMP, '> tmp.pod') or die "Cannot create tmp.pod: $!\n";
1N/A while (<DATA>) {
1N/A last if $_ eq "###\n";
1N/A print TMP $_;
1N/A }
1N/A close TMP;
1N/A my $parser = Pod::Text->new or die "Cannot create parser\n";
1N/A $parser->parse_from_file ('tmp.pod', 'out.tmp');
1N/A open (TMP, 'out.tmp') or die "Cannot open out.tmp: $!\n";
1N/A my $output;
1N/A {
1N/A local $/;
1N/A $output = <TMP>;
1N/A }
1N/A close TMP;
1N/A unlink ('tmp.pod', 'out.tmp');
1N/A my $expected = '';
1N/A while (<DATA>) {
1N/A last if $_ eq "###\n";
1N/A $expected .= $_;
1N/A }
1N/A if ($output eq $expected) {
1N/A print "ok $n\n";
1N/A } else {
1N/A print "not ok $n\n";
1N/A print "Expected\n========\n$expected\nOutput\n======\n$output\n";
1N/A }
1N/A $n++;
1N/A}
1N/A
1N/A# Below the marker are bits of POD and corresponding expected text output.
1N/A# This is used to test specific features or problems with Pod::Text. The
1N/A# input and output are separated by lines containing only ###.
1N/A
1N/A__DATA__
1N/A
1N/A###
1N/A=head1 PERIODS
1N/A
1N/AThis C<.> should be quoted.
1N/A###
1N/APERIODS
1N/A This "." should be quoted.
1N/A
1N/A###