aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-09-30 12:11:39 +0200
committerDavid Robillard <d@drobilla.net>2020-10-27 13:13:59 +0100
commit2f41f6609a4b0f9d7b0cdac83950d04a2ba6986b (patch)
tree968f238e92909cabb7e4d393ee027824ee87fb9f
parente474fe8922faa875b7e8695a2f7a87d36799eacc (diff)
downloadserd-2f41f6609a4b0f9d7b0cdac83950d04a2ba6986b.tar.gz
serd-2f41f6609a4b0f9d7b0cdac83950d04a2ba6986b.tar.bz2
serd-2f41f6609a4b0f9d7b0cdac83950d04a2ba6986b.zip
WIP: Test reading string EOF as chunk
-rw-r--r--tests/serd_test.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/serd_test.c b/tests/serd_test.c
index 2acf24b0..434c2ffa 100644
--- a/tests/serd_test.c
+++ b/tests/serd_test.c
@@ -225,11 +225,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_byte_source_free(byte_source);
serd_sink_free(sink);