[gxml] Added unit tests for GomDocument.read_from_string()



commit d4c4f5732d783c22785fcb8db57bc3dc0b7b5315
Author: Daniel Espinosa <esodan gmail com>
Date:   Mon Dec 12 17:57:10 2016 -0600

    Added unit tests for GomDocument.read_from_string()

 test/GomDocumentTest.vala |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/test/GomDocumentTest.vala b/test/GomDocumentTest.vala
index 100091b..4f30646 100644
--- a/test/GomDocumentTest.vala
+++ b/test/GomDocumentTest.vala
@@ -220,6 +220,24 @@ class GomDocumentTest : GXmlTest {
                                assert (n1.node_name == "Apple");
                        } catch { assert_not_reached (); }
                        });
+               Test.add_func ("/gxml/gom-document/read_from_string", () => {
+                       try {
+                               string xml;
+                               GomDocument doc;
+                               GXml.DomNode document_element;
+
+                               xml = "<Fruits><Apple></Apple><Orange></Orange></Fruits>";
+                               doc = new GomDocument ();
+                               doc.read_from_string (xml);
+                               assert (doc.document_element != null);
+                               document_element = doc.document_element;
+                               assert (document_element.node_name == "Fruits");
+                               assert (document_element.child_nodes.size == 2);
+                               var n1 = document_element.child_nodes.get (0);
+                               assert (n1 != null);
+                               assert (n1.node_name == "Apple");
+                       } catch { assert_not_reached (); }
+                       });
                Test.add_func ("/gxml/gom-document/construct_from_string_no_document_element", () => {
                        try {
                                string xml;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]