File: 03-mixed.t

package info (click to toggle)
libconfig-onion-perl 1.007-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 200 kB
  • sloc: perl: 151; makefile: 12
file content (26 lines) | stat: -rw-r--r-- 617 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
use strict;
use warnings;

use Test::More;

use Config::Onion;

use FindBin;
my $test_dir = $FindBin::Bin;

# construct with set_default, then load conf files over the defaults and
# apply an override
{
  my $cfg = Config::Onion->set_default(foo => 'default');
  $cfg->load("$test_dir/conf/basic");
  is($cfg->get->{foo}, 'bar', 'main config file overwrites defaults');

  $cfg->load("$test_dir/conf/withlocal");
  is($cfg->get->{local}, 1, 'local config file overwrites defaults and main');

  $cfg->set_override(foo => 'baz');
  is($cfg->get->{foo}, 'baz', 'override overwrites everything else');
}

done_testing;