[gxml] Post release version up to 0.9.92. Extra checks for TDocument.ReadTypeFunc
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] Post release version up to 0.9.92. Extra checks for TDocument.ReadTypeFunc
- Date: Thu, 24 Mar 2016 23:57:05 +0000 (UTC)
commit b1e1c0d4a0d00c6f88df063edec4903092698511
Author: Daniel Espinosa <esodan gmail com>
Date: Thu Mar 24 17:55:18 2016 -0600
Post release version up to 0.9.92. Extra checks for TDocument.ReadTypeFunc
configure.ac | 2 +-
gxml/SerializableGeeArrayList.vala | 2 +-
gxml/TDocument.vala | 6 ++++--
test/TElementTest.vala | 35 ++++++++++++++++++++++++++++-------
4 files changed, 34 insertions(+), 11 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 58af991..e8c07e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,7 +12,7 @@
# Release Version
m4_define([project_major_version], [0])
m4_define([project_minor_version], [9])
-m4_define([project_micro_version], [91])
+m4_define([project_micro_version], [92])
m4_define([project_nano_version], [0])
# LT_VERSION
diff --git a/gxml/SerializableGeeArrayList.vala b/gxml/SerializableGeeArrayList.vala
index 98272e2..7ee66ae 100644
--- a/gxml/SerializableGeeArrayList.vala
+++ b/gxml/SerializableGeeArrayList.vala
@@ -62,7 +62,7 @@ public class GXml.SerializableArrayList<G> : Gee.ArrayList<G>, Serializable, Ser
}
if (_node is Element) {
#if DEBUG
- GLib.message (@"Deserializing ArrayList on Element: $(node.name)");
+ GLib.message (@"Deserializing ArrayList on Element: $(_node.name)");
#endif
foreach (GXml.Node n in _node.children) {
deserialize_node (n);
diff --git a/gxml/TDocument.vala b/gxml/TDocument.vala
index 8fd8460..24c7dc7 100644
--- a/gxml/TDocument.vala
+++ b/gxml/TDocument.vala
@@ -429,8 +429,10 @@ public class GXml.TDocument : GXml.TNode, GXml.Document
/**
* Delegate function to control parsing of XML documents. Return { link ReadType.NEXT}
* to skip all children nodes of current { link GXml.Node}; { link ReadType.CONTINUE}
- * to parse next child or node on reading; and { link ReadType.STOP} to finish
- * parsing.
+ * or { link ReadType.STOP} to parse next child or node on reading.
+ *
+ * While you get the current { link Xml.TextReader} used in parsing, you can control
+ * next action to take depending on current node.
*/
public delegate ReadType ReadTypeFunc (GXml.Node node, TextReader tr);
/**
diff --git a/test/TElementTest.vala b/test/TElementTest.vala
index 09fabd4..7958249 100644
--- a/test/TElementTest.vala
+++ b/test/TElementTest.vala
@@ -579,9 +579,7 @@ class TElementTest : GXmlTest {
var a = c.attrs.get ("source");
assert (a != null);
assert (a.value == "http://books.net/sources/1");
-//#if DEBUG
- GLib.message (@"$d");
-//#endif
+ Test.message (@"$d");
} catch { assert_not_reached (); }
});
Test.add_func ("/gxml/t-element/parent", () => {
@@ -630,11 +628,11 @@ class TElementTest : GXmlTest {
assert (nc.name == "Read");
assert (nc.children.size == 2);
// Remove all
- GLib.message ("Skiping nodes");
+ Test.message ("Skiping nodes");
TDocument.ReadTypeFunc f1 = (node, tr)=>{
- GLib.message ("ReadType check node: "+node.name);
+ Test.message ("ReadType check node: "+node.name);
if (node.name == "NoRead" || node.name == "NoReadChild") {
- GLib.message ("Skiping node: "+node.name);
+ Test.message ("Skiping node: "+node.name);
return TDocument.ReadType.NEXT;
}
return TDocument.ReadType.CONTINUE;
@@ -647,11 +645,34 @@ class TElementTest : GXmlTest {
assert (n2 != null);
assert (n2.name == "ReadTop");
assert (n2.children.size == 4);
- GLib.message (@"$d2");
+ Test.message (@"$d2");
var nc2 = n2.children[2];
assert (nc2 != null);
assert (nc2.name == "Read");
assert (nc2.children.size == 1);
+ // Checking ReadType.STOP effect
+ Test.message ("Skiping nodes using ReadType.STOP");
+ TDocument.ReadTypeFunc f2 = (node, tr)=>{
+ Test.message ("ReadType check node: "+node.name);
+ if (node.name == "NoRead" || node.name == "NoReadChild") {
+ Test.message ("Skiping node: "+node.name);
+ return TDocument.ReadType.STOP;
+ }
+ return TDocument.ReadType.CONTINUE;
+ };
+ var d3 = new TDocument ();
+ TDocument.read_doc (d3, file, f2);
+ Test.message (@"$d3");
+ assert (d3.root != null);
+ assert (d3.root.children.size == 7);
+ var n3 = d3.root.children[6];
+ assert (n3 != null);
+ assert (n3.name == "ReadTop");
+ assert (n3.children.size == 4);
+ var nc3 = n3.children[2];
+ assert (nc3 != null);
+ assert (nc3.name == "Read");
+ assert (nc3.children.size == 1);
} catch (GLib.Error e) {
GLib.message ("Error: "+e.message);
assert_not_reached ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]