File: 04-invalid-inputs.t

package info (click to toggle)
libtext-levenshtein-perl 0.13-1
  • links: PTS, VCS
  • area: main
  • in suites: buster, sid, stretch
  • size: 148 kB
  • ctags: 6
  • sloc: perl: 460; makefile: 2
file content (29 lines) | stat: -rw-r--r-- 856 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
#! perl

use strict;
use warnings;
use Test::More 0.88 tests => 5;
use Text::Levenshtein qw/ distance fastdistance /;

my $distance;

eval { $distance = distance() };
ok($@ && $@ =~ m!takes 2 or more arguments!,
   "passing no arguments to distance() should croak");

eval { $distance = distance('pink') };
ok($@ && $@ =~ m!takes 2 or more arguments!,
   "passing one argument to distance() should croak");

eval { $distance = fastdistance() };
ok($@ && $@ =~ m!takes 2 or 3 arguments!,
   "passing no arguments to fastdistance() should croak");

eval { $distance = fastdistance('pink') };
ok($@ && $@ =~ m!takes 2 or 3 arguments!,
   "passing one argument to fastdistance() should croak");

eval { $distance = fastdistance('pink', 'blue', 'brown') };
ok($@ && $@ =~ m!takes 2 or 3 arguments!,
   "passing three argument to fastdistance() should croak");