diff options
Diffstat (limited to 'test/test_reader.c')
-rw-r--r-- | test/test_reader.c | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/test/test_reader.c b/test/test_reader.c index b5cefbe1..f1ec1d35 100644 --- a/test/test_reader.c +++ b/test/test_reader.c @@ -4,6 +4,7 @@ #undef NDEBUG #include "serd/caret.h" +#include "serd/env.h" #include "serd/event.h" #include "serd/input_stream.h" #include "serd/node.h" @@ -96,7 +97,9 @@ test_prepare_error(const char* const path) SerdSink* const sink = serd_sink_new(&rt, test_sink, NULL); assert(sink); - SerdReader* const reader = serd_reader_new(world, SERD_TURTLE, 0, sink); + SerdEnv* const env = serd_env_new(serd_empty_string()); + SerdReader* const reader = serd_reader_new(world, SERD_TURTLE, 0, env, sink); + assert(reader); SerdInputStream in = @@ -111,6 +114,7 @@ test_prepare_error(const char* const path) serd_close_input(&in); serd_reader_free(reader); + serd_env_free(env); serd_sink_free(sink); serd_world_free(world); fclose(f); @@ -125,7 +129,9 @@ test_read_string(void) SerdSink* sink = serd_sink_new(&rt, test_sink, NULL); assert(sink); - SerdReader* reader = serd_reader_new(world, SERD_TURTLE, 0U, sink); + SerdEnv* const env = serd_env_new(serd_empty_string()); + SerdReader* const reader = serd_reader_new(world, SERD_TURTLE, 0U, env, sink); + assert(reader); static const char* const string1 = @@ -162,6 +168,7 @@ test_read_string(void) assert(!serd_close_input(&in)); serd_reader_free(reader); + serd_env_free(env); serd_sink_free(sink); serd_world_free(world); } @@ -221,11 +228,11 @@ test_read_eof_by_page(const char* const path) fflush(f); fseek(f, 0L, SEEK_SET); - SerdWorld* world = serd_world_new(); - ReaderTest ignored = {0, 0, 0, 0}; - SerdSink* sink = serd_sink_new(&ignored, test_sink, NULL); - SerdReader* reader = serd_reader_new(world, SERD_TURTLE, 0U, sink); - + SerdWorld* world = serd_world_new(); + ReaderTest ignored = {0, 0, 0, 0}; + SerdSink* sink = serd_sink_new(&ignored, test_sink, NULL); + SerdEnv* env = serd_env_new(serd_empty_string()); + SerdReader* reader = serd_reader_new(world, SERD_TURTLE, 0U, env, sink); SerdInputStream in = serd_open_input_stream((SerdReadFunc)fread, (SerdErrorFunc)ferror, NULL, f); @@ -237,6 +244,7 @@ test_read_eof_by_page(const char* const path) assert(!serd_close_input(&in)); serd_reader_free(reader); + serd_env_free(env); serd_sink_free(sink); serd_world_free(world); fclose(f); @@ -250,7 +258,8 @@ test_read_eof_by_byte(void) SerdWorld* world = serd_world_new(); ReaderTest ignored = {0, 0, 0, 0}; SerdSink* sink = serd_sink_new(&ignored, test_sink, NULL); - SerdReader* reader = serd_reader_new(world, SERD_TURTLE, 0U, sink); + SerdEnv* env = serd_env_new(serd_empty_string()); + SerdReader* reader = serd_reader_new(world, SERD_TURTLE, 0U, env, sink); size_t n_reads = 0U; SerdInputStream in = serd_open_input_stream( @@ -265,6 +274,7 @@ test_read_eof_by_byte(void) assert(!serd_close_input(&in)); serd_reader_free(reader); + serd_env_free(env); serd_sink_free(sink); serd_world_free(world); } @@ -300,7 +310,10 @@ test_read_nquads_chunks(const char* const path) SerdSink* const sink = serd_sink_new(&rt, test_sink, NULL); assert(sink); - SerdReader* const reader = serd_reader_new(world, SERD_NQUADS, 0U, sink); + SerdEnv* const env = serd_env_new(serd_empty_string()); + assert(env); + + SerdReader* const reader = serd_reader_new(world, SERD_TURTLE, 0U, env, sink); assert(reader); SerdInputStream in = @@ -353,6 +366,7 @@ test_read_nquads_chunks(const char* const path) assert(!serd_close_input(&in)); serd_reader_free(reader); + serd_env_free(env); serd_sink_free(sink); serd_world_free(world); fclose(f); @@ -382,7 +396,10 @@ test_read_turtle_chunks(const char* const path) SerdSink* sink = serd_sink_new(&rt, test_sink, NULL); assert(sink); - SerdReader* reader = serd_reader_new(world, SERD_TURTLE, 0U, sink); + SerdEnv* const env = serd_env_new(serd_empty_string()); + assert(env); + + SerdReader* const reader = serd_reader_new(world, SERD_TURTLE, 0U, env, sink); assert(reader); SerdInputStream in = @@ -451,6 +468,7 @@ test_read_turtle_chunks(const char* const path) assert(!serd_close_input(&in)); serd_reader_free(reader); + serd_env_free(env); serd_sink_free(sink); serd_world_free(world); fclose(f); @@ -467,7 +485,11 @@ test_read_empty(const char* const path) SerdSink* const sink = serd_sink_new(&rt, test_sink, NULL); assert(sink); - SerdReader* const reader = serd_reader_new(world, SERD_SYNTAX_EMPTY, 0, sink); + SerdEnv* const env = serd_env_new(serd_empty_string()); + assert(env); + + SerdReader* const reader = + serd_reader_new(world, SERD_SYNTAX_EMPTY, 0U, env, sink); assert(reader); FILE* const f = fopen(path, "w+b"); @@ -487,6 +509,7 @@ test_read_empty(const char* const path) fclose(f); assert(!zix_remove(path)); serd_reader_free(reader); + serd_env_free(env); serd_sink_free(sink); serd_world_free(world); } @@ -516,7 +539,8 @@ test_error_cursor(void) SerdWorld* world = serd_world_new(); bool called = false; SerdSink* sink = serd_sink_new(&called, check_cursor, NULL); - SerdReader* const reader = serd_reader_new(world, SERD_TURTLE, 0, sink); + SerdEnv* const env = serd_env_new(serd_empty_string()); + SerdReader* const reader = serd_reader_new(world, SERD_TURTLE, 0U, env, sink); assert(sink); assert(reader); @@ -537,6 +561,7 @@ test_error_cursor(void) serd_node_free(string_name); serd_reader_free(reader); + serd_env_free(env); serd_sink_free(sink); serd_world_free(world); } |