summaryrefslogtreecommitdiffstats
path: root/t/020-random-word.t
blob: 98a17dfe9aa1848176f8f1bdf6d8d344508c2126 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!perl -T
use strict;
use warnings;
use Test::More tests => 3;
use Test::Exception;
use Games::Word::Wordlist;

my $wl = Games::Word::Wordlist->new(['foo', 'bar', 'baz']);
my $word;
lives_ok(sub { $word = $wl->random_word },
            "testing calling random_word with a good word list");
ok(defined($word), "random_word actually returned a word");

like($word, qr/^(foo|bar|baz)$/,
     "testing that the word is actually in the word list")