File: 05-core.t

package info (click to toggle)
libtext-hunspell-perl 2.11-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 176 kB
  • ctags: 381
  • sloc: cpp: 789; perl: 34; makefile: 2
file content (32 lines) | stat: -rw-r--r-- 732 bytes parent folder | download | duplicates (3)
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
31
32
use strict;
use warnings;

use Data::Dumper;
use Test::More tests => 5;
use Text::Hunspell;

my $speller = Text::Hunspell->new(qw(./t/test.aff ./t/test.dic));
die unless $speller;
ok($speller, qq(Created a Text::Hunspell object [$speller]));

my $word = q(lótól);
ok(
    $speller->check($word),
    qq(Word '$word' should be in the test dictionary)
);

$word = q(lóotól);
ok(
    ! $speller->check($word),
    qq(Word '$word' shouldn't be in the test dictionary)
);

# Check spell suggestions
my $misspelled = q(lóo);
my @suggestions = $speller->suggest($misspelled);
ok(scalar @suggestions > 0, q(Got some suggestions));

is_deeply(
    \@suggestions => [ qw(lói ló lót) ],
    q(List of suggestions should be correct)
);