3 |
use strict; |
use strict; |
4 |
use blib; |
use blib; |
5 |
|
|
6 |
use Test::More tests => 46; |
use Test::More tests => 52; |
7 |
use Test::Exception; |
use Test::Exception; |
8 |
use Data::Dumper; |
use Data::Dumper; |
9 |
|
|
10 |
BEGIN { use_ok('Search::Estraier') }; |
BEGIN { use_ok('Search::Estraier') }; |
11 |
|
|
12 |
my $debug = 1; |
my $debug = 0; |
13 |
|
|
14 |
# name of node for test |
# name of node for test |
15 |
my $test_node = 'Search-Estraier'; |
my $test_node = 'Search-Estraier'; |
51 |
#diag "draft:\n$draft"; |
#diag "draft:\n$draft"; |
52 |
ok(my $doc = new Search::Estraier::Document($draft), 'new doc from draft'); |
ok(my $doc = new Search::Estraier::Document($draft), 'new doc from draft'); |
53 |
|
|
54 |
|
ok( $node->put_doc($doc), "put_doc data001"); |
55 |
|
|
56 |
for ( 1 .. 10 ) { |
for ( 1 .. 10 ) { |
57 |
$doc->add_attr('@uri', 'test' . $_); |
$doc->add_attr('@uri', 'test' . $_); |
58 |
ok( $node->put_doc($doc), "put_doc test$_"); |
ok( $node->put_doc($doc), "put_doc test$_"); |
72 |
ok( $node->edit_doc( $doc ), 'edit_doc'); |
ok( $node->edit_doc( $doc ), 'edit_doc'); |
73 |
|
|
74 |
for ( 6 .. 10 ) { |
for ( 6 .. 10 ) { |
|
ok( $node->get_doc( $_ ), "get_doc $_"); |
|
75 |
my $uri = 'test' . $_; |
my $uri = 'test' . $_; |
76 |
|
ok( my $id = $node->uri_to_id( $uri ), "uri_to_id $uri"); |
77 |
|
ok( $node->get_doc( $id ), "get_doc $id"); |
78 |
ok( $node->get_doc_by_uri( $uri ), "get_doc_by_uri $uri"); |
ok( $node->get_doc_by_uri( $uri ), "get_doc_by_uri $uri"); |
79 |
ok( my $k = $node->etch_doc_by_uri( $uri ), "etch_doc_by_uri $uri"); |
ok( my $k = $node->etch_doc_by_uri( $uri ), "etch_doc_by_uri $uri"); |
80 |
} |
} |