Commit | Line | Data |
---|---|---|
3842ad60 | 1 | #!./perl -w |
50b72f59 TJ |
2 | # Test hyperlinks et al from Pod::ParseUtils |
3 | ||
3842ad60 | 4 | use Test::More tests => 22; |
50b72f59 TJ |
5 | |
6 | use strict; | |
7 | use Pod::ParseUtils; | |
8 | ||
50b72f59 TJ |
9 | my @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 | ||
22 | my @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 | 35 | is(@results, @links, 'sanity check - array lengths equal?'); |
50b72f59 TJ |
36 | |
37 | for 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 | |
44 | my $list = new Pod::List( -indent => 4, | |
45 | -start => 52, | |
46 | -file => "itemtest.t", | |
47 | -type => "OL", | |
48 | ); | |
49 | ||
50 | ok($list); | |
51 | ||
3842ad60 NC |
52 | is($list->indent, 4); |
53 | is($list->start, 52); | |
54 | is($list->type, "OL"); | |
50b72f59 TJ |
55 | |
56 | ||
57 | # Pod::Cache | |
58 | ||
59 | # also needs work | |
60 | ||
61 | my $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 | 70 | my $item = $cache->find_page("Pod::ParseUtils"); |
3842ad60 | 71 | ok($item, 'found item of this name'); |
50b72f59 | 72 | |
3842ad60 | 73 | is($cache->find_page("Junk"), undef, 'expect to find nothing'); |
50b72f59 | 74 | |
50b72f59 | 75 | my @i = $cache->item; |
3842ad60 | 76 | is($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 |
79 | is($item->page, "Pod::ParseUtils"); |
80 | is($item->description, "A description"); | |
81 | is($item->file, "file.t"); |