/[Search-Estraier]/trunk/t/3_ResultDocument.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/t/3_ResultDocument.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 23 - (show annotations)
Thu Jan 5 14:30:42 2006 UTC (18 years, 3 months ago) by dpavlin
File MIME type: application/x-troff
File size: 983 byte(s)
finished ResultDocument
1 #!/usr/bin/perl -w
2
3 use strict;
4 use blib;
5
6 use Test::More tests => 12;
7 use Test::Exception;
8 use Data::Dumper;
9
10 BEGIN { use_ok('Search::Estraier') };
11
12 my $doc = {
13 uri => 'file:///foo',
14 attrs => {
15 foo => 1,
16 bar => 2,
17 },
18 snippet => 'none at all',
19 keywords => "foo\tbar\tbaz\tboo",
20 };
21
22 dies_ok { new Search::Estraier::ResultDocument } "new without args";
23 ok(my $rdoc = new Search::Estraier::ResultDocument( %$doc ), 'new');
24 isa_ok($rdoc, 'Search::Estraier::ResultDocument');
25
26 cmp_ok($rdoc->uri, 'eq', $doc->{uri}, 'uri');
27
28 ok(my @attr_names = keys %{ $doc->{attrs} }, "attr_names from original");
29 ok(my @rdoc_attr_names = $rdoc->attr_names, "attr_names from rdoc");
30 ok(eq_set(\@rdoc_attr_names, \@attr_names), 'attr_names comparison');
31
32 foreach my $attr (keys %{ $doc->{attrs} }) {
33 cmp_ok($rdoc->attr($attr), 'eq', $doc->{attrs}->{$attr}, "attr: $attr");
34 }
35
36 cmp_ok($rdoc->snippet, 'eq', $doc->{snippet}, 'snippet');
37 cmp_ok($rdoc->keywords, 'eq', $doc->{keywords}, 'keywords');

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26