[gxml] * test to_string for Document and Element
- From: Richard Hans Schwarting <rschwart src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] * test to_string for Document and Element
- Date: Fri, 22 Jul 2011 00:48:26 +0000 (UTC)
commit 82d35186d91949327a9c1c64d66fe6d4d4d2dd83
Author: Richard Schwarting <aquarichy gmail com>
Date: Thu Jul 21 20:47:11 2011 -0400
* test to_string for Document and Element
test/DocumentTest.vala | 26 ++++++++++++++++++++++++++
test/ElementTest.vala | 11 +++++++++++
2 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/test/DocumentTest.vala b/test/DocumentTest.vala
index a4d4dd8..279a151 100644
--- a/test/DocumentTest.vala
+++ b/test/DocumentTest.vala
@@ -214,6 +214,32 @@ class DocumentTest : GXmlTest {
assert (false);
}
});
+ Test.add_func ("/gxml/document/to_string", () => {
+ try {
+ Document doc = get_doc ();
+ assert (doc.to_string () == "<?xml version=\"1.0\"?>
+<Sentences>
+ <Sentence lang=\"en\">I like the colour blue.</Sentence>
+ <Sentence lang=\"de\">Ich liebe die Tür.</Sentence>
+ <Authors>
+ <Author>
+ <Name>Fred</Name>
+ <Email>fweasley hogwarts co uk</Email>
+ </Author>
+ <Author>
+ <Name>George</Name>
+ <Email>gweasley hogwarts co uk</Email>
+ </Author>
+ </Authors>
+</Sentences>
+");
+ // TODO: want to test with format on and off
+ } catch (GXml.Dom.DomError e) {
+ GLib.warning ("%s", e.message);
+ assert (false);
+ }
+
+ });
}
public static void print_node (XNode node) {
diff --git a/test/ElementTest.vala b/test/ElementTest.vala
index ff3d06e..01d429f 100644
--- a/test/ElementTest.vala
+++ b/test/ElementTest.vala
@@ -182,5 +182,16 @@ class ElementTest : GXmlTest {
assert (false);
}
});
+ Test.add_func ("/gxml/element/to_string", () => {
+ try {
+ Element elem = get_elem_new_doc ("country");
+ elem.append_child (elem.owner_document.create_text_node ("New Zealand"));
+ assert (elem.to_string () == "<country>New Zealand</country>");
+ // TODO: want to test with format on and off
+ } catch (GXml.Dom.DomError e) {
+ GLib.warning ("%s", e.message);
+ assert (false);
+ }
+ });
}
}
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]