From 7ffa2c0488fcd96c3c12713e5650633eb03e91f7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 27 Mar 2023 05:39:26 -0400 Subject: [WIP] Move SerdEnv mutation from writer to reader Writing having side-effects seems questionable in general, and this prepares things for expanding URIs in the reader. --- test/test_reader_writer.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'test/test_reader_writer.c') diff --git a/test/test_reader_writer.c b/test/test_reader_writer.c index df2c3957..3a20bb7a 100644 --- a/test/test_reader_writer.c +++ b/test/test_reader_writer.c @@ -117,7 +117,8 @@ test_write_errors(void) serd_writer_new(world, syntax, 0U, env, &out, 1U); const SerdSink* const sink = serd_writer_sink(writer); - SerdReader* const reader = serd_reader_new(world, SERD_TRIG, 0U, sink); + SerdReader* const reader = + serd_reader_new(world, SERD_TRIG, 0U, env, sink); const char* position = doc_string; SerdInputStream in = serd_open_input_string(&position); @@ -251,16 +252,19 @@ test_reader(const char* path) SerdSink* const sink = serd_sink_new(&rt, test_sink, NULL); assert(sink); + SerdEnv* const env = serd_env_new(serd_empty_string()); + assert(env); + // Test that too little stack space fails gracefully const SerdLimits old_limits = serd_world_limits(world); SerdLimits limits = old_limits; limits.reader_stack_size = 32U; serd_world_set_limits(world, limits); - assert(!serd_reader_new(world, SERD_TURTLE, 0U, sink)); + assert(!serd_reader_new(world, SERD_TURTLE, 0U, env, sink)); // Restore limits and successfully create reader serd_world_set_limits(world, old_limits); - SerdReader* reader = serd_reader_new(world, SERD_TURTLE, 0U, sink); + SerdReader* reader = serd_reader_new(world, SERD_TURTLE, 0U, env, sink); assert(reader); assert(serd_reader_read_chunk(reader) == SERD_BAD_CALL); @@ -285,6 +289,7 @@ test_reader(const char* path) serd_close_input(&in); serd_reader_free(reader); + serd_env_free(env); serd_sink_free(sink); serd_world_free(world); } -- cgit v1.2.1