aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_writer.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_writer.c')
-rw-r--r--test/test_writer.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/test/test_writer.c b/test/test_writer.c
index a4d92c5b..fe685437 100644
--- a/test/test_writer.c
+++ b/test/test_writer.c
@@ -29,7 +29,7 @@ test_write_bad_event(void)
SerdEnv* env = serd_env_new(serd_empty_string());
SerdBuffer buffer = {NULL, 0};
SerdWriter* writer =
- serd_writer_new(world, SERD_TURTLE, 0U, env, serd_buffer_sink, &buffer);
+ serd_writer_new(world, SERD_TURTLE, 0U, env, serd_buffer_write, &buffer);
assert(writer);
@@ -37,8 +37,9 @@ test_write_bad_event(void)
assert(serd_sink_write_event(serd_writer_sink(writer), &event) ==
SERD_BAD_ARG);
- char* const out = serd_buffer_sink_finish(&buffer);
+ serd_buffer_close(&buffer);
+ char* const out = (char*)buffer.buf;
assert(!strcmp(out, ""));
serd_free(out);
@@ -54,7 +55,7 @@ test_write_bad_prefix(void)
SerdEnv* env = serd_env_new(serd_empty_string());
SerdBuffer buffer = {NULL, 0};
SerdWriter* writer =
- serd_writer_new(world, SERD_TURTLE, 0U, env, serd_buffer_sink, &buffer);
+ serd_writer_new(world, SERD_TURTLE, 0U, env, serd_buffer_write, &buffer);
assert(writer);
@@ -64,8 +65,9 @@ test_write_bad_prefix(void)
assert(serd_sink_write_prefix(serd_writer_sink(writer), name, uri) ==
SERD_BAD_ARG);
- char* const out = serd_buffer_sink_finish(&buffer);
+ serd_buffer_close(&buffer);
+ char* const out = (char*)buffer.buf;
assert(!strcmp(out, ""));
serd_free(out);
@@ -83,7 +85,7 @@ test_write_long_literal(void)
SerdEnv* env = serd_env_new(serd_empty_string());
SerdBuffer buffer = {NULL, 0};
SerdWriter* writer =
- serd_writer_new(world, SERD_TURTLE, 0U, env, serd_buffer_sink, &buffer);
+ serd_writer_new(world, SERD_TURTLE, 0U, env, serd_buffer_write, &buffer);
assert(writer);
@@ -98,8 +100,9 @@ test_write_long_literal(void)
serd_node_free(s);
serd_writer_free(writer);
serd_env_free(env);
+ serd_buffer_close(&buffer);
- char* out = serd_buffer_sink_finish(&buffer);
+ char* const out = (char*)buffer.buf;
static const char* const expected =
"<http://example.org/s>\n"
@@ -307,14 +310,15 @@ test_write_empty_syntax(void)
SerdBuffer buffer = {NULL, 0};
SerdWriter* writer = serd_writer_new(
- world, SERD_SYNTAX_EMPTY, 0U, env, serd_buffer_sink, &buffer);
+ world, SERD_SYNTAX_EMPTY, 0U, env, serd_buffer_write, &buffer);
assert(writer);
assert(!serd_sink_write(serd_writer_sink(writer), 0U, s, p, o, NULL));
- char* out = serd_buffer_sink_finish(&buffer);
+ serd_buffer_close(&buffer);
+ char* const out = (char*)buffer.buf;
assert(strlen(out) == 0);
serd_free(out);
@@ -334,7 +338,7 @@ check_pname_escape(const char* const lname, const char* const expected)
SerdBuffer buffer = {NULL, 0};
SerdWriter* writer =
- serd_writer_new(world, SERD_TURTLE, 0U, env, serd_buffer_sink, &buffer);
+ serd_writer_new(world, SERD_TURTLE, 0U, env, serd_buffer_write, &buffer);
assert(writer);
@@ -359,8 +363,9 @@ check_pname_escape(const char* const lname, const char* const expected)
serd_node_free(s);
serd_writer_free(writer);
serd_env_free(env);
+ serd_buffer_close(&buffer);
- char* out = serd_buffer_sink_finish(&buffer);
+ char* const out = (char*)buffer.buf;
assert(!strcmp((char*)out, expected));
serd_free(out);