[tracker/wip/carlosg/sqlite-3-35-workaround: 2/2] tests: Add test for OPTIONAL inside GRAPH ?g {}




commit 26bc4c9bba4ccde9d0da085b65cde1c8d97f7edc
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Mar 21 17:55:22 2021 +0100

    tests: Add test for OPTIONAL inside GRAPH ?g {}
    
    This broke in recent SQLite releases, and only caught by one
    tracker-miners test. Make it sure we have a test here for this.

 tests/libtracker-data/graph/graph-7.out     | 2 ++
 tests/libtracker-data/graph/graph-7.rq      | 7 +++++++
 tests/libtracker-data/tracker-sparql-test.c | 1 +
 3 files changed, 10 insertions(+)
---
diff --git a/tests/libtracker-data/graph/graph-7.out b/tests/libtracker-data/graph/graph-7.out
new file mode 100644
index 000000000..b87869c39
--- /dev/null
+++ b/tests/libtracker-data/graph/graph-7.out
@@ -0,0 +1,2 @@
+"http://example/graphA";        "http://example/resource";       "73"
+"http://example/graphB";        "http://example/resource";       "42"
diff --git a/tests/libtracker-data/graph/graph-7.rq b/tests/libtracker-data/graph/graph-7.rq
new file mode 100644
index 000000000..a72b4366e
--- /dev/null
+++ b/tests/libtracker-data/graph/graph-7.rq
@@ -0,0 +1,7 @@
+SELECT ?g ?s ?v WHERE {
+       GRAPH ?g {
+                ?s a rdfs:Resource .
+               OPTIONAL { ?s example:p ?v } .
+       }
+}
+ORDER BY ?g ?s ?v
\ No newline at end of file
diff --git a/tests/libtracker-data/tracker-sparql-test.c b/tests/libtracker-data/tracker-sparql-test.c
index 9552d0aa4..60475720b 100644
--- a/tests/libtracker-data/tracker-sparql-test.c
+++ b/tests/libtracker-data/tracker-sparql-test.c
@@ -162,6 +162,7 @@ const TestInfo tests[] = {
        { "graph/graph-4", "graph/data-3", FALSE },
        { "graph/graph-5", "graph/data-4", FALSE },
        { "graph/graph-6", "graph/data-5", FALSE },
+       { "graph/graph-7", "graph/data-5", FALSE },
        { "graph/non-existent-1",  "graph/data-1", FALSE },
        { "graph/non-existent-2",  "graph/data-1", FALSE },
        { "graph/non-existent-3",  "graph/data-1", FALSE },


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