File: 2-utf8.t

package info (click to toggle)
liblingua-stopwords-perl 0.09-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 156 kB
  • sloc: perl: 853; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 749 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use strict;
use Test::More;

BEGIN {
    eval "use Encode qw( _utf8_on is_utf8 );";
    if ($@) {
        plan skip_all => "Encode module not available";
    }
    else {
        plan tests => 5;
    }
    use_ok('Lingua::StopWords');
}

my $stoplist = Lingua::StopWords::getStopWords( 'fr', 'UTF-8' );
my $utf8_ete = "été";
_utf8_on($utf8_ete);
ok( $stoplist->{$utf8_ete}, "UTF-8 encoded version present in stoplist" );
for ( keys %$stoplist ) {
    ok( is_utf8($_), "the stoplist keys are flagged as UTF-8" );
    last;
}

$stoplist = Lingua::StopWords::getStopWords('fr');
ok( $stoplist->{"t"}, "Non-utf8-flagged version present" );
for ( keys %$stoplist ) {
    ok( !is_utf8($_), "the stoplist keys are not flagged as UTF-8" );
    last;
}