aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_reader_writer.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-03-27 05:39:26 -0400
committerDavid Robillard <d@drobilla.net>2023-12-02 18:49:08 -0500
commit7ffa2c0488fcd96c3c12713e5650633eb03e91f7 (patch)
tree9ca96bb40f71b6c37789ae641af75e39a2751c18 /test/test_reader_writer.c
parent5e4538756d601e6a941c5290777af95ea8848e1a (diff)
downloadserd-7ffa2c0488fcd96c3c12713e5650633eb03e91f7.tar.gz
serd-7ffa2c0488fcd96c3c12713e5650633eb03e91f7.tar.bz2
serd-7ffa2c0488fcd96c3c12713e5650633eb03e91f7.zip
[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.
Diffstat (limited to 'test/test_reader_writer.c')
-rw-r--r--test/test_reader_writer.c11
1 files changed, 8 insertions, 3 deletions
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);
}