[gxml] Fixed more Unit Test



commit d9ba53da08c723fe21e4172246001a4bbee4a709
Author: Daniel Espinosa <esodan gmail com>
Date:   Fri May 8 18:22:50 2015 -0500

    Fixed more Unit Test
    
    * Fixed /gxml/serializable/convined_gee_containers/se-deserialize-unknowns

 gxml/libxml-Element.vala                 |    2 +-
 test/SerializableGeeCollectionsTest.vala |   18 +++---------------
 test/SerializableObjectModelTest.vala    |   18 ++----------------
 3 files changed, 6 insertions(+), 32 deletions(-)
---
diff --git a/gxml/libxml-Element.vala b/gxml/libxml-Element.vala
index 3f78e74..d7be782 100644
--- a/gxml/libxml-Element.vala
+++ b/gxml/libxml-Element.vala
@@ -447,7 +447,7 @@ namespace GXml {
                 */
                public string content {
                        owned get {
-                               _content = null;
+                               _content = "";
                                foreach (xNode n in child_nodes) {
                                        if (n is xText) {
                                                if (_content == null) _content = "";
diff --git a/test/SerializableGeeCollectionsTest.vala b/test/SerializableGeeCollectionsTest.vala
index ec0e556..21231e8 100644
--- a/test/SerializableGeeCollectionsTest.vala
+++ b/test/SerializableGeeCollectionsTest.vala
@@ -485,21 +485,9 @@ class SerializableGeeCollectionsTest : GXmlTest
           stdout.printf (@"ERROR: No Refaction MacToy/Fly045 found!\n");
           assert_not_reached ();
         }
-        if (refaction.unknown_serializable_properties == null) {
-          stdout.printf (@"ERROR: Refaction: No unknown properties/nodes found!\n");
-          assert_not_reached ();
-        }
-        if (refaction.unknown_serializable_properties.size != 1) {
-          stdout.printf (@"ERROR: Refaction: Bad unknown properties/nodes number: found 
$(refaction.unknown_serializable_properties.size)\n");
-          foreach (GXml.Node unk in refaction.unknown_serializable_properties.values)
-          {
-            string unkv = "___NULL__";
-            if (unk.value != null)
-              unkv = unk.value;
-            stdout.printf (@"Unknown Node: $(unk.name) / value: '$(unkv)'");
-          }
-          assert_not_reached ();
-        }
+        assert (refaction.unknown_serializable_properties != null);
+        assert (refaction.unknown_serializable_properties.size == 0);
+        assert (refaction.unknown_serializable_nodes.size == 1);
         var doc = new xDocument ();
         s.serialize (doc);
         if (doc.document_element.node_name != "base") {
diff --git a/test/SerializableObjectModelTest.vala b/test/SerializableObjectModelTest.vala
index f7c16c5..8315ce5 100644
--- a/test/SerializableObjectModelTest.vala
+++ b/test/SerializableObjectModelTest.vala
@@ -836,24 +836,10 @@ class SerializableObjectModelTest : GXmlTest
                          }
                          assert_not_reached ();
                        }
-                       if (!unknown_property.unknown_serializable_properties.has_key ("ignore")) {
-                         stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: ignore not found");
-                         assert_not_reached ();
-                       }
                        var ignore = unknown_property.unknown_serializable_properties.get ("ignore");
-                       if (!(ignore is Attr)) {
-                         stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: ignore is not an GXml.Attr");
-                         assert_not_reached ();
-                       }
-                       if (!unknown_property.unknown_serializable_properties.has_key ("ignore2")) {
-                         stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: ignore not found");
-                         assert_not_reached ();
-                       }
+                       assert (ignore != null);
                        var ignore2 = unknown_property.unknown_serializable_properties.get ("ignore2");
-                       if (!(ignore2 is Attr)) {
-                         stdout.printf (@"ERROR: UNKNOWN_ATTRIBUTE: ignore2 is not an GXml.Attr");
-                         assert_not_reached ();
-                       }
+                       assert (ignore2 != null);
 #if DEBUG
                        GLib.message (@"Unknown nodes = $(unknown_property.unknown_serializable_nodes.size)");
 #endif


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