File: basic.t

package info (click to toggle)
libpod-spell-perl 1.20-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 288 kB
  • ctags: 23
  • sloc: perl: 493; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 1,217 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
use strict;
use warnings;
use Test::More;
use Test::Deep;
use File::Temp;

use Pod::Spell;
use Pod::Wordlist;

# realistically we're just checking to make sure the number seems reasonable
# and not broken
cmp_ok scalar( keys %Pod::Wordlist::Wordlist ), '>=', 1000, 'key count';

my $podfile  = File::Temp->new;
my $textfile = File::Temp->new;

print $podfile "\n=head1 TEST tree's undef\n"
	. "\n=for stopwords zpaph DDGGSS's myormsp pleumgh bruble-gruble\n"
	. "\n=for :stopwords !myormsp furble\n\n Glakq\n"
	. "\nPleumgh bruble-gruble DDGGSS's zpaph's zpaph-kafdkaj-snee myormsp snickh furbles.\n"
	. "\nFoo::Bar \$a \@b \%c __PACKAGE__->mumble() Foo->{\$bar}\n"
	. qq[\n"'" Kh.D. ('WinX32'.) L<Storable>'s\n]
	. qq[\n]
	;

# reread from beginning
$podfile->seek( 0, 0 );

my $p = new_ok 'Pod::Spell' => [ debug => 1 ];

$p->parse_from_filehandle( $podfile, $textfile );

# reread from beginning
$textfile->seek( 0, 0 );

my $in = do { local $/ = undef, <$textfile> };

my @words = split " ", $in;

my @expected = qw( TEST tree kafdkaj snee myormsp snickh Kh.D. WinX32 s );
is scalar @words, scalar @expected, 'word count';

cmp_deeply \@words, bag( @expected ), 'words match'
    or diag "@words";

done_testing;