--- trunk/t/5_Node.t 2006/01/16 21:47:21 79 +++ trunk/t/5_Node.t 2006/01/28 17:38:00 94 @@ -3,7 +3,7 @@ use strict; use blib; -use Test::More tests => 97; +use Test::More tests => 98; use Test::Exception; use Data::Dumper; @@ -32,7 +32,7 @@ SKIP: { -skip "no $test1_node node in Hyper Estraier", 87, unless($node->name); +skip "no $test1_node node in Hyper Estraier", 88, unless($node->name); my @res = ( -1, 200 ); @@ -90,11 +90,11 @@ cmp_ok($node->cond_to_query( $cond ), 'eq' , 'phrase=girl&attr1=%40title%20STRINC%20Material&order=%40uri%20ASCD&max='.$max.'&wwidth=480&hwidth=96&awidth=96', 'cond_to_query'); -ok( my $nrec = $node->search( $cond, 0 ), 'search'); +ok( my $nres = $node->search( $cond, 0 ), 'search'); -isa_ok( $nrec, 'Search::Estraier::NodeResult' ); +isa_ok( $nres, 'Search::Estraier::NodeResult' ); -cmp_ok($nrec->doc_num, '==', $max, "doc_num = $max"); +cmp_ok($nres->doc_num, '==', $max, "doc_num = $max"); for ( 6 .. 10 ) { my $uri = 'test' . $_; @@ -109,6 +109,9 @@ ok( eq_hash( $k, $k2 ), "keywords"); } +ok(my $hints = $nres->hints, 'hints'); +diag Dumper($hints); + ok($node->_set_info, "refresh _set_info"); my $v; @@ -123,19 +126,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