File: 13-multiline-labels-and-errors.t

package info (click to toggle)
libvalidation-class-perl 7.900057-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,572 kB
  • ctags: 355
  • sloc: perl: 21,493; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 892 bytes parent folder | download | duplicates (5)
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
use Test::More tests => 5;

package MyVal;

use Validation::Class;

field name => {
    required => 1,
    label    => q(
        This is a test of a particularly long
        label string
    ),
    error => q(
        The name parameter is required, in order
        to use this parameter you must kill three goats
        and eat the flesh of an african albino tree spider
    )
};

package main;

use strict;
use warnings;

my $v = MyVal->new(params => {});

ok $v, 'initialization successful';

ok $v->fields->{name}->{label} !~ /[\n\t\r]/,
  'label does not have new-lines, carriage-returns and tabs';
ok $v->fields->{name}->{label} !~ /\s{2,}/,
  'label does not have consecutive spaces';
ok $v->fields->{name}->{error} !~ /[\n\t\r]/,
  'error does not have new-lines, carriage-returns and tabs';
ok $v->fields->{name}->{error} !~ /\s{2,}/,
  'error does not have consecutive spaces';