File: blanks.t

package info (click to toggle)
libpod-eventual-perl 0.094001-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 176 kB
  • ctags: 14
  • sloc: perl: 172; makefile: 7
file content (106 lines) | stat: -rw-r--r-- 2,277 bytes parent folder | download | duplicates (5)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
use strict;
use warnings;

use Test::More tests => 1;
use Pod::Eventual::Simple;

my $output = Pod::Eventual::Simple->read_file('eg/blanks.pod');
my @events = grep { $_->{type} ne 'nonpod' } @$output;

sub blank_at { 
  my ($line, $num) = @_;
  $num ||= 1;

  return { type => 'blank', content => "\n" x $num, start_line => $line };
}

my $want = [
  {
    type       => 'command',
    command    => 'head1',
    start_line => '2',
    content    => "ABOUT\n",
  },
  blank_at(3),
  {
    type       => 'text',
    start_line => '4',
    content    =>
    'This document includes typed regions with data paragraphs with blank lines as
well as verbatim paragraphs with blank lines.  We want either to have one event
per block-with-blank or to have sufficient information to reconstruct the
block.
',
  },
  blank_at(8),


  # We want to be able to reconstruct these to one verbatim paragraph with the
  # correct amount of blank vertical space. -- rjbs, 2009-05-23
  {
    content    => '  For example I have now begin a verbatim paragraph
',
    type       => 'text',
    start_line => '9'
  },
  blank_at(10),
  {
    content    => '  and despite the intervening blank I am still in it, and
',
    type       => 'text',
    start_line => '11'
  },
  blank_at(12, 2),
  {
    content    =>
      '  even several blank lines are included -- without loss -- in the final
  verbatim paragraph.
',
    type       => 'text',
    start_line => '14'
  },

  blank_at(16),

  {
    type       => 'command',
    command    => 'begin',
    start_line => '17',
    content    => "data\n",
  },

  blank_at(18),

  # The same thing goes for here... we want to be able to have all the blanks.
  # -- rjbs, 2009-05-23
  {
    type       => 'text',
    start_line => '19',
    content    => "Similarly, this paragraph\n",
  },
  blank_at(20),
  {
    type       => 'text',
    start_line => '21',
    content    => "is actually one data para\n",
  },
  blank_at(22, 2),
  {
    type       => 'text',
    start_line => '24',
    content    => "with blank lines within.\n",
  },

  blank_at(25),

  {
    type       => 'command',
    command    => 'end',
    start_line => '26',
    content    => "data\n",
  },

  blank_at(27),
];

is_deeply(\@events, $want, 'we got the events we expected');