[folks] Add basic equality testing for ImFieldDetails.



commit 171298f67620cf238f42b6d7d53622bbf96bfdee
Author: Travis Reitter <travis reitter collabora co uk>
Date:   Tue Jul 12 11:20:56 2011 -0700

    Add basic equality testing for ImFieldDetails.
    
    Helps: bug#653680 - Change ImDetails.im_addresses to support vCard-like
    arbitrary parameters

 tests/folks/field-details.vala |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/tests/folks/field-details.vala b/tests/folks/field-details.vala
index 1bd9840..3b94573 100644
--- a/tests/folks/field-details.vala
+++ b/tests/folks/field-details.vala
@@ -28,6 +28,8 @@ public class FieldDetailsTests : Folks.TestCase
       this.add_test ("parameter replacement", this.test_param_replacement);
       this.add_test ("simple equality", this.test_simple_equality);
       this.add_test ("parameter equality", this.test_params_equality);
+      this.add_test ("ImFieldDetails equality",
+          this.test_im_field_details_equality);
     }
 
   public override void set_up ()
@@ -148,6 +150,21 @@ public class FieldDetailsTests : Folks.TestCase
       details_a_2.parameters.remove_all ("bar");
       assert (!details_a_1.equal (details_a_2));
     }
+
+  public void test_im_field_details_equality ()
+    {
+      ImFieldDetails details_a_1 = new ImFieldDetails ("foo example org");
+      ImFieldDetails details_a_2 = new ImFieldDetails ("foo example org");
+      ImFieldDetails details_b_1 = new ImFieldDetails ("bar other example org");
+
+      /* Very-basic comparisons */
+      assert (details_a_1.equal (details_a_2));
+      assert (!details_a_1.equal (details_b_1));
+
+      /* Comparing different derived classes */
+      FieldDetails details_c_1 = new FieldDetails ("foo example org");
+      assert (!details_a_1.equal (details_c_1));
+    }
 }
 
 public int main (string[] args)



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