[gxml] GomArrayList: Added unit test
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] GomArrayList: Added unit test
- Date: Sun, 6 Nov 2016 17:23:22 +0000 (UTC)
commit ed44ae7171939b7dbc06c6bc2522ce9f0ee2da89
Author: Daniel Espinosa <esodan gmail com>
Date: Sun Nov 6 11:21:49 2016 -0600
GomArrayList: Added unit test
test/GomSerializationTest.vala | 25 +++++++++++++++++++++++--
1 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/test/GomSerializationTest.vala b/test/GomSerializationTest.vala
index 16853ee..238a1d7 100644
--- a/test/GomSerializationTest.vala
+++ b/test/GomSerializationTest.vala
@@ -29,6 +29,9 @@ class GomSerializationTest : GXmlTest {
construct {
_local_name = "Book";
}
+ public Book.document (DomDocument doc) {
+ _document = doc;
+ }
public string to_string () {
var parser = new XParser (this);
return parser.write_string ();
@@ -72,6 +75,9 @@ class GomSerializationTest : GXmlTest {
construct {
_local_name = "BookRegister";
}
+ public BookRegister.document (DomDocument doc) {
+ _document = doc;
+ }
public string to_string () {
var parser = new XParser (this);
return parser.write_string ();
@@ -144,16 +150,31 @@ class GomSerializationTest : GXmlTest {
var bs = new BookStand ();
string s = bs.to_string ();
assert (s != null);
- assert ("<BookStand Classification=\"Science\"/>" in s);
GLib.message ("DOC:"+s);
+ assert ("<BookStand Classification=\"Science\"/>" in s);
+ assert (bs.registers == null);
var br = new BookRegister ();
br.year = 2016;
- assert (bs.registers == null);
bs.registers = new GomArrayList.initialize (bs,br.local_name);
s = bs.to_string ();
assert (s != null);
+ GLib.message ("DOC:"+s);
assert ("<BookStand Classification=\"Science\"/>" in s);
+ try { bs.registers.add (br); } catch {}
+ br = new BookRegister.document (bs.owner_document);
+ bs.registers.add (br);
+ s = bs.to_string ();
+ assert (s != null);
+ GLib.message ("DOC:"+s);
+ assert ("<BookStand Classification=\"Science\"><BookRegister Year=\"0\"/></BookStand>" in s);
+ var br2 = new BookRegister.document (bs.owner_document);
+ bs.registers.add (br2);
+ var br3 = new BookRegister.document (bs.owner_document);
+ bs.registers.add (br3);
+ s = bs.to_string ();
+ assert (s != null);
GLib.message ("DOC:"+s);
+ assert ("<BookStand Classification=\"Science\"><BookRegister Year=\"0\"/><BookRegister
Year=\"0\"/><BookRegister Year=\"0\"/></BookStand>" in s);
});
Test.add_func ("/gxml/gom-serialization/read/properties", () => {
var b = new Book ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]