1# bad data
2
3use strict;
4use vars q($count);
5
6BEGIN { $count = 4 };
7use Test::More tests => $count;
8use HTML::Breadcrumbs qw(breadcrumbs);
9
10# Load result strings
11my $test = 't06';
12my %result = ();
13$test = "t/$test" if -d "t/$test";
14die "missing data dir $test" unless -d "$test";
15{
16  opendir my $dir, "$test" or die "can't open $test";
17  for (readdir $dir) {
18    next if m/^\./;
19    open my $file, "<$test/$_" or die "can't read $test/$_";
20    {
21      local $/ = undef;
22      $result{$_} = <$file>;
23    }
24    chomp $result{$_};
25  }
26}
27
28my $print = shift @ARGV || 0;
29my $t = 1;
30sub report {
31  my ($data, $file, $inc) = @_;
32  $inc ||= 1;
33  if ($print == $t) {
34    print STDERR "--> $file\n";
35    print $data;
36    exit 0;
37  }
38  $t += $inc;
39}
40
41my $out;
42
43# Standard
44$out = breadcrumbs(path => '/foo/bar/bog.html', sep => ' &gt; ',);
45report $out, "standard";
46is($out, $result{standard}, "standard path ok");
47
48# Brackets in path
49$out = breadcrumbs(path => '/foo/bar/bog()');
50report $out, "brackets";
51is($out, $result{brackets}, "bracket path ok");
52
53# URL path should die not absolute path
54ok(!defined eval { breadcrumbs(path => 'http://www.example.com/foo/bar/bog.html') },
55    'url path dies');
56
57# undef path
58ok(!defined eval { breadcrumbs(path => undef) }, 'undef path dies');
59
60
61# arch-tag: a94c9fc7-fb88-4ffd-838f-d80593ed3531
62