diff options
author | David Robillard <d@drobilla.net> | 2019-04-28 17:54:00 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2021-03-08 23:23:05 -0500 |
commit | 2ab2b5f2c7bd4d26aa99eee959f0e5192b3813dc (patch) | |
tree | 9fccf392d6eb69fb11b9bc2bbe24cf35eaa63ab2 /test | |
parent | 01daa5914169d57a6a6c4925d3f8d76db80a2bd8 (diff) | |
download | serd-2ab2b5f2c7bd4d26aa99eee959f0e5192b3813dc.tar.gz serd-2ab2b5f2c7bd4d26aa99eee959f0e5192b3813dc.tar.bz2 serd-2ab2b5f2c7bd4d26aa99eee959f0e5192b3813dc.zip |
Replace serd_reader_set_strict() with SerdReaderFlags
This makes reader options extensible and should hopefully prevent the need for
grafting on more similar functions in the future.
Diffstat (limited to 'test')
-rw-r--r-- | test/test_overflow.c | 3 | ||||
-rw-r--r-- | test/test_read_chunk.c | 2 | ||||
-rw-r--r-- | test/test_reader_writer.c | 28 |
3 files changed, 17 insertions, 16 deletions
diff --git a/test/test_overflow.c b/test/test_overflow.c index a4d59368..8d451f2a 100644 --- a/test/test_overflow.c +++ b/test/test_overflow.c @@ -24,7 +24,8 @@ static SerdStatus test(SerdWorld* world, SerdSink* sink, const char* str, size_t stack_size) { - SerdReader* reader = serd_reader_new(world, SERD_TURTLE, sink, stack_size); + SerdReader* reader = serd_reader_new(world, SERD_TURTLE, 0, sink, stack_size); + serd_reader_start_string(reader, str, NULL); const SerdStatus st = serd_reader_read_document(reader); serd_reader_free(reader); diff --git a/test/test_read_chunk.c b/test/test_read_chunk.c index 0f24089d..1bbe2709 100644 --- a/test/test_read_chunk.c +++ b/test/test_read_chunk.c @@ -94,7 +94,7 @@ main(void) SerdWorld* world = serd_world_new(); SerdSink* sink = serd_sink_new(NULL, on_event, NULL); - SerdReader* reader = serd_reader_new(world, SERD_TURTLE, sink, 4096); + SerdReader* reader = serd_reader_new(world, SERD_TURTLE, 0, sink, 4096); assert(reader); assert(!serd_reader_start_string(reader, diff --git a/test/test_reader_writer.c b/test/test_reader_writer.c index fec09ff8..e0f636e9 100644 --- a/test/test_reader_writer.c +++ b/test/test_reader_writer.c @@ -77,7 +77,7 @@ test_read_chunks(void) SerdSink* const sink = serd_sink_new(&n_statements, count_statements, NULL); assert(sink); - SerdReader* const reader = serd_reader_new(world, SERD_TURTLE, sink, 4096); + SerdReader* const reader = serd_reader_new(world, SERD_TURTLE, 0, sink, 4096); assert(reader); SerdStatus st = serd_reader_start_stream( @@ -148,12 +148,12 @@ test_get_blank(void) static int test_strict_write(void) { - SerdWorld* world = serd_world_new(); - const char* path = "serd_strict_write_test.ttl"; - FILE* fd = fopen(path, "wb"); - SerdEnv* env = serd_env_new(SERD_EMPTY_STRING()); - SerdWriter* writer = serd_writer_new( - world, SERD_TURTLE, SERD_WRITE_STRICT, env, (SerdWriteFunc)fwrite, fd); + SerdWorld* world = serd_world_new(); + const char* path = "serd_strict_write_test.ttl"; + FILE* fd = fopen(path, "wb"); + SerdEnv* env = serd_env_new(SERD_EMPTY_STRING()); + SerdWriter* writer = + serd_writer_new(world, SERD_TURTLE, 0, env, (SerdWriteFunc)fwrite, fd); assert(fd); assert(writer); @@ -184,13 +184,13 @@ test_strict_write(void) static void test_read_string(void) { - SerdWorld* world = serd_world_new(); - size_t n_statements = 0; + SerdWorld* const world = serd_world_new(); + size_t n_statements = 0; - SerdSink* sink = serd_sink_new(&n_statements, count_statements, NULL); + SerdSink* const sink = serd_sink_new(&n_statements, count_statements, NULL); assert(sink); - SerdReader* reader = serd_reader_new(world, SERD_TURTLE, sink, 4096); + SerdReader* const reader = serd_reader_new(world, SERD_TURTLE, 0, sink, 4096); assert(reader); // Test reading a string that ends exactly at the end of input (no newline) @@ -218,8 +218,8 @@ test_writer(const char* const path) SerdWorld* world = serd_world_new(); - SerdWriter* writer = - serd_writer_new(world, SERD_TURTLE, 0, env, (SerdWriteFunc)fwrite, fd); + SerdWriter* writer = serd_writer_new( + world, SERD_TURTLE, SERD_WRITE_LAX, env, (SerdWriteFunc)fwrite, fd); assert(writer); serd_writer_chop_blank_prefix(writer, "tmp"); @@ -324,7 +324,7 @@ test_reader(const char* path) SerdSink* const sink = serd_sink_new(&n_statements, count_statements, NULL); assert(sink); - SerdReader* reader = serd_reader_new(world, SERD_TURTLE, sink, 4096); + SerdReader* reader = serd_reader_new(world, SERD_TURTLE, 0, sink, 4096); assert(reader); serd_reader_add_blank_prefix(reader, "tmp"); |