--- trunk/t/1_document.t 2006/01/04 15:28:39 9 +++ trunk/t/1_document.t 2006/01/04 15:48:00 10 @@ -3,8 +3,9 @@ use strict; use blib; -use Test::More tests => 27; +use Test::More tests => 28; use Test::Exception; +use Data::Dumper; BEGIN { use_ok('Search::Estraier') }; @@ -18,6 +19,12 @@ 'size' => 42, }; +my @test_texts = ( + 'This is a test', + 'of pure-perl bindings', + 'for HyperEstraier' +); + ok(my $doc = new Search::Estraier::Document, 'new'); isa_ok($doc, 'Search::Estraier::Document'); @@ -34,7 +41,10 @@ cmp_ok($doc->attr($a), 'eq', $d, "attr $a = $d"); } -ok($doc->add_text('This is a demo'), 'add_text'); +foreach my $t (@test_texts) { + ok($doc->add_text($t), "add_text: $t"); +} + ok($doc->add_hidden_text('This is hidden text'), 'add_hidden_text'); throws_ok { my $text = $doc->texts } qr/return array/, 'texts scalar'; @@ -62,13 +72,14 @@ ok($doc->add_attr($a, undef), "delete attribute"); } -@attr = $doc->attr_names, 'attr_names'; +@attr = $doc->attr_names; #diag "attr_names left: ", join(',',$doc->attr_names), "\n"; cmp_ok(@attr, '==' , 0, "attributes removed"); diag "texts: ", join(',',@texts), "\n"; +ok(eq_array(\@test_texts, \@texts), 'texts'); -cmp_ok(scalar @texts, '==', 1, 'texts'); +diag Dumper(\@test_texts, \@texts); SKIP: { skip "est_keywords not implemented", 2; @@ -84,3 +95,5 @@ #diag "make_snippet:\n$snippet"; #ok($doc->scan_words(qw(this is demo)), "scan_words"); + +diag Dumper($doc);