[folks] tests: Add assertions to check for null DateTimes



commit 0085cb463849e5b30d4b4c58da63a5df3fd0d0be
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sun Apr 20 21:12:52 2014 +0100

    tests: Add assertions to check for null DateTimes
    
    If the DateTime would end up being invalid, construction fails and null
    is returned. Gracefully catch that in the unit tests.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727944

 tests/eds/add-contacts-stress-test.vala    |    2 ++
 tests/telepathy/individual-properties.vala |    1 +
 2 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/tests/eds/add-contacts-stress-test.vala b/tests/eds/add-contacts-stress-test.vala
index fb024e7..74b9dab 100644
--- a/tests/eds/add-contacts-stress-test.vala
+++ b/tests/eds/add-contacts-stress-test.vala
@@ -52,12 +52,14 @@ public class AddContactsStressTestTests : EdsTest.TestCase
         }
 
       this._start_time = new DateTime.now_utc ();
+      assert (this._start_time != null);
 
       this._test_add_persona_async.begin ();
 
       this._main_loop.run ();
 
       var now = new DateTime.now_utc ();
+      assert (now != null);
       var difference = now.difference (this._start_time);
 
       var diff = difference / TimeSpan.SECOND;
diff --git a/tests/telepathy/individual-properties.vala b/tests/telepathy/individual-properties.vala
index 5351824..955b5ef 100644
--- a/tests/telepathy/individual-properties.vala
+++ b/tests/telepathy/individual-properties.vala
@@ -375,6 +375,7 @@ public class IndividualPropertiesTests : TpfTest.TestCase
       var timeval = TimeVal ();
       timeval.from_iso8601 ("1929-01-11T00:00:00Z");
       var new_birthday = new DateTime.from_timeval_utc (timeval);
+      assert (new_birthday != null);
       var new_email_fd = new EmailFieldDetails ("cave aperturescience com");
       new_email_fd.set_parameter (AbstractFieldDetails.PARAM_TYPE,
           AbstractFieldDetails.PARAM_TYPE_WORK);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]