File: 17-perldsc.t

package info (click to toggle)
libconfig-scoped-perl 0.12-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 752 kB
  • ctags: 73
  • sloc: perl: 10,347; makefile: 42
file content (38 lines) | stat: -rw-r--r-- 770 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
28
29
30
31
32
33
34
35
36
37
38
# vim: cindent ft=perl sm sw=4

use warnings;
use strict;

use Test::More tests => 4;

BEGIN { use_ok('Config::Scoped') }
my ( $p, $cfg );

my $text = <<'eot';
'a' => [ '1', '2', '3', { 'foo' => 'bar' }, '4', '5', '6' ]
eot

my $expected =
  { '_GLOBAL' =>
      { 'a' => [ '1', '2', '3', { 'foo' => 'bar' }, '4', '5', '6' ] } };

isa_ok( $p = Config::Scoped->new(), 'Config::Scoped' );
is_deeply( $p->parse( text => $text ), $expected, 'hol' );

$text = <<'eot';
'bar' => { 'a' => '2' },
'baz' => { 'a' => '1' },
'foo' => { 'a' => '3' }
eot

$expected = {
    '_GLOBAL' => {
        'bar' => { 'a' => '2' },
        'baz' => { 'a' => '1' },
        'foo' => { 'a' => '3' }
    }
};

$p = Config::Scoped->new;
is_deeply( $p->parse( text => $text ), $expected, 'hoh' );