diff options
author | David Robillard <d@drobilla.net> | 2020-09-30 10:53:19 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-10-27 13:13:58 +0100 |
commit | 203ca287b9fe7dc00f02ac5e354260cfedfeac93 (patch) | |
tree | d36506075f711006a638bfc66b2d8479fddc4a9b /tests | |
parent | e22520d716f5e9c32457ae7f4aa59378fd55f62c (diff) | |
download | serd-203ca287b9fe7dc00f02ac5e354260cfedfeac93.tar.gz serd-203ca287b9fe7dc00f02ac5e354260cfedfeac93.tar.bz2 serd-203ca287b9fe7dc00f02ac5e354260cfedfeac93.zip |
Add a test for reading strings with no trailing newline
Diffstat (limited to 'tests')
-rw-r--r-- | tests/serd_test.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/serd_test.c b/tests/serd_test.c index 05fb0461..efb38161 100644 --- a/tests/serd_test.c +++ b/tests/serd_test.c @@ -188,6 +188,28 @@ test_read_chunks(void) } static void +test_read_string(void) +{ + ReaderTest* rt = (ReaderTest*)calloc(1, sizeof(ReaderTest)); + SerdReader* reader = serd_reader_new( + SERD_TURTLE, rt, free, + NULL, NULL, test_sink, NULL); + assert(reader); + assert(serd_reader_get_handle(reader) == rt); + + // Test reading a string that ends exactly at the end of input (no newline) + const SerdStatus st = + serd_reader_read_string(reader, + USTR("<http://example.org/s> <http://example.org/p> " + "<http://example.org/o> .")); + + assert(!st); + assert(rt->n_statements == 1); + + serd_reader_free(reader); +} + +static void test_string_to_double(void) { const double expt_test_nums[] = { @@ -654,6 +676,7 @@ main(void) test_uri_from_string(); test_relative_uri(); test_read_chunks(); + test_read_string(); const char* const path = "serd_test.ttl"; test_writer(path); |