--- trunk/t/5_Node.t 2006/01/26 15:29:20 92 +++ trunk/t/5_Node.t 2006/01/28 19:41:59 100 @@ -3,7 +3,7 @@ use strict; use blib; -use Test::More tests => 98; +use Test::More tests => 99; use Test::Exception; use Data::Dumper; @@ -67,7 +67,9 @@ my $id; ok($id = $node->uri_to_id( 'data001' ), "uri_to_id = $id"); -for ( 1 .. 5 ) { +my $data_max = 5; + +for ( 1 .. $data_max ) { ok( $node->out_doc_by_uri( 'test' . $_ ), "out_doc_by_uri test$_"); } @@ -96,6 +98,8 @@ cmp_ok($nres->doc_num, '==', $max, "doc_num = $max"); +cmp_ok($nres->hits, '==', $data_max, "hits"); + for ( 6 .. 10 ) { my $uri = 'test' . $_; ok( my $id = $node->uri_to_id( $uri ), "uri_to_id $uri"); @@ -126,19 +130,22 @@ # user doesn't exist ok(! $node->set_user('foobar', 1), 'set_user'); -ok(my $node1 = new Search::Estraier::Node( "http://localhost:1978/node/$test2_node" ), "new $test2_node"); -ok($node1->set_auth('admin','admin'), "set_auth $test2_node"); +ok(my $node2 = new Search::Estraier::Node( "http://localhost:1978/node/$test2_node" ), "new $test2_node"); +ok($node2->set_auth('admin','admin'), "set_auth $test2_node"); # croak_on_error -ok(my $node2 = new Search::Estraier::Node( url => "http://localhost:1978/non-existant", croak_on_error => 1 ), "new non-existant"); -throws_ok { $node2->name } qr/404/, 'croak on error'; +ok($node = new Search::Estraier::Node( url => "http://localhost:1978/non-existant", croak_on_error => 1 ), "new non-existant"); +throws_ok { $node->name } qr/404/, 'croak on error'; + +# support for undef and 0 values +#ok($node = new Search::Estraier::Node( url => "http://localhost:1978/$test1_node", croak_on_error => 1 ), "new $test1_node"); SKIP: { - 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); - 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", $test1_label, 0), "set_link $test2_node ($test1_label) delete"); + ok($node->set_link("http://localhost:1978/node/$test2_node", $test2_label, 42), "set_link $test2_node ($test2_label) 42"); + ok($node->set_link("http://localhost:1978/node/$test2_node", $test2_label, 0), "set_link $test2_node ($test2_label) delete"); } # SKIP 2 } # SKIP 1