[gxml] * fix 3 tests
- From: Richard Hans Schwarting <rschwart src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] * fix 3 tests
- Date: Mon, 9 Jul 2012 20:21:31 +0000 (UTC)
commit 3481e1cb4ddaed0ee02ce25eba232550417436c7
Author: Richard Schwarting <aquarichy gmail com>
Date: Mon Jul 9 16:20:05 2012 -0400
* fix 3 tests
test/XmlSerializableTest.vala | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/test/XmlSerializableTest.vala b/test/XmlSerializableTest.vala
index 0f78286..fe08277 100644
--- a/test/XmlSerializableTest.vala
+++ b/test/XmlSerializableTest.vala
@@ -356,7 +356,10 @@ class XmlSerializableTest : GXmlTest {
fruit_xml = Serialization.serialize_object (fruit);
// TODO: This test currently should change once we can serialise fields and private properties
- if ("<Object otype='Fruit'><Property pname='age' ptype='gint'>9</Property></Object>" != fruit_xml.to_string ()) {
+ string expectation = "<Object otype=\"Fruit\"><Property pname=\"age\" ptype=\"gint\">9</Property></Object>";
+ if (expectation != fruit_xml.to_string ()) {
+ GLib.warning ("Expected [%s] but found [%s]",
+ expectation, fruit_xml.to_string ());
GLib.Test.fail ();
}
} catch (GXmlDom.SerializationError e) {
@@ -375,7 +378,10 @@ class XmlSerializableTest : GXmlTest {
try {
fruit_xml = Serialization.serialize_object (fruit);
- if ("<Object otype='Fruit'><Property pname='colour'>blue</Property><Property pname='weight'>9</Property><Property pname='name'>fish</Property><Property pname='age' ptype='gint'>3</Property></Object>" != fruit_xml.to_string ()) { // weight expected to be 3 because age sets it *3
+ string expectation = "<Object otype=\"Fruit\"><Property pname=\"colour\">blue</Property><Property pname=\"weight\">9</Property><Property pname=\"name\">fish</Property><Property pname=\"age\" ptype=\"gint\">3</Property></Object>";
+ if (expectation != fruit_xml.to_string ()) { // weight expected to be 3 because age sets it *3
+ GLib.warning ("Expected [%s] but found [%s]",
+ expectation, fruit_xml.to_string ());
GLib.Test.fail ();
}
} catch (GXmlDom.SerializationError e) {
@@ -385,10 +391,12 @@ class XmlSerializableTest : GXmlTest {
});
Test.add_func ("/gxml/domnode/xml_deserializable", () => {
try {
- Document doc = new Document.from_string ("<Object otype='Fruit'><Property pname='age' ptype='gint'>3</Property></Object>"); // Shouldn't need to have type if we have a known property name for a known type
+ Document doc = new Document.from_string ("<Object otype='Fruit'><Property pname='age' ptype='gint'>3</Property></Object>");
Fruit fruit = (Fruit)Serialization.deserialize_object (doc.document_element);
- if (fruit.age != 3) {
+ // we expect 9 because Fruit triples it in the setter
+ if (fruit.age != 9) {
+ GLib.warning ("Expected fruit.age [%d] but found [%d]", 9, fruit.age);
GLib.Test.fail (); // TODO: check weight?
}
} catch (GLib.Error e) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]