This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
add OP_ARGELEM, OP_ARGDEFELEM, OP_ARGCHECK ops
[perl5.git] / lib / Pod / t / utils.t
CommitLineData
3842ad60 1#!./perl -w
50b72f59
TJ
2# Test hyperlinks et al from Pod::ParseUtils
3
3842ad60 4use Test::More tests => 22;
50b72f59
TJ
5
6use strict;
7use Pod::ParseUtils;
8
50b72f59
TJ
9my @links = qw{
10 name
11 name/ident
12 name/"sec"
13 "sec"
14 /"sec"
15 http://www.perl.org/
16 text|name
17 text|name/ident
18 text|name/"sec"
19 text|"sec"
20};
21
22my @results = (
9c6ed6d7
HS
23 "P<name>",
24 "Q<ident> in P<name>",
25 "Q<sec> in P<name>",
26 "Q<sec>",
27 "Q<sec>",
50b72f59
TJ
28 "Q<http://www.perl.org/>",
29 "Q<text>",
30 "Q<text>",
31 "Q<text>",
32 "Q<text>",
33 );
34
3842ad60 35is(@results, @links, 'sanity check - array lengths equal?');
50b72f59
TJ
36
37for my $i( 0..@links ) {
38 my $link = new Pod::Hyperlink( $links[$i] );
3842ad60 39 is($link->markup, $results[$i], "test hyperlink $i");
50b72f59
TJ
40}
41
42# Now test lists
43# This test needs to be better
44my $list = new Pod::List( -indent => 4,
45 -start => 52,
46 -file => "itemtest.t",
47 -type => "OL",
48 );
49
50ok($list);
51
3842ad60
NC
52is($list->indent, 4);
53is($list->start, 52);
54is($list->type, "OL");
50b72f59
TJ
55
56
57# Pod::Cache
58
59# also needs work
60
61my $cache = new Pod::Cache;
62
63# Store it in the cache
64$cache->item(
65 -page => "Pod::ParseUtils",
66 -description => "A description",
67 -file => "file.t",
68 );
69
50b72f59 70my $item = $cache->find_page("Pod::ParseUtils");
3842ad60 71ok($item, 'found item of this name');
50b72f59 72
3842ad60 73is($cache->find_page("Junk"), undef, 'expect to find nothing');
50b72f59 74
50b72f59 75my @i = $cache->item;
3842ad60 76is($i[0], $item, 'item we found is the same one as the first in the list');
50b72f59
TJ
77
78# Check the contents
3842ad60
NC
79is($item->page, "Pod::ParseUtils");
80is($item->description, "A description");
81is($item->file, "file.t");