[glib] Simplify fileattributematcher tests a bit



commit 159459bc2d44de2ed3abc50d64d42a5a9ae0dc91
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Dec 23 12:09:46 2013 -0500

    Simplify fileattributematcher tests a bit
    
    Just use assertions instead of pretty-printed error messages.

 gio/tests/fileattributematcher.c |   20 +++-----------------
 1 files changed, 3 insertions(+), 17 deletions(-)
---
diff --git a/gio/tests/fileattributematcher.c b/gio/tests/fileattributematcher.c
index 95b78ec..6956e6a 100644
--- a/gio/tests/fileattributematcher.c
+++ b/gio/tests/fileattributematcher.c
@@ -19,11 +19,7 @@ test_exact (void)
     {
       matcher = g_file_attribute_matcher_new (exact_matches[i]);
       s = g_file_attribute_matcher_to_string (matcher);
-      if (! g_str_equal (exact_matches[i], s))
-        {
-          g_test_fail ();
-          g_test_message ("matcher should be %s, but is %s", exact_matches[i], s);
-        }
+      g_assert_cmpstr (exact_matches[i], ==, s);
       g_free (s);
       g_file_attribute_matcher_unref (matcher);
     }
@@ -64,11 +60,7 @@ test_equality (void)
     {
       matcher = g_file_attribute_matcher_new (equals[i].actual);
       s = g_file_attribute_matcher_to_string (matcher);
-      if (! g_str_equal (equals[i].expected, s))
-        {
-          g_test_fail ();
-          g_test_message ("matcher for %s should be %s, but is %s", equals[i].actual, equals[i].expected, s);
-        }
+      g_assert_cmpstr (equals[i].expected, ==, s);
       g_free (s);
       g_file_attribute_matcher_unref (matcher);
     }
@@ -149,13 +141,7 @@ test_subtract (void)
       subtract = g_file_attribute_matcher_new (subtractions[i].subtract);
       result = g_file_attribute_matcher_subtract (matcher, subtract);
       s = g_file_attribute_matcher_to_string (result);
-      if (g_strcmp0 (subtractions[i].result, s))
-        {
-          g_test_fail ();
-          g_test_message ("matcher for %s - %s should be %s, but is %s", 
-                          subtractions[i].attributes, subtractions[i].subtract,
-                          subtractions[i].result, s);
-        }
+      g_assert_cmpstr (subtractions[i].result, ==, s);
       g_free (s);
       g_file_attribute_matcher_unref (matcher);
       g_file_attribute_matcher_unref (subtract);


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