Make EdsTest.TestCase.eds_backend nullable
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Thu, 14 Mar 2013 14:53:13 +0000 (14:53 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 18 Mar 2013 19:08:25 +0000 (19:08 +0000)
It's null outside the period from set_up() to tear_down().

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=695381
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Philip Withnall <philip@tecnocode.co.uk>
tests/lib/eds/test-case.vala

index ded678a..cecc16e 100644 (file)
@@ -24,7 +24,7 @@
 
 public class EdsTest.TestCase : Folks.TestCase
 {
-  public EdsTest.Backend eds_backend;
+  public EdsTest.Backend? eds_backend = null;
 
   public TestCase (string name)
     {
@@ -41,13 +41,14 @@ public class EdsTest.TestCase : Folks.TestCase
   public virtual void create_backend ()
     {
       this.eds_backend = new EdsTest.Backend ();
-      this.eds_backend.set_up ();
+      ((!) this.eds_backend).set_up ();
     }
 
   public virtual void configure_primary_store ()
     {
       /* By default, configure EDS as the primary store. */
-      var config_val = "eds:%s".printf (this.eds_backend.address_book_uid);
+      assert (this.eds_backend != null);
+      string config_val = "eds:" + ((!) this.eds_backend).address_book_uid;
       Environment.set_variable ("FOLKS_PRIMARY_STORE", config_val, true);
     }