[gxml] Unit Tests: adding test to XElement



commit b788f09936e95739fadb640356236af1b27b60b2
Author: Daniel Espinosa <esodan gmail com>
Date:   Sat Jul 3 17:37:34 2021 -0500

    Unit Tests: adding test to XElement

 test/XElementTest.vala | 36 +++++++++++++++++++-----------------
 1 file changed, 19 insertions(+), 17 deletions(-)
---
diff --git a/test/XElementTest.vala b/test/XElementTest.vala
index 9cc9cfba..1d5f9dbe 100644
--- a/test/XElementTest.vala
+++ b/test/XElementTest.vala
@@ -57,23 +57,25 @@ class XElementTest : GLib.Object  {
                                assert (n != null);
                                assert (n == "root");
                                assert (n0 is DomText);
-                               // BUG: This is failing under Vala 0.48.6 and address sanitized
-                               assert (doc.document_element.child_nodes[1] != null);
-                               assert (doc.document_element.child_nodes[1] is DomElement);
-                               assert (doc.document_element.child_nodes[1].node_name == "child");
-                               assert (((DomElement) 
doc.document_element.child_nodes[1]).next_element_sibling != null);
-                               assert (((DomElement) 
doc.document_element.child_nodes[1]).next_element_sibling is DomElement);
-                               assert (((DomElement) 
doc.document_element.child_nodes[1]).next_element_sibling.node_name == "child");
-                               assert (doc.document_element.child_nodes[2] != null);
-                               assert (doc.document_element.child_nodes[2].parent_node != null);
-                               assert (doc.document_element.child_nodes[2].parent_node.node_name == "root");
-                               assert (doc.document_element.child_nodes[2] is DomText);
-                               assert (doc.document_element.child_nodes[3] != null);
-                               assert (doc.document_element.child_nodes[3] is DomElement);
-                               assert (doc.document_element.child_nodes[3].node_name == "child");
-                               assert (((DomElement) 
doc.document_element.child_nodes[3]).previous_element_sibling != null);
-                               assert (((DomElement) 
doc.document_element.child_nodes[3]).previous_element_sibling is DomElement);
-                               assert (((DomElement) 
doc.document_element.child_nodes[3]).previous_element_sibling.node_name == "child");
+                               var n1 = doc.document_element.child_nodes[1];
+                               assert (n1 != null);
+                               assert (n1 is DomElement);
+                               assert (n1.node_name == "child");
+                               assert (((DomElement) n1).next_element_sibling != null);
+                               assert (((DomElement) n1).next_element_sibling is DomElement);
+                               assert (((DomElement) n1).next_element_sibling.node_name == "child");
+                               var n2 = doc.document_element.child_nodes[2];
+                               assert (n2 != null);
+                               assert (n2.parent_node != null);
+                               assert (n2.parent_node.node_name == "root");
+                               assert (n2 is DomText);
+                               var n3 = doc.document_element.child_nodes[3];
+                               assert (n3 != null);
+                               assert (n3 is DomElement);
+                               assert (n3.node_name == "child");
+                               assert (((DomElement) n3).previous_element_sibling != null);
+                               assert (((DomElement) n3).previous_element_sibling is DomElement);
+                               assert (((DomElement) n3).previous_element_sibling.node_name == "child");
                                } catch (GLib.Error e) {
                                        Test.message (e.message);
                                        assert_not_reached ();


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