File: 4_invalid.t

package info (click to toggle)
libconfig-properties-perl 1.80-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 160 kB
  • sloc: perl: 479; makefile: 2
file content (36 lines) | stat: -rw-r--r-- 639 bytes parent folder | download | duplicates (3)
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
# -*- Mode: Perl -*-
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl 1.t'

use Test::More tests => 1;

use Config::Properties;

my $cfg=Config::Properties->new();

my %valid = map { $_=> 1 }
    qw ( foo Bar eq=ua:l more cra\n=:\ \\z'y' );

$cfg->setValidator( sub { $valid{shift()} } );

eval {
    $cfg->load(\*DATA);
};

like ($@, qr/less.*line 9\b/, 'invalid line 9 is ok');




__DATA__
# hello
foo=one
    Bar : maybe one\none\tone\r
eq\=ua\:l jamon

more : another \
    configuration \
    line
less= who said:\tless ??? 

cra\n\=\:\ \\z'y' jump