1 |
#!perl -w |
2 |
|
3 |
use strict; |
4 |
|
5 |
# init some vars |
6 |
my $affix_file='/usr/lib/ispell/english.aff'; |
7 |
my @test_words=( 'cars', 'dogs' ); |
8 |
|
9 |
my $loaded = 0; |
10 |
|
11 |
BEGIN { $| = 1; print "1..4\n"; } |
12 |
END {print "not ok 1\n" unless $loaded;} |
13 |
|
14 |
use Lingua::Spelling::Alternative; |
15 |
$loaded = 1; |
16 |
print "ok 1\n"; |
17 |
|
18 |
### test constructor |
19 |
|
20 |
my $a = new Lingua::Spelling::Alternative() ; |
21 |
|
22 |
defined($a) || print 'not '; print "ok 2\n"; |
23 |
|
24 |
### test load affix |
25 |
|
26 |
|
27 |
if ( -e $affix_file ) { |
28 |
my $ok = $a->load_affix($affix_file); |
29 |
print 'not ' if (! $ok); |
30 |
print "ok 3\n"; |
31 |
|
32 |
my @words = $a->alternatives(@test_words); |
33 |
print 'not ' if (! @words); |
34 |
print "ok 4 # - ",join(", ",@test_words)," -> ",join(", ",@words),"\n"; |
35 |
} else { |
36 |
print "ok 3 # - Skip, affix file '$affix_file' not found\n"; |
37 |
print "ok 4 # - Skip\n"; |
38 |
} |
39 |
|