[tracker/wip/carlosg/sparql-fixes: 6/6] tests: Add tests for property paths used from several graphs




commit dce9bc257098d554502d41a5f4f90451d821e86b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Aug 27 14:22:55 2020 +0200

    tests: Add tests for property paths used from several graphs
    
    These should resolve to different subqueries and not get confused with
    what the right graph is.

 tests/libtracker-data/property-paths/data-3.rq        | 15 +++++++++++++++
 tests/libtracker-data/property-paths/mixed-graphs.out |  1 +
 tests/libtracker-data/property-paths/mixed-graphs.rq  |  9 +++++++++
 tests/libtracker-data/tracker-sparql-test.c           |  1 +
 4 files changed, 26 insertions(+)
---
diff --git a/tests/libtracker-data/property-paths/data-3.rq b/tests/libtracker-data/property-paths/data-3.rq
new file mode 100644
index 000000000..87da24ec1
--- /dev/null
+++ b/tests/libtracker-data/property-paths/data-3.rq
@@ -0,0 +1,15 @@
+INSERT {
+  GRAPH <A> {
+    _:a a foaf:Person ;
+        foaf:name "a" ;
+        foaf:knows _:b .
+    _:b a foaf:Person ;
+        foaf:name "A_b" .
+  }
+  GRAPH <B> {
+    _:a a foaf:Person;
+        foaf:knows _:c .
+    _:c a foaf:Person ;
+        foaf:name "B_c" .
+  }
+}
diff --git a/tests/libtracker-data/property-paths/mixed-graphs.out 
b/tests/libtracker-data/property-paths/mixed-graphs.out
new file mode 100644
index 000000000..ec7394e44
--- /dev/null
+++ b/tests/libtracker-data/property-paths/mixed-graphs.out
@@ -0,0 +1 @@
+"a"    "A_b"   "B_c"
diff --git a/tests/libtracker-data/property-paths/mixed-graphs.rq 
b/tests/libtracker-data/property-paths/mixed-graphs.rq
new file mode 100644
index 000000000..4c7bb155e
--- /dev/null
+++ b/tests/libtracker-data/property-paths/mixed-graphs.rq
@@ -0,0 +1,9 @@
+SELECT ?a ?n1 ?n2 {
+  GRAPH <A> {
+    ?u foaf:name ?a ;
+       foaf:knows/foaf:name ?n1
+  }
+  GRAPH <B> {
+    ?u foaf:knows/foaf:name ?n2
+  }
+}
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
index b7df4b1e9..ff20def91 100644
--- a/tests/libtracker-data/tracker-sparql-test.c
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -247,6 +247,7 @@ const TestInfo tests[] = {
        { "property-paths/mixed-recursive-and-inverse-3", "property-paths/data", FALSE },
        { "property-paths/mixed-optional-and-sequence-1", "property-paths/data-2", FALSE },
        { "property-paths/mixed-optional-and-sequence-2", "property-paths/data-2", FALSE },
+       { "property-paths/mixed-graphs", "property-paths/data-3", FALSE },
        /* Update tests */
        { "update/insert-data-query-1", "update/insert-data-1", FALSE, FALSE },
        { "update/insert-data-query-2", "update/insert-data-2", FALSE, TRUE },


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