/[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

Annotation of /trunk/t/3_ResultDocument.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 23 - (hide annotations)
Thu Jan 5 14:30:42 2006 UTC (18 years, 4 months ago) by dpavlin
File MIME type: application/x-troff
File size: 983 byte(s)
finished ResultDocument
1 dpavlin 21 #!/usr/bin/perl -w
2    
3     use strict;
4     use blib;
5    
6 dpavlin 23 use Test::More tests => 12;
7 dpavlin 21 use Test::Exception;
8 dpavlin 23 use Data::Dumper;
9 dpavlin 21
10     BEGIN { use_ok('Search::Estraier') };
11    
12 dpavlin 23 my $doc = {
13 dpavlin 21 uri => 'file:///foo',
14     attrs => {
15     foo => 1,
16     bar => 2,
17     },
18     snippet => 'none at all',
19     keywords => "foo\tbar\tbaz\tboo",
20 dpavlin 23 };
21    
22     dies_ok { new Search::Estraier::ResultDocument } "new without args";
23     ok(my $rdoc = new Search::Estraier::ResultDocument( %$doc ), 'new');
24 dpavlin 21 isa_ok($rdoc, 'Search::Estraier::ResultDocument');
25    
26 dpavlin 23 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