/[jsFind]/trunk/t/05entities.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/t/05entities.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 35 - (hide annotations)
Sun Oct 24 11:13:22 2004 UTC (19 years, 8 months ago) by dpavlin
File MIME type: application/x-troff
File size: 948 byte(s)
new version 0.06 with API change on to_jsfind.
It also documents (still unimplemented) output_filter option.

1 dpavlin 11 #!/usr/bin/perl
2    
3     use strict;
4     use warnings;
5    
6     use Test::More tests => 4;
7     use blib;
8     use jsFind;
9    
10     BEGIN { use_ok('jsFind'); }
11    
12     my $t = new jsFind B => 4;
13    
14     my $i = 0;
15     foreach my $k (qw{
16     &acirc; &ecirc; &egrave; &iuml; &ucirc; &foobar; lt_< gt_>
17     èevapèiæ ¾aba ¹kola
18     }) {
19     $t->B_search(Key => $k,
20     Data => { "path to $k" => {
21     t => "entity $k",
22     f => $i },
23     },
24     Insert => 1,
25     Append => 1,
26     );
27     $i++;
28     }
29    
30     if (open(T,"| sort > entities.txt")) {
31     print T $t->to_string;
32 dpavlin 23 diag "entities saved in entities.txt";
33 dpavlin 11 close(T);
34     }
35    
36     my $tree_size = 0;
37     open(T, "entities.txt") || die "can't open entities.txt: $!";
38     while(<T>) {
39     $tree_size++;
40     }
41    
42     cmp_ok($tree_size, '==', $i, "insert $tree_size/$i");
43    
44 dpavlin 35 ok($t->to_jsfind(
45     dir => './html/entities',
46     data_codepage => 'ISO-8859-2'
47     ), "save to index");
48 dpavlin 11
49 dpavlin 35 ok($t->to_jsfind(
50     dir => './html/entities-utf8',
51     data_codepage => 'ISO-8859-2',
52     index_codepage => 'UTF-8'
53     ), "save to utf-8 index");
54 dpavlin 11
55     #ok_fail(
56    
57    

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26