summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2015-04-01 23:43:31 +0600
committerDaniil Baturin <daniil@baturin.org>2015-04-01 23:43:31 +0600
commit13e194a7bcf3161f05bcfb55d1433d46601018a3 (patch)
treeeea504a3a912e9d5d62ca37246dde32344649821 /test
parent86a5e1a1a62474b22e0f8435228acd88c8813330 (diff)
downloadvyconf-13e194a7bcf3161f05bcfb55d1433d46601018a3.tar.gz
vyconf-13e194a7bcf3161f05bcfb55d1433d46601018a3.zip
Add Vytree.update for updating the data attached to nodes.
Diffstat (limited to 'test')
-rw-r--r--test/vyconf_tree_test.ml7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/vyconf_tree_test.ml b/test/vyconf_tree_test.ml
index 51707a8..eca40ce 100644
--- a/test/vyconf_tree_test.ml
+++ b/test/vyconf_tree_test.ml
@@ -90,6 +90,12 @@ let test_get_child_nonexistent test_ctxt =
let node = make "root" () in
assert_raises Nonexistent_path (fun () -> get node ["foo"; "bar"])
+(* update works *)
+let test_update test_ctxt =
+ let node = make "root" 0 in
+ let node = insert 0 node ["foo"] 1 in
+ assert_equal (data_of_node (update node ["foo"] 9)) 9
+
let suite =
"VyConf tree tests" >::: [
"test_make_node" >:: test_make_node;
@@ -104,6 +110,7 @@ let suite =
"test_get_immediate_child" >:: test_get_immediate_child;
"test_get_child_multilevel" >:: test_get_child_multilevel;
"test_get_child_nonexistent" >:: test_get_child_nonexistent;
+ "test_update" >:: test_update;
]
let () =