File: index.t

package info (click to toggle)
libpod-pseudopod-perl 0.19-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 280 kB
  • sloc: perl: 1,428; makefile: 9
file content (97 lines) | stat: -rw-r--r-- 1,894 bytes parent folder | download | duplicates (4)
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
#!/usr/bin/perl -w

# t/index.t - check output from Pod::PseudoPod::Index

BEGIN {
    chdir 't' if -d 't';
}

use strict;
use lib '../lib';
use Test::More tests => 7;

use_ok('Pod::PseudoPod::Index') or exit;

my $parser = Pod::PseudoPod::Index->new ();
isa_ok ($parser, 'Pod::PseudoPod::Index');

my $results;

initialize($parser, $results);
$parser->parse_string_document(<<'EOPOD');
=pod

Paragraph X<test> paragraph.

=end
EOPOD
$parser->output_text;
is($results, "\ntest, 0", "a simple index item");

initialize($parser, $results);
$parser->parse_string_document(<<'EOPOD');
=pod

Paragraph X<testE<gt>> paragraph.

=end
EOPOD
$parser->output_text;
is($results, "\ntest>, 0", "index item with coded entity");

initialize($parser, $results);
$parser->parse_string_document(<<'EOPOD');
=pod

Paragraph X<test> paragraph.

Second paragraph X<another test> second paragraph.

=end
EOPOD
$parser->output_text;
is($results, "\nanother test, 0\ntest, 0", "two simple index items");

$results = '';
my $index = {};
$parser = Pod::PseudoPod::Index->new ($index);
$parser->parse_string_document(<<'EOPOD');
=pod

Paragraph X<test> paragraph.

=end
EOPOD

$parser = Pod::PseudoPod::Index->new ($index);
$parser->parse_string_document(<<'EOPOD');
=pod

Second paragraph X<going twice> second paragraph.

=end
EOPOD
$parser->output_string( \$results ); # Send the resulting output to a string
$parser->output_text;
is($results, "\ngoing twice, 0\ntest, 0", "two index items in two files");

initialize($parser, $results);
$parser->parse_string_document(<<'EOPOD');
=pod

Paragraph X<test;blah> paragraph.

=end
EOPOD
$parser->output_text;
is($results, "\ntest\n    blah, 0", "a two-level index item");


######################################

sub initialize {
	$_[0] = Pod::PseudoPod::Index->new ();
	$_[0]->output_string( \$results ); # Send the resulting output to a string
	$_[1] = '';
	return;
}