File: 07-FF-Value-Random.t

package info (click to toggle)
libwww-mechanize-formfiller-perl 0.13-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 308 kB
  • sloc: perl: 1,555; sh: 6; makefile: 2
file content (27 lines) | stat: -rwxr-xr-x 909 bytes parent folder | download | duplicates (6)
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
use strict;


use Test::More tests => 1 + 3 + 3;

use_ok("WWW::Mechanize::FormFiller::Value::Random");

SKIP: {
  eval { require Test::MockObject };
  skip "Need Test::MockObject to do tests on values", 3+3
    if $@;

  my @values = ("foo","bar","baz");
  my $value;
  
  my $input = Test::MockObject->new()->set_always('value',$value);
  my $v = WWW::Mechanize::FormFiller::Value::Random->new("foo","bar");
  isa_ok($v,"WWW::Mechanize::FormFiller::Value::Random");
  can_ok($v,"value");
  is($v->value($input),"bar","Single argument list returns single argument");

  $input = Test::MockObject->new()->set_always('value',$value);
  $v = WWW::Mechanize::FormFiller::Value::Random->new("foo",@values);
  isa_ok($v,"WWW::Mechanize::FormFiller::Value::Random");
  can_ok($v,"value");
  like($v->value($input),"/" . join("|",@values)."/","Multiple arguments return one of the list");
};