File: test.t

package info (click to toggle)
libtext-aspell-perl 0.04-3
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k, lenny
  • size: 84 kB
  • ctags: 7
  • sloc: makefile: 53; perl: 52
file content (83 lines) | stat: -rw-r--r-- 2,719 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!perl -w

# $Id: test.t,v 1.5 2002/08/29 20:28:01 moseley Exp $

use strict;
require Text::Aspell;

my $lastcase = 21;
print "1..$lastcase\n";

######################################################################
# Demonstrate the base class.


{ # Check scoping
        no strict 'vars';
        package Text::Aspell::test;
        @ISA = 'Text::Aspell';
        sub DESTROY { print "ok 1 destroyed by out of scope\n"; Text::Aspell::DESTROY(@_) }
        my $a = Text::Aspell::test->new;
}
print "ok 2\n";

my $speller = Text::Aspell->new;
print defined $speller ? "ok 3\n" : "not ok 3\n";

exit unless $speller;

print $speller->set_option('sug-mode','fast') ? "ok 4\n" : "not ok 4 " . $speller->errstr . "\n";


#print defined $speller->create_speller ? "ok 4\n" : "not ok 4 " . $speller->errstr . "\n";

print defined $speller->print_config ? "ok 5\n" : "not ok 5 " . $speller->errstr . "\n";

my $language = $speller->get_option('lang');

print defined $language ? "ok 6\n" : "not ok 6 " . $speller->errstr . "\n";

print defined $language && $language eq 'en_US' ? "ok 7 $language\n" : "not ok 7\n";

print $speller->check('test') ? "ok 8\n" : "not ok 8 " . $speller->errstr . "\n"; 

print $speller->suggest('testt') ? "ok 9\n" : "not ok 9\n";

my @s_words = $speller->suggest('testt');
print @s_words > 2 ? "ok 10 @s_words\n" : "not ok 10\n";

print defined $speller->print_config ? "ok 11\n" : "not ok 11 " . $speller->errstr . "\n";

print $speller->add_to_session('testt') ? "ok 12\n" : "not ok 12 " . $speller->errstr . "\n";
@s_words = $speller->suggest('testt');

print '',(grep { $_ eq 'testt' } @s_words ) ? "ok 13 @s_words\n" : "not ok 13\n";

print $speller->store_replacement('foo', 'bar') ? "ok 14\n" : "not ok 14 " . $speller->errstr . "\n";

@s_words = $speller->suggest('foo');
print '',(grep { $_ eq 'bar' } @s_words ) ? "ok 15 @s_words\n" : "not ok 15\n";

print $speller->clear_session ? "ok 16\n" : "not ok 16 " . $speller->errstr . "\n";
@s_words = $speller->suggest('testt');
print '',(!grep { $_ eq 'testt' } @s_words)  ? "ok 17 @s_words\n" : "not ok 17 @s_words\n";

my @dicts = $speller->list_dictionaries;
print @dicts ? "ok 18 " . scalar @dicts . " dictionaries found\n" : "not ok 18\n";

@dicts = $speller->dictionary_info;
print @dicts ? "ok 19 " . scalar @dicts . " dictionaries found\n" : "not ok 19\n";


my @list = $speller->get_option_as_list('sgml-extension');

print @list > 1 ? "ok 20 [@list]\n" : "not ok 20 " . $speller->errstr . "\n";

my $options = $speller->fetch_option_keys;

my $keys_count = ref $options eq 'HASH' ? keys %$options : 0;

use Data::Dumper;
print Dumper $options if $keys_count;

print $keys_count ? "ok 21 [$keys_count options]\n" : "not ok 21\n";