File: undef.t

package info (click to toggle)
libconfig-std-perl 0.903-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 236 kB
  • sloc: perl: 383; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 450 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
use Config::Std;
use Test::More 'no_plan';

my %data = (
    'FOO' => {
        'foo1'     => 'defined',
        'foo2'     =>  undef,
    },
);

local $SIG{__WARN__} = sub {
    ok 0 => "Bad warning: @_";
};

my $output;

ok !eval{ write_config %data => \$output }    => 'Write failed as expected';

like $@, qr(\A\QCan't save undefined value for key {'FOO'}{'foo2'})
                                            => 'Failed with expected exception';