[gnome-keyring/gnome-3-0] gcr: In test-parser don't try to parse directories.



commit eb11123302e70c1b81a346db0b713d9ec0c99929
Author: Stef Walter <stefw collabora co uk>
Date:   Tue Apr 19 09:18:34 2011 +0200

    gcr: In test-parser don't try to parse directories.

 gcr/tests/test-parser.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/gcr/tests/test-parser.c b/gcr/tests/test-parser.c
index e23b2a8..7bde12a 100644
--- a/gcr/tests/test-parser.c
+++ b/gcr/tests/test-parser.c
@@ -106,6 +106,7 @@ static void
 teardown (Test *test, gconstpointer unused)
 {
 	g_object_unref (test->parser);
+	g_free (test->filedesc);
 }
 
 static void
@@ -128,7 +129,12 @@ test_parse_all (Test *test, gconstpointer unused)
 		if (filename[0] == '.')
 			continue;
 
+		g_free (test->filedesc);
 		test->filedesc = g_build_filename ("files", filename, NULL);
+
+		if (g_file_test (test->filedesc, G_FILE_TEST_IS_DIR))
+			continue;
+
 		if (!g_file_get_contents (test->filedesc, &contents, &len, NULL))
 			g_assert_not_reached ();
 
@@ -141,9 +147,6 @@ test_parse_all (Test *test, gconstpointer unused)
 			g_error_free (err);
 			g_assert_not_reached ();
 		}
-
-		g_free (test->filedesc);
-		test->filedesc = NULL;
 	}
 
 	g_dir_close (dir);



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