1BEGIN {
2    if($ENV{PERL_CORE}) {
3        chdir 't';
4        @INC = '../lib';
5    }
6}
7
8use strict;
9use Test::More;
10use Data::Dumper;
11BEGIN { plan tests => 9 };
12
13ok 1;
14
15my $i = 0;
16
17print "# Real closers ...\n";
18
19for my $pod ( "=over\n\nblock\n\n=back",
20              "=over\n\nblock\n\n=cut\n\ncode\n\n=pod\n\n=back",
21              "=begin html\n\ntag\n\n=end html",
22              ) {
23    my $parser = Pod::Simple::Blurb->new();
24    $parser->parse_string_document($pod);
25    is($parser->{'closer-flag'}, -1, "real closer ". ++$i);
26}
27
28$i = 0;
29
30print "# Fake closers ...\n";
31
32for my $pod ("=begin html\n\ntag=cut",
33             "=begin html\n\ntag\n\n=begin xml tag =end xml",
34             "=over\n\nblock=cut",
35             "=over\n\nanother block",
36              ) {
37    my $parser = Pod::Simple::Blurb->new();
38    $parser->parse_string_document($pod);
39    is($parser->{'closer-flag'}, 1, "fake closer ". ++$i);
40}
41
42#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
43
44print "# Wrapping up... one for the road...\n";
45ok 1;
46print "# --- Done with ", __FILE__, " --- \n";
47
481;
49
50package Pod::Simple::Blurb;
51use warnings;
52use strict;
53use base qw/Pod::Simple::Methody/;
54
55sub new {
56    my $new = shift->SUPER::new(@_);
57    $new->output_string(\my $doesnotmatter);
58    $new->accept_targets('*');
59    return $new;
60}
61
62sub end_over_block {
63    shift->set(@_);
64}
65sub end_for {
66    shift->set(@_);
67}
68
69sub set {
70    $_[0]{'closer-flag'} = defined $_[1]{'fake-closer'} ? 1 : -1;
71}
72