[tracker/direct-access: 34/40] tests/functional-tests: Refactored the tests a bit more



commit 08598885683a86a0627f068802c814994a6bfd80
Author: Philip Van Hoof <philip codeminded be>
Date:   Thu Jul 22 12:42:11 2010 +0200

    tests/functional-tests: Refactored the tests a bit more

 tests/functional-tests/Makefile.am              |    4 +-
 tests/functional-tests/default-update-test.vala |    4 +-
 tests/functional-tests/direct-query-test.vala   |   46 +----------------------
 3 files changed, 5 insertions(+), 49 deletions(-)
---
diff --git a/tests/functional-tests/Makefile.am b/tests/functional-tests/Makefile.am
index 724c4a2..67a635e 100644
--- a/tests/functional-tests/Makefile.am
+++ b/tests/functional-tests/Makefile.am
@@ -71,7 +71,7 @@ busy_handling_test_LDADD = \
 	$(GLIB2_LIBS) \
 	$(DBUS_LIBS)
 
-direct_query_test_VALASOURCES = direct-query-test.vala
+direct_query_test_VALASOURCES = shared-query-test.vala direct-query-test.vala
 
 bus_query_test_VALASOURCES = shared-query-test.vala bus-query-test.vala
 
@@ -117,7 +117,7 @@ default_update_test_SOURCES = \
 	default_update_test.vala.stamp \
 	$(default_update_test_VALASOURCES:.vala=.c)
 
-bus_query_test_VALASOURCES = bus-query-test.vala
+bus_query_test_VALASOURCES = shared-query-test.vala bus-query-test.vala
 
 bus_query_test_SOURCES = \
 	bus_query_test.vala.stamp \
diff --git a/tests/functional-tests/default-update-test.vala b/tests/functional-tests/default-update-test.vala
index 4dacd6e..54914f1 100644
--- a/tests/functional-tests/default-update-test.vala
+++ b/tests/functional-tests/default-update-test.vala
@@ -3,7 +3,5 @@ main( string[] args )
 {
 	TestApp app = new TestApp (Tracker.Sparql.Connection.get());
 
-	app.run ();
-
-	return 0;
+	return app.run ();
 }
diff --git a/tests/functional-tests/direct-query-test.vala b/tests/functional-tests/direct-query-test.vala
index f1ec29e..231d047 100644
--- a/tests/functional-tests/direct-query-test.vala
+++ b/tests/functional-tests/direct-query-test.vala
@@ -1,52 +1,10 @@
 using Tracker;
 using Tracker.Sparql;
 
-private int iter_cursor (Cursor cursor)
-{
-	try {
-		while (cursor.next()) {
-			int i;
-
-			for (i = 0; i < cursor.n_columns; i++) {
-				print ("%s%s", i != 0 ? ",":"", cursor.get_string (i));
-			}
-
-			print ("\n");
-		}
-	} catch (GLib.Error e) {
-		warning ("Couldn't iterate query results: %s", e.message);
-		return -1;
-	}
-
-	return (0);
-}
-
 int
 main( string[] args )
 {
-	Sparql.Connection con = new Tracker.Direct.Connection ();
-	Cursor cursor;
-	int a;
-
-	try {
-		cursor = con.query ("SELECT ?u WHERE { ?u a rdfs:Class }");
-	} catch (GLib.Error e) {
-		warning ("Couldn't perform query: %s", e.message);
-		return -1;
-	}
+	TestApp app = new TestApp (new  Tracker.Direct.Connection ());
 
-	a = iter_cursor (cursor);
-
-	if (a == -1)
-		return a;
-
-	print ("\nRewinding\n");
-	cursor.rewind ();
-
-	print ("\nSecond run\n");
-	a = iter_cursor (cursor);
-
-
-	return a;
+	return app.run ();
 }
-



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