File: 40_breadcrumb_trail.t

package info (click to toggle)
libhtml-linklist-perl 0.1701-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 276 kB
  • sloc: perl: 1,019; makefile: 2
file content (43 lines) | stat: -rw-r--r-- 894 bytes parent folder | download | duplicates (3)
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
# testing dir_tree
use strict;
use Test::More tests => 4;

use HTML::LinkList qw(breadcrumb_trail);

my @links = qw(
/foo/bar/baz.html
/foo/bar/thing.html
/foo/wibble.html
/fooish.html
/bringle/
/tray/nav.html
/tray/tea_tray.html
);

my %labels = (
'/tray/nav.html' => 'Navigation',
'/foo/bar/baz.html' => 'Bazzy',
);

my $link_html = '';
# default
$link_html = breadcrumb_trail(labels=>\%labels,
    current_url=>'/foo/bar/baz.html');
ok($link_html, "(1) default; links HTML");

my $ok_str = '';
$ok_str = '<p><a href="/">Home</a> &gt; <a href="/foo/">Foo</a> &gt; <a href="/foo/bar/">Bar</a> &gt; <em>Bazzy</em>
</p>';

is($link_html, $ok_str, "(1) default; values match");

# root
$link_html = breadcrumb_trail(labels=>\%labels,
    current_url=>'/index.html');
ok($link_html, "(2) root; links HTML");

$ok_str = '<p><em>Home</em>
</p>';

is($link_html, $ok_str, "(2) root; values match");