From 2ab2b5f2c7bd4d26aa99eee959f0e5192b3813dc Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 28 Apr 2019 17:54:00 +0200 Subject: 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. --- test/test_overflow.c | 3 ++- test/test_read_chunk.c | 2 +- test/test_reader_writer.c | 28 ++++++++++++++-------------- 3 files changed, 17 insertions(+), 16 deletions(-) (limited to 'test') 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"); -- cgit v1.2.1