summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2016-12-22 06:42:44 +0700
committerDaniil Baturin <daniil@baturin.org>2016-12-22 06:42:44 +0700
commit53c65bd44ace64c39bb3019cf6884e929ebc6f4d (patch)
tree33e1813e2038e8be60e85084178d428999d90301 /test
parent245128cf5b877ecf9821d677e789d7ba9e7fe7cc (diff)
parent3e66b20e08e4c3271a13797dade33426cad3fde0 (diff)
downloadvyconf-53c65bd44ace64c39bb3019cf6884e929ebc6f4d.tar.gz
vyconf-53c65bd44ace64c39bb3019cf6884e929ebc6f4d.zip
Merge branch 'philsummers-master'
Diffstat (limited to 'test')
-rw-r--r--test/config_tree_test.ml25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/config_tree_test.ml b/test/config_tree_test.ml
index a486249..7057b94 100644
--- a/test/config_tree_test.ml
+++ b/test/config_tree_test.ml
@@ -69,6 +69,28 @@ let test_set_comment test_ctxt =
let node = CT.set_comment node path (Some "comment") in
assert_equal (CT.get_comment node path) (Some "comment")
+(* Creating a node without a value should default inactive and ephemeral to false *)
+let test_valueless_node_inactive_ephemeral test_ctxt =
+ let path = ["foo"; "bar"] in
+ let node = CT.make "root" in
+ let node = CT.set node path None CT.AddValue in
+ assert_equal ((not (CT.is_inactive node path)) && (not (CT.is_ephemeral node path))) true
+
+(* Setting a node inactive should work *)
+let test_set_inactive test_ctxt =
+ let path = ["foo"; "bar"] in
+ let node = CT.make "root" in
+ let node = CT.set node path None CT.AddValue in
+ let node = CT.set_inactive node path (true) in
+ assert_equal (CT.is_inactive node path) true
+
+(* Setting a node ephemeral should work *)
+let test_set_ephemeral test_ctxt =
+ let path = ["foo"; "bar"] in
+ let node = CT.make "root" in
+ let node = CT.set node path None CT.AddValue in
+ let node = CT.set_ephemeral node path (true) in
+ assert_equal (CT.is_ephemeral node path) true
let suite =
"VyConf config tree tests" >::: [
@@ -80,6 +102,9 @@ let suite =
"test_delete_last_value" >:: test_delete_last_value;
"test_delete_subtree" >:: test_delete_subtree;
"test_set_comment" >:: test_set_comment;
+ "test_valueless_node_inactive_ephemeral" >:: test_valueless_node_inactive_ephemeral;
+ "test_set_inactive" >:: test_set_inactive;
+ "test_set_ephemeral" >:: test_set_ephemeral;
]
let () =