diff options
author | Daniil Baturin <daniil@baturin.org> | 2015-04-24 16:18:39 +0600 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2015-04-24 16:18:39 +0600 |
commit | 63bcc75d75ec0bc4642ff1d0354b6915b4b1e6a9 (patch) | |
tree | 38d469328c66fa64abec02f7607638a0f1fdd198 /test | |
parent | f6fad748cd5e68c36d4ed55e76c020d10d9bb7bd (diff) | |
download | vyconf-63bcc75d75ec0bc4642ff1d0354b6915b4b1e6a9.tar.gz vyconf-63bcc75d75ec0bc4642ff1d0354b6915b4b1e6a9.zip |
Make find_xml_child return Xml.xml option rather than raise Not_found.
Diffstat (limited to 'test')
-rw-r--r-- | test/util_test.ml | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/test/util_test.ml b/test/util_test.ml index ecc4b49..3625957 100644 --- a/test/util_test.ml +++ b/test/util_test.ml @@ -5,11 +5,14 @@ let test_find_xml_child_existent test_ctxt = let elem = Xml.Element ("foo", [], [Xml.Element ("bar", [], []); Xml.PCData "baz"]) - in assert_equal (Xml.tag (find_xml_child "bar" elem)) "bar" + in + match (find_xml_child "bar" elem) with + | None -> assert_failure "find_xml_child returned None" + | Some x -> assert_equal (Xml.tag x) "bar" let test_find_xml_child_nonexistent test_ctxt = let elem = Xml.Element ("foo", [], [Xml.Element ("quux", [], [])]) in - assert_raises Not_found (fun () -> find_xml_child "bar" elem) + assert_equal (find_xml_child "bar" elem) None let test_string_of_path test_ctxt = let path = ["foo"; "bar"; "baz"] in |