summaryrefslogtreecommitdiff
path: root/test/vytree_test.ml
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2017-01-12 20:23:52 +0700
committerDaniil Baturin <daniil@baturin.org>2017-01-12 20:23:52 +0700
commit26fc59887e8c596dad4e67d350b26c5e908be259 (patch)
tree83fb63fb0de514a0772a90cfbdac27c125cfd3fd /test/vytree_test.ml
parentf947b3e8e7b9db2fcab250ce6d8050b650130cec (diff)
downloadvyconf-26fc59887e8c596dad4e67d350b26c5e908be259.tar.gz
vyconf-26fc59887e8c596dad4e67d350b26c5e908be259.zip
T245: improve handling of nodes with duplicate names.
Two tag nodes with the same name ("ethernet eth0 {...} ethernet eth0 {...}") is an error. Two leaf nodes with the same name, however, are not an error. Values of the next nodes are merged into the first one, while all other data (comment and inactive and ephemeral properties are inherited from the first node. This mimics the old syntax of multi nodes, so a person who uses the old syntax out of habit in a handwritten config will get the result they expect.
Diffstat (limited to 'test/vytree_test.ml')
-rw-r--r--test/vytree_test.ml4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/vytree_test.ml b/test/vytree_test.ml
index 3cf3ae6..4da2335 100644
--- a/test/vytree_test.ml
+++ b/test/vytree_test.ml
@@ -139,7 +139,7 @@ let test_merge_children_no_duplicates test_ctxt =
[make_full () "foo" [make () "bar"];
make () "bar";
make_full () "baz" [make () "quuz"]] in
- let node' = merge_children node in
+ let node' = merge_children (fun x y -> x) node in
assert_equal (list_children node') ["foo"; "bar"; "baz"]
@@ -151,7 +151,7 @@ let test_merge_children_has_duplicates test_ctxt =
[make_full () "foo" [make () "bar"];
make () "quux";
make_full () "foo" [make () "baz"]] in
- let node' = merge_children node in
+ let node' = merge_children (fun x y -> x) node in
assert_equal (list_children node') ["foo"; "quux"];
assert_equal (get node' ["foo"] |> list_children) ["bar"; "baz"]