[tracker/rss-enclosures] functional-tests: Simplify error handling in update tests
- From: Roberto Guido <rguido src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/rss-enclosures] functional-tests: Simplify error handling in update tests
- Date: Wed, 24 Nov 2010 02:27:34 +0000 (UTC)
commit 2fc473e8eaee7a316993e5592bd5227c703fd466
Author: Jürg Billeter <j bitron ch>
Date: Mon Oct 25 14:24:32 2010 +0200
functional-tests: Simplify error handling in update tests
tests/functional-tests/ipc/test-bus-update.vala | 9 +++-
tests/functional-tests/ipc/test-direct-query.vala | 18 ++++----
tests/functional-tests/ipc/test-shared-update.vala | 40 +++++--------------
3 files changed, 27 insertions(+), 40 deletions(-)
---
diff --git a/tests/functional-tests/ipc/test-bus-update.vala b/tests/functional-tests/ipc/test-bus-update.vala
index 1867fed..d8a198e 100644
--- a/tests/functional-tests/ipc/test-bus-update.vala
+++ b/tests/functional-tests/ipc/test-bus-update.vala
@@ -4,7 +4,12 @@ using Tracker.Sparql;
int
main( string[] args )
{
- TestApp app = new TestApp (new Tracker.Bus.Connection ());
+ try {
+ TestApp app = new TestApp (new Tracker.Bus.Connection ());
- return app.run ();
+ return app.run ();
+ } catch (GLib.Error e) {
+ warning ("Couldn't perform test: %s", e.message);
+ return 1;
+ }
}
diff --git a/tests/functional-tests/ipc/test-direct-query.vala b/tests/functional-tests/ipc/test-direct-query.vala
index 4c87cf7..ddf7048 100644
--- a/tests/functional-tests/ipc/test-direct-query.vala
+++ b/tests/functional-tests/ipc/test-direct-query.vala
@@ -12,7 +12,11 @@ private void test_async () {
print ("Getting connection asynchronously\n");
loop = new MainLoop (null, false);
Connection.get_async.begin (null, (o, res) => {
- c = Connection.get_async.end (res);
+ try {
+ c = Connection.get_async.end (res);
+ } catch (GLib.Error e) {
+ warning ("Couldn't perform test: %s", e.message);
+ }
loop.quit ();
});
loop.run ();
@@ -24,10 +28,8 @@ private void test_async () {
print ("Running app\n");
res = app.run();
- } catch (GLib.IOError e1) {
- warning ("Couldn't perform test: %s", e1.message);
- } catch (Tracker.Sparql.Error e2) {
- warning ("Couldn't perform test: %s", e2.message);
+ } catch (GLib.Error e) {
+ warning ("Couldn't perform test: %s", e.message);
}
print ("\n");
@@ -48,10 +50,8 @@ private void test_sync () {
print ("Running app\n");
res = app.run();
- } catch (GLib.IOError e1) {
- warning ("Couldn't perform test: %s", e1.message);
- } catch (Tracker.Sparql.Error e2) {
- warning ("Couldn't perform test: %s", e2.message);
+ } catch (GLib.Error e) {
+ warning ("Couldn't perform test: %s", e.message);
}
print ("\n");
diff --git a/tests/functional-tests/ipc/test-shared-update.vala b/tests/functional-tests/ipc/test-shared-update.vala
index f251e97..406ae43 100644
--- a/tests/functional-tests/ipc/test-shared-update.vala
+++ b/tests/functional-tests/ipc/test-shared-update.vala
@@ -44,22 +44,16 @@ public class TestApp : GLib.Object {
try {
con.update ("INSERT { <test01> a nie:InformationElement ; nie:title 'test01' }");
- } catch (Tracker.Sparql.Error ea) {
- warning ("Couldn't update: %s", ea.message);
- res = -1;
- } catch (IOError eb) {
- warning ("Couldn't update: %s", eb.message);
+ } catch (GLib.Error e) {
+ warning ("Couldn't update: %s", e.message);
res = -1;
}
try {
cursor = con.query ("SELECT ?title WHERE { <test01> nie:title ?title }");
a = iter_cursor (cursor);
- } catch (Tracker.Sparql.Error ec) {
- warning ("Couldn't query: %s", ec.message);
- res = -1;
- } catch (IOError ed) {
- warning ("Couldn't update: %s", ed.message);
+ } catch (GLib.Error e) {
+ warning ("Couldn't query: %s", e.message);
res = -1;
}
}
@@ -70,22 +64,16 @@ public class TestApp : GLib.Object {
try {
yield con.update_async ("INSERT { <test02> a nie:InformationElement ; nie:title 'test01' }");
- } catch (Tracker.Sparql.Error ea) {
+ } catch (GLib.Error ea) {
warning ("Couldn't update: %s", ea.message);
res = -1;
- } catch (IOError eb) {
- warning ("Couldn't update: %s", eb.message);
- res = -1;
}
try {
cursor = con.query ("SELECT ?title WHERE { <test02> nie:title ?title }");
a = iter_cursor (cursor);
- } catch (Tracker.Sparql.Error ec) {
- warning ("Couldn't query: %s", ec.message);
- res = -1;
- } catch (IOError ed) {
- warning ("Couldn't update: %s", ed.message);
+ } catch (GLib.Error eb) {
+ warning ("Couldn't query: %s", eb.message);
res = -1;
}
}
@@ -97,11 +85,8 @@ public class TestApp : GLib.Object {
try {
variant = con.update_blank ("INSERT { _:a1 a nie:InformationElement . _:b1 a nie:InformationElement . _:c1 a nie:InformationElement }");
a = iter_variant (variant);
- } catch (Tracker.Sparql.Error ea) {
- warning ("Couldn't update: %s", ea.message);
- res = -1;
- } catch (IOError eb) {
- warning ("Couldn't update: %s", eb.message);
+ } catch (GLib.Error e) {
+ warning ("Couldn't update: %s", e.message);
res = -1;
}
}
@@ -113,11 +98,8 @@ public class TestApp : GLib.Object {
try {
variant = yield con.update_blank_async ("INSERT { _:a2 a nie:InformationElement . _:b2 a nie:InformationElement . _:c2 a nie:InformationElement }");
a = iter_variant (variant);
- } catch (Tracker.Sparql.Error ea) {
- warning ("Couldn't update: %s", ea.message);
- res = -1;
- } catch (IOError eb) {
- warning ("Couldn't update: %s", eb.message);
+ } catch (GLib.Error e) {
+ warning ("Couldn't update: %s", e.message);
res = -1;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]