[tracker/gdbus-evolution: 18/28] functional-tests: Simplify error handling in update tests
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/gdbus-evolution: 18/28] functional-tests: Simplify error handling in update tests
- Date: Thu, 28 Oct 2010 08:30:41 +0000 (UTC)
commit 602b8987b3171870eedfd00e4d1a5d121b13a984
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/bus-update-test.vala | 9 ++++-
tests/functional-tests/default-update-test.vala | 18 +++++-----
tests/functional-tests/shared-update-test.vala | 40 ++++++----------------
3 files changed, 27 insertions(+), 40 deletions(-)
---
diff --git a/tests/functional-tests/bus-update-test.vala b/tests/functional-tests/bus-update-test.vala
index 1867fed..d8a198e 100644
--- a/tests/functional-tests/bus-update-test.vala
+++ b/tests/functional-tests/bus-update-test.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/default-update-test.vala b/tests/functional-tests/default-update-test.vala
index c7fd137..20feffa 100644
--- a/tests/functional-tests/default-update-test.vala
+++ b/tests/functional-tests/default-update-test.vala
@@ -11,7 +11,11 @@ private void test_async () {
print ("Getting connection async\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 ();
@@ -23,10 +27,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");
@@ -47,10 +49,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/shared-update-test.vala b/tests/functional-tests/shared-update-test.vala
index f251e97..406ae43 100644
--- a/tests/functional-tests/shared-update-test.vala
+++ b/tests/functional-tests/shared-update-test.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]