[gxml] GomDocument: Additional checks on parse default root
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] GomDocument: Additional checks on parse default root
- Date: Thu, 21 Mar 2019 23:56:49 +0000 (UTC)
commit 7920720c75167fa0f7750681bc0e11a7149bcc7d
Author: Daniel Espinosa <esodan gmail com>
Date: Thu Mar 21 16:53:05 2019 -0600
GomDocument: Additional checks on parse default root
test/GomDocumentTest.vala | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/test/GomDocumentTest.vala b/test/GomDocumentTest.vala
index f7edf33..2f21389 100644
--- a/test/GomDocumentTest.vala
+++ b/test/GomDocumentTest.vala
@@ -26,6 +26,11 @@ class GomDocumentTest : GXmlTest {
class ObjectDocument : GomDocument {
[Description (nick="::ROOT")]
public ObjectParent root_element { get; set; }
+ construct {
+ var dt = new GomDocumentType (this, "svg", "-//W3C//DTD SVG 1.1//EN",
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd");
+ try { append_child (dt); } catch (GLib.Error e) { warning ("Error: "+e.message); }
+ }
public class ObjectParent : GomElement {
construct {
try { initialize ("root"); }
@@ -754,9 +759,14 @@ class GomDocumentTest : GXmlTest {
Test.add_func ("/gxml/gom-document/parse-root-element", () => {
try {
var d = new ObjectDocument ();
- d.read_from_string ("""<root><child id="id1"/><child id="id2"/></root>""");
+ assert (d.root_element == null);
+ d.read_from_string ("""<root text="val2" prop="yat"><child id="id1"/><child
id="id2"/></root>""");
message (d.write_string ());
assert (d.root_element != null);
+ assert (d.root_element.text != null);
+ assert (d.root_element.text == "val2");
+ assert (d.root_element.prop != null);
+ assert (d.root_element.prop.value == "yat");
} 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]