File: region.t

package info (click to toggle)
libpod-elemental-perl 0.103006-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 396 kB
  • sloc: perl: 1,471; makefile: 7
file content (43 lines) | stat: -rw-r--r-- 1,237 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!perl
use strict;
use warnings;

# PURPOSE:
# show that begin/end are turned into regions with the correct properties

use Test::More;

use Pod::Elemental;
use Pod::Elemental::Transformer::Pod5;

my $content  = do {
  local $/;
  open my $fh, '<', 't/eg/from-lol.pod' or die "can't read: $!";
  <$fh>;
};

my $doc = Pod::Elemental->read_string($content);

{
  my @regions = grep { (ref $_) =~ /Region/ } @{ $doc->children };
  is(@regions, 0, "there are no regions prior to Pod5 transform");
}

Pod::Elemental::Transformer::Pod5->new->transform_node($doc);

{
  my @regions = grep { (ref $_) =~ /Region/ } @{ $doc->children };
  is(@regions, 2, "there is one (top-level) region post transformation");

  my @subregions = grep { (ref $_) =~ /Region/ } @{ $regions[0]->children };
  is(@subregions, 1, "there is one (2nd-level) region post transformation");

  my @subsub = grep { (ref $_) =~ /Region/ } @{ $subregions[0]->children };
  is(@subsub, 0, "there are no (3rd-level) region post transformation");

  is($regions[1]->format_name, 'empty', '2nd top-level region is "empty"');
  my @sub2 = grep { (ref $_) =~ /Region/ } @{ $regions[1]->children };
  is(@sub2, 0, "there are no children of 2nd top-level region");
}

done_testing;