[tracker] Added infrastructure for testing SPARQL parser errors
- From: Philip Van Hoof <pvanhoof src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker] Added infrastructure for testing SPARQL parser errors
- Date: Tue, 18 Aug 2009 10:50:35 +0000 (UTC)
commit 0832fc28680f188c8ca7bd80d84abd554744b101
Author: Philip Van Hoof <philip codeminded be>
Date: Tue Aug 18 12:49:54 2009 +0200
Added infrastructure for testing SPARQL parser errors
configure.ac | 1 +
tests/libtracker-data/Makefile.am | 5 +-
tests/libtracker-data/error/Makefile.am | 6 ++
tests/libtracker-data/error/query-error-1.rq | 6 ++
tests/libtracker-data/tracker-sparql-test.c | 62 +++++++++++---------
5 files changed, 50 insertions(+), 30 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ca8cd2b..69c5232 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1435,6 +1435,7 @@ AC_CONFIG_FILES([
tests/libtracker-data/optional/Makefile
tests/libtracker-data/regex/Makefile
tests/libtracker-data/sort/Makefile
+ tests/libtracker-data/error/Makefile
tests/libtracker-db/Makefile
tests/Makefile
tests/tracker-miner-fs/Makefile
diff --git a/tests/libtracker-data/Makefile.am b/tests/libtracker-data/Makefile.am
index fa46894..7cfedfe 100644
--- a/tests/libtracker-data/Makefile.am
+++ b/tests/libtracker-data/Makefile.am
@@ -7,9 +7,10 @@ SUBDIRS = \
expr-ops \
nie \
nmo \
- optional \
+ optional \
regex \
- sort
+ sort \
+ error
noinst_PROGRAMS = $(TEST_PROGS)
diff --git a/tests/libtracker-data/error/Makefile.am b/tests/libtracker-data/error/Makefile.am
new file mode 100644
index 0000000..7df40f8
--- /dev/null
+++ b/tests/libtracker-data/error/Makefile.am
@@ -0,0 +1,6 @@
+include $(top_srcdir)/Makefile.decl
+
+EXTRA_DIST = query-error-1.ontology \
+ query-error-1.out \
+ query-error-1.rq \
+ query-error-1.ttl
diff --git a/tests/libtracker-data/error/query-error-1.ontology b/tests/libtracker-data/error/query-error-1.ontology
new file mode 100644
index 0000000..e69de29
diff --git a/tests/libtracker-data/error/query-error-1.out b/tests/libtracker-data/error/query-error-1.out
new file mode 100644
index 0000000..e69de29
diff --git a/tests/libtracker-data/error/query-error-1.rq b/tests/libtracker-data/error/query-error-1.rq
new file mode 100644
index 0000000..3ac08ff
--- /dev/null
+++ b/tests/libtracker-data/error/query-error-1.rq
@@ -0,0 +1,6 @@
+PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
+
+SELECT ?val
+WHERE
+ ?val a rdfs:Resource
+}
diff --git a/tests/libtracker-data/error/query-error-1.ttl b/tests/libtracker-data/error/query-error-1.ttl
new file mode 100644
index 0000000..e69de29
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
index 48f7885..4dd9c0c 100644
--- a/tests/libtracker-data/tracker-sparql-test.c
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -37,36 +37,38 @@ typedef struct _TestInfo TestInfo;
struct _TestInfo {
const gchar *test_name;
const gchar *data;
+ const gboolean expect_error;
};
const TestInfo tests[] = {
- { "algebra/two-nested-opt", "algebra/two-nested-opt" },
- { "algebra/two-nested-opt-alt", "algebra/two-nested-opt" },
- { "algebra/opt-filter-3", "algebra/opt-filter-3" },
- { "algebra/filter-placement-1", "algebra/data-2" },
- { "algebra/filter-placement-2", "algebra/data-2" },
- { "algebra/filter-placement-3", "algebra/data-2" },
- { "algebra/filter-nested-1", "algebra/data-1" },
- { "algebra/filter-nested-2", "algebra/data-1" },
- { "algebra/filter-scope-1", "algebra/data-2" },
- { "algebra/var-scope-join-1", "algebra/var-scope-join-1" },
- { "bnode-coreference/query", "bnode-coreference/data" },
- { "bound/bound1", "bound/data" },
- { "expr-ops/query-ge-1", "expr-ops/data" },
- { "expr-ops/query-le-1", "expr-ops/data" },
- { "expr-ops/query-minus-1", "expr-ops/data" },
- { "expr-ops/query-mul-1", "expr-ops/data" },
- { "expr-ops/query-plus-1", "expr-ops/data" },
- { "expr-ops/query-unminus-1", "expr-ops/data" },
- { "expr-ops/query-unplus-1", "expr-ops/data" },
- { "optional/q-opt-complex-1", "optional/complex-data-1" },
- { "regex/regex-query-001", "regex/regex-data-01" },
- { "regex/regex-query-002", "regex/regex-data-01" },
- { "sort/query-sort-1", "sort/data-sort-1" },
- { "sort/query-sort-2", "sort/data-sort-1" },
- { "sort/query-sort-3", "sort/data-sort-3" },
- { "sort/query-sort-4", "sort/data-sort-4" },
- { "sort/query-sort-5", "sort/data-sort-4" },
+ { "algebra/two-nested-opt", "algebra/two-nested-opt", FALSE },
+ { "algebra/two-nested-opt-alt", "algebra/two-nested-opt", FALSE },
+ { "algebra/opt-filter-3", "algebra/opt-filter-3", FALSE },
+ { "algebra/filter-placement-1", "algebra/data-2", FALSE },
+ { "algebra/filter-placement-2", "algebra/data-2", FALSE },
+ { "algebra/filter-placement-3", "algebra/data-2", FALSE },
+ { "algebra/filter-nested-1", "algebra/data-1", FALSE },
+ { "algebra/filter-nested-2", "algebra/data-1", FALSE },
+ { "algebra/filter-scope-1", "algebra/data-2", FALSE },
+ { "algebra/var-scope-join-1", "algebra/var-scope-join-1", FALSE },
+ { "bnode-coreference/query", "bnode-coreference/data", FALSE },
+ { "bound/bound1", "bound/data", FALSE },
+ { "expr-ops/query-ge-1", "expr-ops/data", FALSE },
+ { "expr-ops/query-le-1", "expr-ops/data", FALSE },
+ { "expr-ops/query-minus-1", "expr-ops/data", FALSE },
+ { "expr-ops/query-mul-1", "expr-ops/data", FALSE },
+ { "expr-ops/query-plus-1", "expr-ops/data", FALSE },
+ { "expr-ops/query-unminus-1", "expr-ops/data", FALSE },
+ { "expr-ops/query-unplus-1", "expr-ops/data", FALSE },
+ { "optional/q-opt-complex-1", "optional/complex-data-1", FALSE },
+ { "regex/regex-query-001", "regex/regex-data-01", FALSE },
+ { "regex/regex-query-002", "regex/regex-data-01", FALSE },
+ { "sort/query-sort-1", "sort/data-sort-1", FALSE },
+ { "sort/query-sort-2", "sort/data-sort-1", FALSE },
+ { "sort/query-sort-3", "sort/data-sort-3", FALSE },
+ { "sort/query-sort-4", "sort/data-sort-4", FALSE },
+ { "sort/query-sort-5", "sort/data-sort-4", FALSE },
+ { "error/query-error-1", "error/data-error-1", TRUE },
{ NULL }
};
@@ -132,7 +134,11 @@ test_sparql_query (gconstpointer test_data)
/* perform actual query */
result_set = tracker_data_query_sparql (query, &error);
- g_assert (error == NULL);
+ if (test_info->expect_error) {
+ g_assert (error != NULL);
+ } else {
+ g_assert (error == NULL);
+ }
/* compare results with reference output */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]