aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/extra/bad/bad-var.ttl2
-rw-r--r--test/extra/bad/manifest.ttl6
-rw-r--r--test/extra/pattern/bad-pattern-graph.nq1
-rw-r--r--test/extra/pattern/bad-pattern-object.nq1
-rw-r--r--test/extra/pattern/bad-pattern-object.nt1
-rw-r--r--test/extra/pattern/bad-pattern-object.ttl2
-rw-r--r--test/extra/pattern/bad-pattern-predicate.nq1
-rw-r--r--test/extra/pattern/bad-pattern-predicate.nt1
-rw-r--r--test/extra/pattern/bad-pattern-predicate.ttl2
-rw-r--r--test/extra/pattern/bad-pattern-subject.nq1
-rw-r--r--test/extra/pattern/bad-pattern-subject.nt1
-rw-r--r--test/extra/pattern/bad-pattern-subject.ttl2
-rw-r--r--test/extra/pattern/manifest.ttl88
-rw-r--r--test/extra/pattern/test-graph-pattern.nq1
-rw-r--r--test/extra/pattern/test-pattern.nt6
-rw-r--r--test/extra/pattern/test-pattern.ttl10
-rw-r--r--test/meson.build7
-rw-r--r--test/test_overflow.c27
18 files changed, 148 insertions, 12 deletions
diff --git a/test/extra/bad/bad-var.ttl b/test/extra/bad/bad-var.ttl
new file mode 100644
index 00000000..29b5b008
--- /dev/null
+++ b/test/extra/bad/bad-var.ttl
@@ -0,0 +1,2 @@
+?s
+ <http://example.org/p> <http://example.org/o> .
diff --git a/test/extra/bad/manifest.ttl b/test/extra/bad/manifest.ttl
index 7ab5a427..cd4aee24 100644
--- a/test/extra/bad/manifest.ttl
+++ b/test/extra/bad/manifest.ttl
@@ -87,6 +87,7 @@
<#bad-uri-scheme>
<#bad-uri-scheme-start>
<#bad-uri-truncated>
+ <#bad-var>
<#bad-verb>
) .
@@ -490,6 +491,11 @@
mf:action <bad-uri-truncated.nt> ;
mf:name "bad-uri-truncated" .
+<#bad-var>
+ a rdft:TestTurtleNegativeSyntax ;
+ mf:action <bad-var.ttl> ;
+ mf:name "bad-var" .
+
<#bad-verb>
a rdft:TestTurtleNegativeSyntax ;
mf:action <bad-verb.ttl> ;
diff --git a/test/extra/pattern/bad-pattern-graph.nq b/test/extra/pattern/bad-pattern-graph.nq
new file mode 100644
index 00000000..9c77ac9a
--- /dev/null
+++ b/test/extra/pattern/bad-pattern-graph.nq
@@ -0,0 +1 @@
+<http://example.org/s> <http://example.org/p> <http://example.org/o> ?gµ .
diff --git a/test/extra/pattern/bad-pattern-object.nq b/test/extra/pattern/bad-pattern-object.nq
new file mode 100644
index 00000000..7f22b520
--- /dev/null
+++ b/test/extra/pattern/bad-pattern-object.nq
@@ -0,0 +1 @@
+<http://example.org/s> <http://example.org/p> ?oµ <http://example.org/g> .
diff --git a/test/extra/pattern/bad-pattern-object.nt b/test/extra/pattern/bad-pattern-object.nt
new file mode 100644
index 00000000..aef057e4
--- /dev/null
+++ b/test/extra/pattern/bad-pattern-object.nt
@@ -0,0 +1 @@
+<http://example.org/s> <http://example.org/p> ?oµ .
diff --git a/test/extra/pattern/bad-pattern-object.ttl b/test/extra/pattern/bad-pattern-object.ttl
new file mode 100644
index 00000000..cc2eee77
--- /dev/null
+++ b/test/extra/pattern/bad-pattern-object.ttl
@@ -0,0 +1,2 @@
+<http://example.org/s>
+ <http://example.org/o> ?oµ .
diff --git a/test/extra/pattern/bad-pattern-predicate.nq b/test/extra/pattern/bad-pattern-predicate.nq
new file mode 100644
index 00000000..cfe466c9
--- /dev/null
+++ b/test/extra/pattern/bad-pattern-predicate.nq
@@ -0,0 +1 @@
+<http://example.org/s> ?pµ <http://example.org/o> <http://example.org/g> .
diff --git a/test/extra/pattern/bad-pattern-predicate.nt b/test/extra/pattern/bad-pattern-predicate.nt
new file mode 100644
index 00000000..a7e0c994
--- /dev/null
+++ b/test/extra/pattern/bad-pattern-predicate.nt
@@ -0,0 +1 @@
+<http://example.org/s> ?pµ <http://example.org/o> .
diff --git a/test/extra/pattern/bad-pattern-predicate.ttl b/test/extra/pattern/bad-pattern-predicate.ttl
new file mode 100644
index 00000000..cc2bd6b1
--- /dev/null
+++ b/test/extra/pattern/bad-pattern-predicate.ttl
@@ -0,0 +1,2 @@
+<http://example.org/s>
+ ?pµ <http://example.org/o> .
diff --git a/test/extra/pattern/bad-pattern-subject.nq b/test/extra/pattern/bad-pattern-subject.nq
new file mode 100644
index 00000000..341c437f
--- /dev/null
+++ b/test/extra/pattern/bad-pattern-subject.nq
@@ -0,0 +1 @@
+?sµ <http://example.org/p> <http://example.org/o> <http://example.org/g> .
diff --git a/test/extra/pattern/bad-pattern-subject.nt b/test/extra/pattern/bad-pattern-subject.nt
new file mode 100644
index 00000000..5bbb29ff
--- /dev/null
+++ b/test/extra/pattern/bad-pattern-subject.nt
@@ -0,0 +1 @@
+?sµ <http://example.org/p> <http://example.org/o> .
diff --git a/test/extra/pattern/bad-pattern-subject.ttl b/test/extra/pattern/bad-pattern-subject.ttl
new file mode 100644
index 00000000..5f3dbfdd
--- /dev/null
+++ b/test/extra/pattern/bad-pattern-subject.ttl
@@ -0,0 +1,2 @@
+?sµ
+ <http://example.org/p> <http://example.org/o> .
diff --git a/test/extra/pattern/manifest.ttl b/test/extra/pattern/manifest.ttl
new file mode 100644
index 00000000..e5690218
--- /dev/null
+++ b/test/extra/pattern/manifest.ttl
@@ -0,0 +1,88 @@
+@prefix mf: <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix rdft: <http://www.w3.org/ns/rdftest#> .
+
+<>
+ a mf:Manifest ;
+ rdfs:comment "Serd pattern syntax test suite" ;
+ mf:entries (
+ <#bad-pattern-graph-nq>
+ <#bad-pattern-object-nq>
+ <#bad-pattern-object-nt>
+ <#bad-pattern-object-ttl>
+ <#bad-pattern-predicate-nq>
+ <#bad-pattern-predicate-nt>
+ <#bad-pattern-predicate-ttl>
+ <#bad-pattern-subject-nq>
+ <#bad-pattern-subject-nt>
+ <#bad-pattern-subject-ttl>
+ <#test-graph-pattern>
+ <#test-pattern-nt>
+ <#test-pattern-ttl>
+ ) .
+
+<#bad-pattern-graph-nq>
+ a rdft:TestNQuadsNegativeSyntax ;
+ mf:action <bad-pattern-graph.nq> ;
+ mf:name "bad-pattern-graph-nq" .
+
+<#bad-pattern-object-nq>
+ a rdft:TestNQuadsNegativeSyntax ;
+ mf:action <bad-pattern-object.nq> ;
+ mf:name "bad-pattern-object-nq" .
+
+<#bad-pattern-object-nt>
+ a rdft:TestNTriplesNegativeSyntax ;
+ mf:action <bad-pattern-object.nt> ;
+ mf:name "bad-pattern-object-nt" .
+
+<#bad-pattern-object-ttl>
+ a rdft:TestTurtleNegativeSyntax ;
+ mf:action <bad-pattern-object.ttl> ;
+ mf:name "bad-pattern-object-ttl" .
+
+<#bad-pattern-predicate-nq>
+ a rdft:TestNQuadsNegativeSyntax ;
+ mf:action <bad-pattern-predicate.nq> ;
+ mf:name "bad-pattern-predicate-nq" .
+
+<#bad-pattern-predicate-nt>
+ a rdft:TestNTriplesNegativeSyntax ;
+ mf:action <bad-pattern-predicate.nt> ;
+ mf:name "bad-pattern-predicate-nt" .
+
+<#bad-pattern-predicate-ttl>
+ a rdft:TestTurtleNegativeSyntax ;
+ mf:action <bad-pattern-predicate.ttl> ;
+ mf:name "bad-pattern-predicate-ttl" .
+
+<#bad-pattern-subject-nq>
+ a rdft:TestNQuadsNegativeSyntax ;
+ mf:action <bad-pattern-subject.nq> ;
+ mf:name "bad-pattern-subject-nq" .
+
+<#bad-pattern-subject-nt>
+ a rdft:TestNTriplesNegativeSyntax ;
+ mf:action <bad-pattern-subject.nt> ;
+ mf:name "bad-pattern-subject-nt" .
+
+<#bad-pattern-subject-ttl>
+ a rdft:TestTurtleNegativeSyntax ;
+ mf:action <bad-pattern-subject.ttl> ;
+ mf:name "bad-pattern-subject-ttl" .
+
+<#test-graph-pattern>
+ a rdft:TestNQuadsPositiveSyntax ;
+ mf:action <test-graph-pattern.nq> ;
+ mf:name "test-graph-pattern" .
+
+<#test-pattern-nt>
+ a rdft:TestNTriplesPositiveSyntax ;
+ mf:action <test-pattern.nt> ;
+ mf:name "test-pattern-nt" .
+
+<#test-pattern-ttl>
+ a rdft:TestTurtleEval ;
+ mf:action <test-pattern.ttl> ;
+ mf:name "test-pattern" ;
+ mf:result <test-pattern.nt> .
diff --git a/test/extra/pattern/test-graph-pattern.nq b/test/extra/pattern/test-graph-pattern.nq
new file mode 100644
index 00000000..453e9516
--- /dev/null
+++ b/test/extra/pattern/test-graph-pattern.nq
@@ -0,0 +1 @@
+<http://a.example/s> <http://a.example/p> <http://a.example/o> ?g .
diff --git a/test/extra/pattern/test-pattern.nt b/test/extra/pattern/test-pattern.nt
new file mode 100644
index 00000000..ddfe6d3c
--- /dev/null
+++ b/test/extra/pattern/test-pattern.nt
@@ -0,0 +1,6 @@
+?s <http://example.org/p1> <http://example.org/o1> .
+<http://example.org/s> ?p <http://example.org/o1> .
+<http://example.org/s> <http://example.org/p1> ?o .
+<http://example.org/s> <http://example.org/p2> _:b1 .
+_:b1 ?2p <http://example.org/o2> .
+_:b1 <http://example.org/p3> ?_o .
diff --git a/test/extra/pattern/test-pattern.ttl b/test/extra/pattern/test-pattern.ttl
new file mode 100644
index 00000000..3742e5ed
--- /dev/null
+++ b/test/extra/pattern/test-pattern.ttl
@@ -0,0 +1,10 @@
+?s
+ <http://example.org/p1> <http://example.org/o1> .
+
+<http://example.org/s>
+ ?p <http://example.org/o1> ;
+ <http://example.org/p1> ?o ;
+ <http://example.org/p2> [
+ ?2p <http://example.org/o2> ;
+ <http://example.org/p3> ?_o
+ ] .
diff --git a/test/meson.build b/test/meson.build
index e6b0fe5c..a2436b22 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -32,6 +32,7 @@ ttl_metadata_file_paths = [
'extra/full/manifest.ttl',
'extra/good/manifest.ttl',
'extra/lax/manifest.ttl',
+ 'extra/pattern/manifest.ttl',
'extra/perfect/manifest.ttl',
'extra/prefix/manifest.ttl',
'extra/pretty/manifest.ttl',
@@ -430,6 +431,12 @@ test_suites = {
files('extra/lax/manifest.ttl'),
ns_serdtest + 'lax/',
],
+ 'pattern': [
+ files('extra/pattern/manifest.ttl'),
+ ns_serdtest + 'pattern/',
+ '--',
+ '-x',
+ ],
'perfect_forward': [
files('extra/perfect/manifest.ttl'),
ns_serdtest + 'perfect/',
diff --git a/test/test_overflow.c b/test/test_overflow.c
index 086d353b..b81d4367 100644
--- a/test/test_overflow.c
+++ b/test/test_overflow.c
@@ -12,17 +12,18 @@ static const size_t min_stack_size = 4U * sizeof(size_t) + 240U;
static const size_t max_stack_size = 1024U;
static SerdStatus
-test_size(SerdWorld* const world,
- const char* const str,
- const SerdSyntax syntax,
- const size_t stack_size)
+test_size(SerdWorld* const world,
+ const char* const str,
+ const SerdSyntax syntax,
+ const SerdReaderFlags flags,
+ const size_t stack_size)
{
SerdLimits limits = serd_world_limits(world);
limits.reader_stack_size = stack_size;
serd_world_set_limits(world, limits);
SerdSink* sink = serd_sink_new(NULL, NULL, NULL);
- SerdReader* const reader = serd_reader_new(world, syntax, 0U, sink);
+ SerdReader* const reader = serd_reader_new(world, syntax, flags, sink);
if (!reader) {
return SERD_BAD_STACK;
}
@@ -43,17 +44,18 @@ test_size(SerdWorld* const world,
}
static void
-test_all_sizes(SerdWorld* const world,
- const char* const str,
- const SerdSyntax syntax)
+test_all_sizes(SerdWorld* const world,
+ const char* const str,
+ const SerdSyntax syntax,
+ const SerdReaderFlags flags)
{
// Ensure reading with the maximum stack size succeeds
- SerdStatus st = test_size(world, str, syntax, max_stack_size);
+ SerdStatus st = test_size(world, str, syntax, flags, max_stack_size);
assert(!st);
// Test with an increasingly smaller stack
for (size_t size = max_stack_size; size > min_stack_size; --size) {
- if ((st = test_size(world, str, syntax, size))) {
+ if ((st = test_size(world, str, syntax, flags, size))) {
assert(st == SERD_BAD_STACK);
}
}
@@ -75,7 +77,7 @@ test_ntriples_overflow(void)
SerdWorld* const world = serd_world_new();
for (const char* const* t = test_strings; *t; ++t) {
- test_all_sizes(world, *t, SERD_NTRIPLES);
+ test_all_sizes(world, *t, SERD_NTRIPLES, 0U);
}
serd_world_free(world);
@@ -97,6 +99,7 @@ test_turtle_overflow(void)
"<http://example.org/s> <http://example.org/p> _:blank .",
"<http://example.org/s> <http://example.org/p> true .",
"<http://example.org/s> <http://example.org/p> \"\"@en .",
+ "?subject ?predicate ?object .",
"(((((((((42))))))))) <http://example.org/p> <http://example.org/o> .",
"@prefix eg: <http://example.org/ns/test> .",
"@base <http://example.org/base> .",
@@ -164,7 +167,7 @@ test_turtle_overflow(void)
SerdWorld* const world = serd_world_new();
for (const char* const* t = test_strings; *t; ++t) {
- test_all_sizes(world, *t, SERD_TURTLE);
+ test_all_sizes(world, *t, SERD_TURTLE, SERD_READ_VARIABLES);
}
serd_world_free(world);