--- trunk/t/5_Node.t 2006/05/22 14:42:10 156 +++ trunk/t/5_Node.t 2006/08/06 18:15:11 173 @@ -3,7 +3,7 @@ use strict; use blib; -my $tests = 270; +my $tests = 280; use Test::More; use Test::Exception; @@ -157,6 +157,8 @@ my $id; ok($id = $node->uri_to_id( 'data0' ), "uri_to_id(data0)"); +throws_ok { $node->get_doc( 'foo') } qr/id must be number/, 'croak on non-number'; + ok($doc = $node->get_doc( $id ), "get_doc($id) for edit"); $doc->add_attr('foo', 'bar'); #diag Dumper($doc); @@ -171,6 +173,9 @@ ok( ! $node->edit_doc( $doc ), "edit_doc of removed doc"); +my $cache; +ok($cache = $node->cacheusage, "cacheusage: $cache"); + my $delete_num = 5; for ( 1 .. $delete_num ) { @@ -188,8 +193,9 @@ ok($cond->set_max($max), "cond set_max($max)"); ok($cond->set_order('@uri ASCD'), 'cond set_order'); ok($cond->add_attr('@title STRINC Material'), 'cond add_attr'); +ok($cond->set_mask(qw/1 2/), 'cond set_mask'); -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'); +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&mask=6', 'cond_to_query'); ok( my $nres = $node->search( $cond, 0 ), 'search'); @@ -229,6 +235,9 @@ ok(my $hints = $nres->hints, 'hints'); diag Dumper($hints) if ($debug); +foreach my $h (qw/TIME DOCNUM VERSION NODE HIT WORDNUM/) { + ok(defined( $nres->hint($h) ), "have hint $h"); +} ok($node->_set_info, "refresh _set_info"); @@ -244,6 +253,7 @@ # test skip my $skip = int($max / 2) || die "skip is zero, can't test"; ok($cond->set_skip( $skip ), "cond set_skip($skip)"); +cmp_ok($cond->skip, '==', $skip, "skip is $skip"); like($node->cond_to_query( $cond ), qr/skip=$skip/, 'cond_to_query have skip');