Show
Ignore:
Timestamp:
09/20/08 01:05:54 (4 months ago)
Author:
karpet
Message:

yank old wordlist in favor of token_iterator -- TODO still some ref_cnt issues

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • libswish3/trunk/bindings/perl/t/06constants.t

    r2019 r2161  
    55is( SWISH_MIME,                'MIME',          SWISH_MIME ); 
    66is( SWISH_PROP,                'PropertyNames', SWISH_PROP ); 
    7 is( scalar(SWISH_WORD_FIELDS), 6,               'SWISH_WORD_FIELDS' ); 
     7is( scalar(SWISH_TOKEN_FIELDS), 6,               'SWISH_TOKEN_FIELDS' ); 
  • libswish3/trunk/bindings/perl/t/10tokenize.t

    r2151 r2161  
    44 
    55ok( my $s3 = SWISH::3->new, "new s3" ); 
    6 ok( my $wlist = $s3->tokenize( 
     6ok( my $tokens = $s3->tokenize( 
    77        "now is the time, ain't it? or when else might it be!", 
    8         14, 5, 'foo', 'bar' 
     8        'foo', 'bar' 
    99    ), 
    1010    "wordlist" 
    1111); 
    1212 
    13 ok( $wlist->isa('SWISH::3::WordList'), 'isa wordlist' ); 
     13ok( $tokens->isa('SWISH::3::TokenIterator'), 'isa TokenIterator' ); 
    1414 
    15 while ( my $swishword = $wlist->next ) { 
     15#$s3->describe($tokens); 
    1616 
    17     my $word = $swishword->word; 
     17while ( my $token = $tokens->next ) { 
     18 
     19    #$s3->describe($token); 
     20 
     21    my $word = $token->value; 
    1822    if ( $word eq 'now' ) { 
    19         is( $swishword->position, 6, "now position" ); 
     23        is( $token->pos, 1, "now position" ); 
    2024    } 
    2125    if ( $word eq 'time' ) { 
    22         is( $swishword->position, 9, "time position" ); 
     26        is( $token->pos, 4, "time position" ); 
    2327    } 
    2428    if ( $word eq 'be' ) { 
    25         is( $swishword->position, 17, "be position" ); 
     29        is( $token->pos, 12, "be position" ); 
    2630    } 
    2731 
    2832    #diag( '=' x 60 ); 
    29     for my $w (SWISH_WORD_FIELDS) { 
     33    for my $w (SWISH_TOKEN_FIELDS) { 
    3034 
    31         #diag( sprintf( "%15s: %s\n", $w, $swishword->$w ) ); 
     35        #diag( sprintf( "%15s: %s\n", $w, $token->$w ) ); 
    3236 
    3337    } 
    3438} 
    3539 
    36 #undef $analyzer; 
    3740#undef $wlist; 
    3841#undef $s3; 
  • libswish3/trunk/bindings/perl/t/15-analyzer.t

    r2151 r2161  
    1 use Test::More tests => 5
     1use Test::More tests => 3
    22 
    33use SWISH::3; 
     
    77#ok( my $analyzer = $s3->analyzer, "get analyzer" ); 
    88 
    9 eval { my $handler = $s3->analyzer->get_token_handler }; 
    10  
    11 ok( $@, "get token handler: $@" ); 
    12  
    139like( 'foo', $s3->analyzer->get_regex, 'get regex' ); 
    14  
    15 ok( !$s3->analyzer->set_token_handler( sub { $_[0]->debug } ), 
    16     "set token handler" ); 
    1710 
    1811ok( $s3->tokenize('foo bar baz'), "tokenize" );