[gxml] * clean up a test function
- From: Richard Hans Schwarting <rschwart src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] * clean up a test function
- Date: Mon, 9 Jul 2012 20:21:16 +0000 (UTC)
commit be7e0f97516c2c02026d3315bc32047da49b2037
Author: Richard Schwarting <aquarichy gmail com>
Date: Mon Jul 9 14:54:17 2012 -0400
* clean up a test function
test/XmlSerializableTest.vala | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/test/XmlSerializableTest.vala b/test/XmlSerializableTest.vala
index ee07612..7e80b63 100644
--- a/test/XmlSerializableTest.vala
+++ b/test/XmlSerializableTest.vala
@@ -578,21 +578,27 @@ class XmlSerializableTest : GXmlTest {
test_serialization_deserialization (tomato, "interface_defaults", (GLib.EqualFunc)SerializableTomato.equals, (StringifyFunc)SerializableTomato.to_string);
});
Test.add_func ("/gxml/serialization/interface_overrides", () => {
- GLib.List<int> ratings = new GLib.List<int> ();
+ GXmlDom.XNode node;
+ SerializableCapsicum capsicum;
+ SerializableCapsicum capsicum_new;
+ string expected;
+ GLib.List<int> ratings;
+
+ ratings = new GLib.List<int> ();
ratings.append (8);
ratings.append (13);
ratings.append (21);
- SerializableCapsicum capsicum = new SerializableCapsicum (2, 3, 5, ratings);
- GXmlDom.XNode node = Serialization.serialize_object (capsicum);
+ capsicum = new SerializableCapsicum (2, 3, 5, ratings);
+ node = Serialization.serialize_object (capsicum);
- string expected = "<Object otype=\"SerializableCapsicum\"><Property pname=\"height\">6</Property><Property pname=\"ratings\"><rating>8</rating><rating>13</rating><rating>21</rating></Property></Object>";
+ expected = "<Object otype=\"SerializableCapsicum\"><Property pname=\"height\">6</Property><Property pname=\"ratings\"><rating>8</rating><rating>13</rating><rating>21</rating></Property></Object>";
if (node.to_string () != expected) {
GLib.warning ("Did not serialize as expected. Got [%s] but expected [%s]", node.to_string (), expected);
GLib.Test.fail ();
}
- SerializableCapsicum capsicum_new = (SerializableCapsicum)Serialization.deserialize_object (node);
+ capsicum_new = (SerializableCapsicum)Serialization.deserialize_object (node);
if (capsicum_new.height != 5 || ratings.length () != 3 || ratings.nth_data (0) != 8 || ratings.nth_data (2) != 21) {
GLib.warning ("Did not deserialize as expected. Got [%s] but expected height and ratings from [%s]", capsicum_new.to_string (), capsicum.to_string ());
GLib.Test.fail ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]