/[Search-Estraier]/trunk/t/5_Node.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

Diff of /trunk/t/5_Node.t

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 92 by dpavlin, Thu Jan 26 15:29:20 2006 UTC revision 100 by dpavlin, Sat Jan 28 19:41:59 2006 UTC
# Line 3  Line 3 
3  use strict;  use strict;
4  use blib;  use blib;
5    
6  use Test::More tests => 98;  use Test::More tests => 99;
7  use Test::Exception;  use Test::Exception;
8  use Data::Dumper;  use Data::Dumper;
9    
# Line 67  for ( 1 .. 10 ) { Line 67  for ( 1 .. 10 ) {
67  my $id;  my $id;
68  ok($id = $node->uri_to_id( 'data001' ), "uri_to_id = $id");  ok($id = $node->uri_to_id( 'data001' ), "uri_to_id = $id");
69    
70  for ( 1 .. 5 ) {  my $data_max = 5;
71    
72    for ( 1 .. $data_max ) {
73          ok( $node->out_doc_by_uri( 'test' . $_ ), "out_doc_by_uri test$_");          ok( $node->out_doc_by_uri( 'test' . $_ ), "out_doc_by_uri test$_");
74  }  }
75    
# Line 96  isa_ok( $nres, 'Search::Estraier::NodeRe Line 98  isa_ok( $nres, 'Search::Estraier::NodeRe
98    
99  cmp_ok($nres->doc_num, '==', $max, "doc_num = $max");  cmp_ok($nres->doc_num, '==', $max, "doc_num = $max");
100    
101    cmp_ok($nres->hits, '==', $data_max, "hits");
102    
103  for ( 6 .. 10 ) {  for ( 6 .. 10 ) {
104          my $uri = 'test' . $_;          my $uri = 'test' . $_;
105          ok( my $id = $node->uri_to_id( $uri ), "uri_to_id $uri");          ok( my $id = $node->uri_to_id( $uri ), "uri_to_id $uri");
# Line 126  ok($node->set_snippet_width( 100, 10, 10 Line 130  ok($node->set_snippet_width( 100, 10, 10
130  # user doesn't exist  # user doesn't exist
131  ok(! $node->set_user('foobar', 1), 'set_user');  ok(! $node->set_user('foobar', 1), 'set_user');
132    
133  ok(my $node1 = new Search::Estraier::Node( "http://localhost:1978/node/$test2_node" ), "new $test2_node");  ok(my $node2 = new Search::Estraier::Node( "http://localhost:1978/node/$test2_node" ), "new $test2_node");
134  ok($node1->set_auth('admin','admin'), "set_auth $test2_node");  ok($node2->set_auth('admin','admin'), "set_auth $test2_node");
135    
136  # croak_on_error  # croak_on_error
137    
138  ok(my $node2 = new Search::Estraier::Node( url => "http://localhost:1978/non-existant", croak_on_error => 1 ), "new non-existant");  ok($node = new Search::Estraier::Node( url => "http://localhost:1978/non-existant", croak_on_error => 1 ), "new non-existant");
139  throws_ok { $node2->name } qr/404/, 'croak on error';  throws_ok { $node->name } qr/404/, 'croak on error';
140    
141    # support for undef and 0 values
142    #ok($node = new Search::Estraier::Node( url => "http://localhost:1978/$test1_node", croak_on_error => 1 ), "new $test1_node");
143    
144  SKIP: {  SKIP: {
145          skip "no $test2_node in Hyper Estraier, skipping set_link", 2 unless (my $test1_label = $node1->label);          skip "no $test2_node in Hyper Estraier, skipping set_link", 2 unless (my $test2_label = $node2->label);
146    
147          ok($node->set_link("http://localhost:1978/node/$test2_node", $test1_label, 42), "set_link $test2_node ($test1_label) 42");          ok($node->set_link("http://localhost:1978/node/$test2_node", $test2_label, 42), "set_link $test2_node ($test2_label) 42");
148          ok($node->set_link("http://localhost:1978/node/$test2_node", $test1_label, 0), "set_link $test2_node ($test1_label) delete");          ok($node->set_link("http://localhost:1978/node/$test2_node", $test2_label, 0), "set_link $test2_node ($test2_label) delete");
149  }       # SKIP 2  }       # SKIP 2
150    
151  }       # SKIP 1  }       # SKIP 1

Legend:
Removed from v.92  
changed lines
  Added in v.100

  ViewVC Help
Powered by ViewVC 1.1.26