/[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

Contents of /trunk/t/05entities.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 11 - (show annotations)
Mon Jul 26 20:30:12 2004 UTC (19 years, 9 months ago) by dpavlin
File MIME type: application/x-troff
File size: 880 byte(s)
to_jsfind will try to decode entities from data, and recode then to
target encoding (UTF-8 by default)

1 #!/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 print STDERR "entities saved in entities.txt\n";
33 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 ok($t->to_jsfind('./html/entities','ISO-8859-2'), "save to index");
45
46 ok($t->to_jsfind('./html/entities-utf8','ISO-8859-2','UTF-8'), "save to utf-8 index");
47
48 #ok_fail(
49
50

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26