/[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 23 - (hide annotations)
Thu Oct 7 16:21:54 2004 UTC (19 years, 7 months ago) by dpavlin
File MIME type: application/x-troff
File size: 870 byte(s)
convert all print STDERR to diag, rename homer test to end with .t (woops),
create homer_words.txt and homer_text.txt, preserve order when inserting
into index (it doesn't really matter for index, but it's nice to have
debugging output which is correct)

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