[gxml] Added unit test for SerializableDouble for invalid values set in xml
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gxml] Added unit test for SerializableDouble for invalid values set in xml
- Date: Thu, 22 Oct 2015 14:30:54 +0000 (UTC)
commit 41657b51c74aae229d7aae283442438f23884c9f
Author: Daniel Espinosa <esodan gmail com>
Date: Wed Oct 21 19:46:27 2015 -0500
Added unit test for SerializableDouble for invalid values set in xml
test/SerializablePropertyDoubleTest.vala | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/test/SerializablePropertyDoubleTest.vala b/test/SerializablePropertyDoubleTest.vala
index 2622594..223ef3e 100644
--- a/test/SerializablePropertyDoubleTest.vala
+++ b/test/SerializablePropertyDoubleTest.vala
@@ -119,5 +119,21 @@ class SerializablePropertyDoubleTest : GXmlTest {
assert_not_reached ();
}
});
+ Test.add_func ("/gxml/serializable/Double/deserialize/bad-value",
+ () => {
+ try {
+ var doc1 = new xDocument.from_string ("""<?xml version="1.0"?>
+ <DoubleNode DoubleValue="a"/>""");
+ var d = new DoubleNode ();
+ d.deserialize (doc1);
+ Test.message ("Actual value: "+d.double_value.get_serializable_property_value ());
+ assert (d.double_value.get_serializable_property_value () == "a");
+ Test.message ("Actual value parse: "+"%2.4f".printf (double.parse
(d.double_value.get_serializable_property_value ())));
+ assert ("%2.4f".printf (double.parse (d.double_value.get_serializable_property_value ())) ==
"0.0000");
+ } catch (GLib.Error e) {
+ Test.message (@"ERROR: $(e.message)");
+ assert_not_reached ();
+ }
+ });
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]