summaryrefslogtreecommitdiff
path: root/t/02merge.t
blob: 77bf705820459f53ace460c2d01a823fd3a48380 (plain)
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
39
# -*- perl -*-
use lib qw(t lib);
use strict;
use Test;
use Config::Tree qw(:sort);
use Data::Dumper;

plan(tests => 1);

my $t = new Config::Tree(
    parameters => {
	x => {
	    section => {
		number => { array => 1 },
		name => 1
	    }
    	}
    });

my $node = new Config::Tree::Node::Section;
$node->subtree(number => new Config::Tree::Node::Value(
		   value => [1],
		   locus => new Text::Locus('input',1)));
$node->subtree(name => new Config::Tree::Node::Value(
		   value => 'foo',
		   locus => new Text::Locus('input',2)));
$t->add_node(x => $node);

$node = new Config::Tree::Node::Section;
$node->subtree(number => new Config::Tree::Node::Value(
		   value => 2,
		   locus => new Text::Locus('input',3)));
$node->subtree(name => new Config::Tree::Node::Value(
		   value => 'bar',
		   locus => new Text::Locus('input',4)));
$t->add_node(x => $node);

ok($t->canonical(delim => ' ', locus => 1),
    q{[input:2]: x.name="bar" [input:1,3]: x.number=[1,2]});

Return to:

Send suggestions and report system problems to the System administrator.