aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-09-30 12:11:39 +0200
committerDavid Robillard <d@drobilla.net>2021-03-08 23:36:10 -0500
commitf7c7115e0555f25e0f2c6d09378b66aec2d41d76 (patch)
tree5ed1055e1cc5211959e6359d3fa62fc6d30267c4
parent1fd33e0a85bdf6bcc4f8138940462c4a4a391175 (diff)
downloadserd-f7c7115e0555f25e0f2c6d09378b66aec2d41d76.tar.gz
serd-f7c7115e0555f25e0f2c6d09378b66aec2d41d76.tar.bz2
serd-f7c7115e0555f25e0f2c6d09378b66aec2d41d76.zip
WIP: Test reading string EOF as chunk
-rw-r--r--test/test_reader_writer.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/test/test_reader_writer.c b/test/test_reader_writer.c
index 58ea1944..ac9d8fc2 100644
--- a/test/test_reader_writer.c
+++ b/test/test_reader_writer.c
@@ -211,11 +211,24 @@ test_read_string(void)
// Test reading a string that ends exactly at the end of input (no newline)
assert(!serd_reader_start(reader, byte_source));
-
assert(!serd_reader_read_document(reader));
assert(n_statements == 1);
assert(!serd_reader_finish(reader));
+ // Test reading the same but as a chunk
+ serd_byte_source_free(byte_source);
+ n_statements = 0;
+ byte_source =
+ serd_byte_source_new_string("<http://example.org/s> <http://example.org/p> "
+ "<http://example.org/o> , _:blank .",
+ NULL);
+
+ assert(!serd_reader_start(reader, byte_source));
+ assert(!serd_reader_read_chunk(reader));
+ assert(n_statements == 2);
+ assert(serd_reader_read_chunk(reader) == SERD_FAILURE);
+ assert(!serd_reader_finish(reader));
+
serd_reader_free(reader);
serd_env_free(env);
serd_byte_source_free(byte_source);