]>
iEval git - zeal.git/blob - t/Zeal.t
5 use Test
::More tests
=> 18;
6 BEGIN { use_ok
('Zeal') };
8 note
'Working with t/ds/b.docset';
9 my $ds = Zeal
::Docset
->new('t/ds/b.docset');
10 is
$ds->name, 'B', 'docset name is B';
11 is
$ds->id, 'b', 'docset id is b';
12 is
$ds->family, 'consonants', 'docset family is consonants';
14 my @results = $ds->query('buil%');
15 is
@results, 2, 'query(buil%) returns two results';
16 my $doc = $ds->query('building');
17 is
$doc->name, 'building', 'document name is building';
18 is
$doc->type, 'Word', 'document type is Word';
19 like
$doc->fetch, qr/^Dummy/, 'document HTML starts with "Dummy"';
21 @results = sort {$a->name cmp $b->name} $ds->list;
22 is
@results, 2, 'docset contains two documents';
23 is
$results[0]->name, 'building', 'first result is "building"';
25 note
'Working with all docsets in t/ds/';
26 my $zeal = Zeal
->new('t/ds/');
27 my @sets = $zeal->sets;
28 is
@sets, 3, '3 docsets loaded';
29 @results = $zeal->query('buil%');
30 is
@results, 2, '2 documents begin with "buil"';
31 @results = $zeal->query('%t%');
32 is
@results, 3, '3 documents contain letter t';
33 @results = $zeal->query('consonants:%t%');
34 is
@results, 2, '2 documents from the consonants family contain letter t';
35 @results = $zeal->query('%t%', 'vowels');
36 is
@results, 1, '1 document from the vowels family contain letter t';
38 note
'Working with t/ds/a.docset via Zeal and ->add';
40 $zeal->add('t/ds/a.docset');
42 is
@sets, 1, '1 docset loaded';
43 like
$sets[0]->get('abou%'), qr/word/, 'HTML for abou% contains the word "word"';
45 note
'Working with t/ds/a.docset via ZEAL_PATH';
46 $ENV{ZEAL_PATH
} = 't/ds/a.docset';
48 is
$zeal->query('about')->name, 'about';
This page took 0.053571 seconds and 4 git commands to generate.