diff options
author | David Robillard <d@drobilla.net> | 2018-04-29 18:29:03 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 16:27:02 -0500 |
commit | 5c02da92038072f28408854e862fc2d4edf765d4 (patch) | |
tree | 34577415801279981b626b18c1dc69dc79afea7f /test | |
parent | 672e90382da08efa8f593fdc9081e31d0e548fa0 (diff) | |
download | serd-5c02da92038072f28408854e862fc2d4edf765d4.tar.gz serd-5c02da92038072f28408854e862fc2d4edf765d4.tar.bz2 serd-5c02da92038072f28408854e862fc2d4edf765d4.zip |
Simplify node construction API
Diffstat (limited to 'test')
-rw-r--r-- | test/test_env.c | 49 | ||||
-rw-r--r-- | test/test_node.c | 62 | ||||
-rw-r--r-- | test/test_reader_writer.c | 55 | ||||
-rw-r--r-- | test/test_uri.c | 12 | ||||
-rw-r--r-- | test/test_writer.c | 76 |
5 files changed, 157 insertions, 97 deletions
diff --git a/test/test_env.c b/test/test_env.c index b1371d16..8dbc24a1 100644 --- a/test/test_env.c +++ b/test/test_env.c @@ -24,15 +24,12 @@ count_prefixes(void* handle, const SerdNode* name, const SerdNode* uri) static void test_env(void) { - SerdNode* u = serd_new_string(SERD_URI, "http://example.org/foo"); - SerdNode* b = serd_new_string(SERD_CURIE, "invalid"); - SerdNode* e = serd_new_string(SERD_URI, ""); - SerdNode* c = serd_new_string(SERD_CURIE, "eg.2:b"); - SerdNode* s = serd_new_string(SERD_LITERAL, "hello"); - SerdEnv* env = serd_env_new(NULL); - serd_env_set_prefix_from_strings(env, "eg.2", "http://example.org/"); - - assert(!serd_env_new(s)); + SerdNode* u = serd_new_uri(serd_string("http://example.org/foo")); + SerdNode* b = serd_new_curie(serd_string("invalid")); + SerdNode* e = serd_new_uri(serd_empty_string()); + SerdNode* c = serd_new_curie(serd_string("eg.2:b")); + SerdNode* s = serd_new_string(serd_string("hello")); + SerdEnv* env = serd_env_new(serd_empty_string()); const SerdNode* prefix_node = NULL; SerdStringView prefix = serd_empty_string(); @@ -42,20 +39,29 @@ test_env(void) assert(serd_env_expand(env, NULL, &prefix, &suffix) == SERD_BAD_CURIE); - assert(serd_env_set_prefix_from_strings(env, "eg.3", "rel") == SERD_BAD_ARG); + assert(!serd_env_base_uri(env)); + assert(!serd_env_set_base_uri(env, serd_empty_string())); + assert(!serd_env_base_uri(env)); + assert(!serd_env_base_uri(env)); + + serd_env_set_prefix( + env, serd_string("eg.2"), serd_string("http://example.org/")); + + assert(serd_env_set_prefix(env, serd_string("eg.3"), serd_string("rel")) == + SERD_BAD_ARG); assert(!serd_env_expand_node(NULL, u)); assert(!serd_env_expand_node(env, b)); assert(!serd_env_expand_node(env, s)); assert(!serd_env_expand_node(env, e)); - assert(!serd_env_set_base_uri(env, NULL)); + assert(!serd_env_set_base_uri(env, serd_empty_string())); SerdNode* xu = serd_env_expand_node(env, u); assert(!strcmp(serd_node_string(xu), "http://example.org/foo")); serd_node_free(xu); - SerdNode* badpre = serd_new_string(SERD_CURIE, "hm:what"); + SerdNode* badpre = serd_new_curie(serd_string("hm:what")); SerdNode* xbadpre = serd_env_expand_node(env, badpre); assert(!xbadpre); @@ -63,34 +69,31 @@ test_env(void) assert(!strcmp(serd_node_string(xc), "http://example.org/b")); serd_node_free(xc); - SerdNode* lit = serd_new_string(SERD_LITERAL, "hello"); - assert(serd_env_set_prefix(env, b, lit)); - - SerdNode* blank = serd_new_string(SERD_BLANK, "b1"); + SerdNode* blank = serd_new_blank(serd_string("b1")); assert(!serd_env_expand_node(env, blank)); serd_node_free(blank); int n_prefixes = 0; - serd_env_set_prefix_from_strings(env, "eg.2", "http://example.org/"); + serd_env_set_prefix( + env, serd_string("eg.2"), serd_string("http://example.org/")); serd_env_foreach(env, count_prefixes, &n_prefixes); assert(n_prefixes == 1); - SerdNode* shorter_uri = serd_new_string(SERD_URI, "urn:foo"); + SerdNode* shorter_uri = serd_new_uri(serd_string("urn:foo")); assert(!serd_env_qualify(env, shorter_uri, &prefix_node, &suffix)); - assert(!serd_env_set_base_uri(env, u)); - assert(serd_node_equals(serd_env_base_uri(env, NULL), u)); + assert(!serd_env_set_base_uri(env, serd_node_string_view(u))); + assert(serd_node_equals(serd_env_base_uri(env), u)); SerdNode* xe = serd_env_expand_node(env, e); assert(xe); assert(!strcmp(serd_node_string(xe), "http://example.org/foo")); serd_node_free(xe); - assert(!serd_env_set_base_uri(env, NULL)); - assert(!serd_env_base_uri(env, NULL)); + assert(!serd_env_set_base_uri(env, serd_empty_string())); + assert(!serd_env_base_uri(env)); serd_node_free(shorter_uri); - serd_node_free(lit); serd_node_free(badpre); serd_node_free(s); serd_node_free(c); diff --git a/test/test_node.c b/test/test_node.c index 1d4d1107..68bdf784 100644 --- a/test/test_node.c +++ b/test/test_node.c @@ -6,6 +6,7 @@ #include "serd/memory.h" #include "serd/node.h" #include "serd/string.h" +#include "serd/string_view.h" #include "serd/uri.h" #include <assert.h> @@ -146,19 +147,22 @@ test_blob_to_node(void) static void test_node_equals(void) { - const uint8_t replacement_char_str[] = {0xEF, 0xBF, 0xBD, 0}; - SerdNode* lhs = - serd_new_string(SERD_LITERAL, (const char*)replacement_char_str); - SerdNode* rhs = serd_new_string(SERD_LITERAL, "123"); + static const uint8_t replacement_char_str[] = {0xEF, 0xBF, 0xBD, 0}; + + SerdNode* const lhs = + serd_new_string(serd_substring((const char*)replacement_char_str, 3)); + + assert(serd_node_equals(lhs, lhs)); + + SerdNode* const rhs = serd_new_string(serd_string("123")); assert(!serd_node_equals(lhs, rhs)); - SerdNode* qnode = serd_new_string(SERD_CURIE, "foo:bar"); + SerdNode* const qnode = serd_new_curie(serd_string("foo:bar")); assert(!serd_node_equals(lhs, qnode)); - assert(serd_node_equals(lhs, lhs)); + serd_node_free(qnode); assert(!serd_node_copy(NULL)); - serd_node_free(qnode); serd_node_free(lhs); serd_node_free(rhs); } @@ -166,15 +170,15 @@ test_node_equals(void) static void test_node_from_string(void) { - SerdNode* const hello = serd_new_string(SERD_LITERAL, "hello\""); + SerdNode* const hello = serd_new_string(serd_string("hello\"")); assert(serd_node_length(hello) == 6); assert(serd_node_flags(hello) == SERD_HAS_QUOTE); - assert(!strcmp(serd_node_string(hello), "hello\"")); + assert(!strncmp(serd_node_string(hello), "hello\"", 6)); assert(!strcmp(serd_node_string_view(hello).data, "hello\"")); assert(serd_node_string_view(hello).length == 6); serd_node_free(hello); - SerdNode* const uri = serd_new_string(SERD_URI, "http://example.org/"); + SerdNode* const uri = serd_new_uri(serd_string("http://example.org/")); assert(serd_node_length(uri) == 19); assert(!strcmp(serd_node_string(uri), "http://example.org/")); assert(serd_node_uri_view(uri).authority.length == 11); @@ -185,14 +189,11 @@ test_node_from_string(void) static void test_node_from_substring(void) { - SerdNode* a_b = serd_new_substring(SERD_LITERAL, "a\"bc", 3); - assert(serd_node_length(a_b) == 3 && serd_node_flags(a_b) == SERD_HAS_QUOTE && - !strncmp(serd_node_string(a_b), "a\"b", 3)); - - serd_node_free(a_b); - a_b = serd_new_substring(SERD_LITERAL, "a\"bc", 10); - assert(serd_node_length(a_b) == 4 && serd_node_flags(a_b) == SERD_HAS_QUOTE && - !strncmp(serd_node_string(a_b), "a\"bc", 4)); + SerdNode* const a_b = serd_new_string(serd_substring("a\"bc", 3)); + assert(serd_node_length(a_b) == 3); + assert(serd_node_flags(a_b) == SERD_HAS_QUOTE); + assert(strlen(serd_node_string(a_b)) == 3); + assert(!strncmp(serd_node_string(a_b), "a\"b", 3)); serd_node_free(a_b); } @@ -209,14 +210,18 @@ check_copy_equals(const SerdNode* const node) static void test_literal(void) { - SerdNode* hello2 = serd_new_literal("hello\"", NULL, NULL); + SerdNode* hello2 = serd_new_literal( + serd_string("hello\""), serd_empty_string(), serd_empty_string()); + assert(serd_node_length(hello2) == 6 && serd_node_flags(hello2) == SERD_HAS_QUOTE && !strcmp(serd_node_string(hello2), "hello\"")); check_copy_equals(hello2); serd_node_free(hello2); - SerdNode* hello_l = serd_new_literal("hello_l\"", NULL, "en"); + SerdNode* hello_l = serd_new_literal( + serd_string("hello_l\""), serd_empty_string(), serd_string("en")); + assert(serd_node_length(hello_l) == 8); assert(!strcmp(serd_node_string(hello_l), "hello_l\"")); assert(serd_node_flags(hello_l) == (SERD_HAS_QUOTE | SERD_HAS_LANGUAGE)); @@ -227,8 +232,10 @@ test_literal(void) check_copy_equals(hello_l); serd_node_free(hello_l); - SerdNode* hello_dt = - serd_new_literal("hello_dt\"", "http://example.org/Thing", NULL); + SerdNode* hello_dt = serd_new_literal(serd_string("hello_dt\""), + serd_string("http://example.org/Thing"), + serd_empty_string()); + assert(serd_node_length(hello_dt) == 9); assert(!strcmp(serd_node_string(hello_dt), "hello_dt\"")); assert(serd_node_flags(hello_dt) == (SERD_HAS_QUOTE | SERD_HAS_DATATYPE)); @@ -241,6 +248,16 @@ test_literal(void) serd_node_free(hello_dt); } +static void +test_blank(void) +{ + SerdNode* blank = serd_new_blank(serd_string("b0")); + assert(serd_node_length(blank) == 2); + assert(serd_node_flags(blank) == 0); + assert(!strcmp(serd_node_string(blank), "b0")); + serd_node_free(blank); +} + int main(void) { @@ -252,6 +269,7 @@ main(void) test_node_from_string(); test_node_from_substring(); test_literal(); + test_blank(); printf("Success\n"); return 0; diff --git a/test/test_reader_writer.c b/test/test_reader_writer.c index 245f5328..b1121cbc 100644 --- a/test/test_reader_writer.c +++ b/test/test_reader_writer.c @@ -13,6 +13,7 @@ #include "serd/statement.h" #include "serd/status.h" #include "serd/stream.h" +#include "serd/string_view.h" #include "serd/syntax.h" #include "serd/writer.h" @@ -414,9 +415,9 @@ test_write_errors(void) ctx.n_written = 0; ctx.error_offset = o; - SerdEnv* const env = serd_env_new(NULL); + SerdEnv* const env = serd_env_new(serd_empty_string()); SerdWriter* const writer = - serd_writer_new(syntax, style, env, NULL, faulty_sink, &ctx); + serd_writer_new(syntax, style, env, faulty_sink, &ctx); SerdReader* const reader = serd_reader_new(SERD_TRIG, @@ -444,27 +445,28 @@ static void test_writer(const char* const path) { FILE* fd = fopen(path, "wb"); - SerdEnv* env = serd_env_new(NULL); + SerdEnv* env = serd_env_new(serd_empty_string()); assert(fd); - SerdWriter* writer = - serd_writer_new(SERD_TURTLE, 0, env, NULL, serd_file_sink, fd); + SerdWriter* writer = serd_writer_new(SERD_TURTLE, 0, env, serd_file_sink, fd); assert(writer); serd_writer_chop_blank_prefix(writer, "tmp"); serd_writer_chop_blank_prefix(writer, NULL); - SerdNode* lit = serd_new_string(SERD_LITERAL, "hello"); + SerdNode* lit = serd_new_string(serd_string("hello")); assert(serd_writer_set_base_uri(writer, lit)); assert(serd_writer_set_prefix(writer, lit, lit)); assert(serd_writer_end_anon(writer, NULL)); assert(serd_writer_env(writer) == env); - uint8_t buf[] = {0xEF, 0xBF, 0xBD, 0}; - SerdNode* s = serd_new_string(SERD_URI, ""); - SerdNode* p = serd_new_string(SERD_URI, "http://example.org/pred"); - SerdNode* o = serd_new_string(SERD_LITERAL, (char*)buf); + static const uint8_t buf[] = {0xEF, 0xBF, 0xBD, 0}; + const SerdStringView buf_view = {(const char*)buf, 3}; + + SerdNode* s = serd_new_uri(serd_empty_string()); + SerdNode* p = serd_new_uri(serd_string("http://example.org/pred")); + SerdNode* o = serd_new_string(buf_view); // Write 3 invalid statements (should write nothing) const SerdNode* junk[][3] = {{s, o, o}, {o, p, o}, {s, o, p}}; @@ -473,26 +475,33 @@ test_writer(const char* const path) writer, 0, NULL, junk[i][0], junk[i][1], junk[i][2])); } - SerdNode* t = serd_new_literal((char*)buf, "urn:Type", NULL); - SerdNode* l = serd_new_literal((char*)buf, NULL, "en"); + const SerdStringView empty = serd_empty_string(); + const SerdStringView urn_Type = serd_string("urn:Type"); + const SerdStringView en = serd_string("en"); + + SerdNode* const t = serd_new_literal(buf_view, urn_Type, empty); + SerdNode* const l = serd_new_literal(buf_view, empty, en); const SerdNode* good[][3] = {{s, p, o}, {s, p, t}, {s, p, l}}; + for (size_t i = 0; i < sizeof(good) / (sizeof(SerdNode*) * 3); ++i) { assert(!serd_writer_write_statement( writer, 0, NULL, good[i][0], good[i][1], good[i][2])); } // Write statements with bad UTF-8 (should be replaced) - const char bad_str[] = {(char)0xFF, (char)0x90, 'h', 'i', 0}; - SerdNode* bad_lit = serd_new_string(SERD_LITERAL, bad_str); - SerdNode* bad_uri = serd_new_string(SERD_URI, bad_str); + const char bad_str[] = {(char)0xFF, (char)0x90, 'h', 'i', 0}; + const SerdStringView bad_view = {(const char*)bad_str, 4}; + SerdNode* bad_lit = serd_new_string(bad_view); + SerdNode* bad_uri = serd_new_uri(bad_view); assert(!serd_writer_write_statement(writer, 0, NULL, s, p, bad_lit)); assert(!serd_writer_write_statement(writer, 0, NULL, s, p, bad_uri)); - serd_node_free(bad_lit); + serd_node_free(bad_uri); + serd_node_free(bad_lit); // Write 1 valid statement serd_node_free(o); - o = serd_new_string(SERD_LITERAL, "hello"); + o = serd_new_string(serd_string("hello")); assert(!serd_writer_write_statement(writer, 0, NULL, s, p, o)); serd_writer_free(writer); @@ -503,13 +512,13 @@ test_writer(const char* const path) // Test buffer sink SerdBuffer buffer = {NULL, 0}; - writer = - serd_writer_new(SERD_TURTLE, 0, env, NULL, serd_buffer_sink, &buffer); + writer = serd_writer_new(SERD_TURTLE, 0, env, serd_buffer_sink, &buffer); - o = serd_new_string(SERD_URI, "http://example.org/base"); - assert(!serd_writer_set_base_uri(writer, o)); + SerdNode* const base = serd_new_uri(serd_string("http://example.org/base")); - serd_node_free(o); + serd_writer_set_base_uri(writer, base); + + serd_node_free(base); serd_writer_free(writer); char* out = serd_buffer_sink_finish(&buffer); @@ -540,7 +549,7 @@ test_reader(const char* path) assert(serd_reader_read_chunk(reader) == SERD_FAILURE); - SerdNode* g = serd_new_string(SERD_URI, "http://example.org/"); + SerdNode* g = serd_new_uri(serd_string("http://example.org/")); serd_reader_set_default_graph(reader, g); serd_reader_add_blank_prefix(reader, "tmp"); diff --git a/test/test_uri.c b/test/test_uri.c index 3fe0ebd5..74b732fd 100644 --- a/test/test_uri.c +++ b/test/test_uri.c @@ -44,7 +44,8 @@ test_file_uri(const char* const hostname, expected_path = path; } - SerdNode* node = serd_new_file_uri(path, hostname, 0); + SerdNode* node = serd_new_file_uri(serd_string(path), serd_string(hostname)); + const char* node_str = serd_node_string(node); char* out_hostname = NULL; char* out_path = serd_parse_file_uri(node_str, &out_hostname); @@ -193,22 +194,21 @@ check_relative_uri(const char* const uri_string, assert(base_string); assert(expected_string); - SerdNode* const uri_node = serd_new_uri(uri_string); + SerdNode* const uri_node = serd_new_uri(serd_string(uri_string)); const SerdURIView uri = serd_node_uri_view(uri_node); - SerdNode* const base_node = serd_new_uri(base_string); + SerdNode* const base_node = serd_new_uri(serd_string(base_string)); const SerdURIView base = serd_node_uri_view(base_node); SerdNode* result_node = NULL; if (!root_string) { result_node = serd_new_parsed_uri(serd_relative_uri(uri, base)); } else { - SerdNode* const root_node = serd_new_uri(root_string); + SerdNode* const root_node = serd_new_uri(serd_string(root_string)); const SerdURIView root = serd_node_uri_view(root_node); result_node = serd_uri_is_within(uri, root) ? serd_new_parsed_uri(serd_relative_uri(uri, base)) - : serd_new_uri(uri_string); - + : serd_new_uri(serd_string(uri_string)); serd_node_free(root_node); } diff --git a/test/test_writer.c b/test/test_writer.c index 68d9e14e..b15f7fdc 100644 --- a/test/test_writer.c +++ b/test/test_writer.c @@ -9,6 +9,7 @@ #include "serd/node.h" #include "serd/statement.h" #include "serd/status.h" +#include "serd/string_view.h" #include "serd/syntax.h" #include "serd/writer.h" @@ -18,18 +19,46 @@ #include <string.h> static void +test_write_bad_prefix(void) +{ + SerdEnv* env = serd_env_new(serd_empty_string()); + SerdBuffer buffer = {NULL, 0}; + SerdWriter* writer = + serd_writer_new(SERD_TURTLE, 0U, env, serd_buffer_sink, &buffer); + + assert(writer); + + SerdNode* name = serd_new_string(serd_string("eg")); + SerdNode* uri = serd_new_uri(serd_string("rel")); + + assert(serd_writer_set_prefix(writer, name, uri) == SERD_BAD_ARG); + + char* const out = serd_buffer_sink_finish(&buffer); + + assert(!strcmp(out, "")); + serd_free(out); + + serd_node_free(uri); + serd_node_free(name); + serd_writer_free(writer); + serd_env_free(env); +} + +static void test_write_long_literal(void) { - SerdEnv* env = serd_env_new(NULL); + SerdEnv* env = serd_env_new(serd_empty_string()); SerdBuffer buffer = {NULL, 0}; SerdWriter* writer = - serd_writer_new(SERD_TURTLE, 0U, env, NULL, serd_buffer_sink, &buffer); + serd_writer_new(SERD_TURTLE, 0U, env, serd_buffer_sink, &buffer); assert(writer); - SerdNode* s = serd_new_string(SERD_URI, "http://example.org/s"); - SerdNode* p = serd_new_string(SERD_URI, "http://example.org/p"); - SerdNode* o = serd_new_string(SERD_LITERAL, "hello \"\"\"world\"\"\"!"); + SerdNode* s = serd_new_uri(serd_string("http://example.org/s")); + SerdNode* p = serd_new_uri(serd_string("http://example.org/p")); + SerdNode* o = serd_new_literal(serd_string("hello \"\"\"world\"\"\"!"), + serd_empty_string(), + serd_empty_string()); assert(!serd_writer_write_statement(writer, 0, NULL, s, p, o)); @@ -61,14 +90,13 @@ null_sink(const void* const buf, const size_t len, void* const stream) static void test_writer_cleanup(void) { - SerdStatus st = SERD_SUCCESS; - SerdEnv* env = serd_env_new(NULL); - SerdWriter* writer = - serd_writer_new(SERD_TURTLE, 0U, env, NULL, null_sink, NULL); + SerdStatus st = SERD_SUCCESS; + SerdEnv* env = serd_env_new(serd_empty_string()); + SerdWriter* writer = serd_writer_new(SERD_TURTLE, 0U, env, null_sink, NULL); - SerdNode* s = serd_new_string(SERD_URI, "http://example.org/s"); - SerdNode* p = serd_new_string(SERD_URI, "http://example.org/p"); - SerdNode* o = serd_new_string(SERD_BLANK, "http://example.org/o"); + SerdNode* s = serd_new_uri(serd_string("http://example.org/s")); + SerdNode* p = serd_new_uri(serd_string("http://example.org/p")); + SerdNode* o = serd_new_blank(serd_string("start")); st = serd_writer_write_statement(writer, SERD_ANON_O_BEGIN, NULL, s, p, o); assert(!st); @@ -78,7 +106,7 @@ test_writer_cleanup(void) char buf[12] = {0}; snprintf(buf, sizeof(buf), "b%u", i); - SerdNode* next_o = serd_new_string(SERD_BLANK, buf); + SerdNode* next_o = serd_new_blank(serd_string(buf)); st = serd_writer_write_statement( writer, SERD_ANON_O_BEGIN, NULL, o, p, next_o); @@ -89,6 +117,7 @@ test_writer_cleanup(void) // Finish writing without terminating nodes assert(!(st = serd_writer_finish(writer))); + assert(!(st = serd_writer_set_base_uri(writer, NULL))); // Set the base to an empty URI assert(!(st = serd_writer_set_base_uri(writer, NULL))); @@ -108,19 +137,19 @@ test_strict_write(void) FILE* const fd = fopen(path, "wb"); assert(fd); - SerdEnv* const env = serd_env_new(NULL); + SerdEnv* const env = serd_env_new(serd_empty_string()); SerdWriter* const writer = serd_writer_new( - SERD_TURTLE, (SerdWriterFlags)SERD_WRITE_STRICT, env, NULL, null_sink, fd); + SERD_TURTLE, (SerdWriterFlags)SERD_WRITE_STRICT, env, null_sink, fd); assert(writer); const uint8_t bad_str[] = {0xFF, 0x90, 'h', 'i', 0}; - SerdNode* s = serd_new_string(SERD_URI, "http://example.org/s"); - SerdNode* p = serd_new_string(SERD_URI, "http://example.org/p"); + SerdNode* s = serd_new_uri(serd_string("http://example.org/s")); + SerdNode* p = serd_new_uri(serd_string("http://example.org/p")); - SerdNode* bad_lit = serd_new_string(SERD_LITERAL, (const char*)bad_str); - SerdNode* bad_uri = serd_new_string(SERD_URI, (const char*)bad_str); + SerdNode* bad_lit = serd_new_string(serd_string((const char*)bad_str)); + SerdNode* bad_uri = serd_new_uri(serd_string((const char*)bad_str)); assert(serd_writer_write_statement(writer, 0, NULL, s, p, bad_lit) == SERD_BAD_TEXT); @@ -151,14 +180,14 @@ error_sink(const void* const buf, const size_t len, void* const stream) static void test_write_error(void) { - SerdEnv* const env = serd_env_new(NULL); + SerdEnv* const env = serd_env_new(serd_empty_string()); SerdWriter* writer = NULL; SerdStatus st = SERD_SUCCESS; - SerdNode* u = serd_new_string(SERD_URI, "http://example.com/u"); + SerdNode* u = serd_new_uri(serd_string("http://example.com/u")); - writer = serd_writer_new( - SERD_TURTLE, (SerdWriterFlags)0, env, NULL, error_sink, NULL); + writer = + serd_writer_new(SERD_TURTLE, (SerdWriterFlags)0, env, error_sink, NULL); assert(writer); st = serd_writer_write_statement(writer, 0U, NULL, u, u, u); assert(st == SERD_BAD_WRITE); @@ -171,6 +200,7 @@ test_write_error(void) int main(void) { + test_write_bad_prefix(); test_write_long_literal(); test_writer_cleanup(); test_strict_write(); |