aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/extra/bad/bad-blank-node-label.nt1
-rw-r--r--test/extra/bad/bad-trailing-garbage.nt1
-rw-r--r--test/extra/bad/manifest.ttl13
-rw-r--r--test/extra/good/manifest.ttl7
-rw-r--r--test/extra/lax/manifest.ttl7
-rw-r--r--test/extra/lax/test-out-of-range-unicode.nt (renamed from test/extra/good/test-out-of-range-unicode.nt)0
-rw-r--r--test/extra/lax/test-out-of-range-unicode.ttl (renamed from test/extra/good/test-out-of-range-unicode.ttl)0
-rw-r--r--test/test_overflow.c3
-rw-r--r--test/test_reader.c49
9 files changed, 74 insertions, 7 deletions
diff --git a/test/extra/bad/bad-blank-node-label.nt b/test/extra/bad/bad-blank-node-label.nt
new file mode 100644
index 00000000..d178a623
--- /dev/null
+++ b/test/extra/bad/bad-blank-node-label.nt
@@ -0,0 +1 @@
+<http://example.org/s> <http://example.org/p> _nocolon .
diff --git a/test/extra/bad/bad-trailing-garbage.nt b/test/extra/bad/bad-trailing-garbage.nt
new file mode 100644
index 00000000..79790812
--- /dev/null
+++ b/test/extra/bad/bad-trailing-garbage.nt
@@ -0,0 +1 @@
+<http://example.org/s> <http://example.org/p> <http://example.org/o> . <http://example.org/error>
diff --git a/test/extra/bad/manifest.ttl b/test/extra/bad/manifest.ttl
index 9dda56b2..7ab5a427 100644
--- a/test/extra/bad/manifest.ttl
+++ b/test/extra/bad/manifest.ttl
@@ -10,8 +10,10 @@
<#bad-a-subject>
<#bad-base>
<#bad-blank>
+ <#bad-blank-node-label>
<#bad-blank-predicate>
<#bad-blank-syntax>
+ <#bad-blank-syntax>
<#bad-bom>
<#bad-char-in-local>
<#bad-char-in-prefix>
@@ -78,6 +80,7 @@
<#bad-semicolon-after-subject>
<#bad-string>
<#bad-subject>
+ <#bad-trailing-garbage>
<#bad-true-predicate>
<#bad-true-subject>
<#bad-uri-escape>
@@ -107,6 +110,11 @@
mf:action <bad-blank.ttl> ;
mf:name "bad-blank" .
+<#bad-blank-node-label>
+ a rdft:TestNTriplesNegativeSyntax ;
+ mf:action <bad-blank-node-label.nt> ;
+ mf:name "bad-blank-node-label" .
+
<#bad-blank-predicate>
a rdft:TestTurtleNegativeSyntax ;
mf:action <bad-blank-predicate.ttl> ;
@@ -447,6 +455,11 @@
mf:action <bad-subject.ttl> ;
mf:name "bad-subject" .
+<#bad-trailing-garbage>
+ a rdft:TestNTriplesNegativeSyntax ;
+ mf:action <bad-trailing-garbage.nt> ;
+ mf:name "bad-trailing-garbage" .
+
<#bad-true-predicate>
a rdft:TestTurtleNegativeSyntax ;
mf:action <bad-true-predicate.ttl> ;
diff --git a/test/extra/good/manifest.ttl b/test/extra/good/manifest.ttl
index c8bfa6f8..bce7c564 100644
--- a/test/extra/good/manifest.ttl
+++ b/test/extra/good/manifest.ttl
@@ -29,7 +29,6 @@
<#test-long-utf8>
<#test-no-spaces>
<#test-non-curie-uri>
- <#test-out-of-range-unicode>
<#test-prefix>
<#test-quote-escapes>
<#test-rel>
@@ -177,12 +176,6 @@
mf:name "test-non-curie-uri" ;
mf:result <test-non-curie-uri.nt> .
-<#test-out-of-range-unicode>
- a rdft:TestTurtleEval ;
- mf:action <test-out-of-range-unicode.ttl> ;
- mf:name "test-out-of-range-unicode" ;
- mf:result <test-out-of-range-unicode.nt> .
-
<#test-prefix>
a rdft:TestTurtleEval ;
mf:action <test-prefix.ttl> ;
diff --git a/test/extra/lax/manifest.ttl b/test/extra/lax/manifest.ttl
index 5fd50f50..c68f0176 100644
--- a/test/extra/lax/manifest.ttl
+++ b/test/extra/lax/manifest.ttl
@@ -15,6 +15,7 @@
<#test-bad-utf8-nt>
<#test-bad-utf8-ttl>
<#test-lone-list>
+ <#test-out-of-range-unicode>
) .
<#test-bad-string-nt>
@@ -70,3 +71,9 @@
mf:action <test-lone-list.ttl> ;
mf:name "test-lone-list" ;
mf:result <test-lone-list.nt> .
+
+<#test-out-of-range-unicode>
+ a rdft:TestTurtleNegativeSyntax ;
+ mf:action <test-out-of-range-unicode.ttl> ;
+ mf:name "test-out-of-range-unicode" ;
+ mf:result <test-out-of-range-unicode.nt> .
diff --git a/test/extra/good/test-out-of-range-unicode.nt b/test/extra/lax/test-out-of-range-unicode.nt
index 5def9e31..5def9e31 100644
--- a/test/extra/good/test-out-of-range-unicode.nt
+++ b/test/extra/lax/test-out-of-range-unicode.nt
diff --git a/test/extra/good/test-out-of-range-unicode.ttl b/test/extra/lax/test-out-of-range-unicode.ttl
index 7e64785a..7e64785a 100644
--- a/test/extra/good/test-out-of-range-unicode.ttl
+++ b/test/extra/lax/test-out-of-range-unicode.ttl
diff --git a/test/test_overflow.c b/test/test_overflow.c
index bc0a2aaf..6e018033 100644
--- a/test/test_overflow.c
+++ b/test/test_overflow.c
@@ -59,6 +59,9 @@ test_ntriples_overflow(void)
{
static const char* const test_strings[] = {
"<http://example.org/s> <http://example.org/p> <http://example.org/o> .",
+ "<http://example.org/s> <http://example.org/p> \"literal\" .",
+ "<http://example.org/s> <http://example.org/p> _:blank .",
+ "<http://example.org/s> <http://example.org/p> \"\"@en .",
NULL,
};
diff --git a/test/test_reader.c b/test/test_reader.c
index a5595804..f33c3429 100644
--- a/test/test_reader.c
+++ b/test/test_reader.c
@@ -19,6 +19,7 @@
#endif
#include <assert.h>
+#include <stdbool.h>
#include <stdio.h>
#include <string.h>
@@ -365,6 +366,51 @@ test_read_turtle_chunks(const char* const path)
assert(!zix_remove(path));
}
+static size_t
+empty_test_read(void* buf, size_t size, size_t nmemb, void* stream)
+{
+ (void)buf;
+ (void)size;
+ (void)nmemb;
+ (void)stream;
+
+ assert(false);
+
+ return 0;
+}
+
+static int
+empty_test_error(void* stream)
+{
+ (void)stream;
+ return 0;
+}
+
+/// Test that reading SERD_SYNTAX_EMPTY "succeeds" without reading any input
+static void
+test_read_empty(void)
+{
+ SerdWorld* const world = serd_world_new();
+ ReaderTest rt = {0, 0, 0, 0};
+
+ SerdSink* const sink = serd_sink_new(&rt, test_sink, NULL);
+ assert(sink);
+
+ SerdReader* const reader = serd_reader_new(world, SERD_SYNTAX_EMPTY, 0, sink);
+ assert(reader);
+
+ SerdStatus st = serd_reader_start_stream(
+ reader, empty_test_read, empty_test_error, &rt, NULL, 1);
+ assert(st == SERD_SUCCESS);
+
+ assert(serd_reader_read_document(reader) == SERD_SUCCESS);
+ assert(rt.n_statement == 0);
+
+ serd_reader_free(reader);
+ serd_sink_free(sink);
+ serd_world_free(world);
+}
+
int
main(void)
{
@@ -379,6 +425,9 @@ main(void)
test_read_string();
test_read_eof_by_page(ttl_path);
test_read_eof_by_byte();
+ test_read_nquads_chunks(nq_path);
+ test_read_turtle_chunks(ttl_path);
+ test_read_empty();
assert(!zix_remove(dir));