diff options
-rw-r--r-- | include/serd/serd.h | 70 | ||||
-rw-r--r-- | src/env.c | 67 | ||||
-rw-r--r-- | src/env.h | 7 | ||||
-rw-r--r-- | src/n3.c | 13 | ||||
-rw-r--r-- | src/node.c | 11 | ||||
-rw-r--r-- | src/nodes.c | 6 | ||||
-rw-r--r-- | src/statement.c | 3 | ||||
-rw-r--r-- | src/writer.c | 52 | ||||
-rw-r--r-- | test/test_env.c | 77 | ||||
-rw-r--r-- | test/test_node.c | 4 | ||||
-rw-r--r-- | test/test_nodes.c | 19 | ||||
-rw-r--r-- | test/test_overflow.c | 4 | ||||
-rw-r--r-- | test/test_writer.c | 4 |
13 files changed, 106 insertions, 231 deletions
diff --git a/include/serd/serd.h b/include/serd/serd.h index 7be9395c..05c1ed8c 100644 --- a/include/serd/serd.h +++ b/include/serd/serd.h @@ -570,21 +570,13 @@ typedef enum { SERD_URI = 2, /** - CURIE, a shortened URI. - - Value is an unquoted CURIE string relative to the current environment, - e.g. "rdf:type". @see [CURIE Syntax 1.0](http://www.w3.org/TR/curie) - */ - SERD_CURIE = 3, - - /** A blank node. Value is a blank node ID without any syntactic prefix, like "id3", which is meaningful only within this serialisation. @see [RDF 1.1 Turtle](http://www.w3.org/TR/turtle/#grammar-production-BLANK_NODE_LABEL) */ - SERD_BLANK = 4, + SERD_BLANK = 3, /** A variable node. @@ -593,7 +585,7 @@ typedef enum { which is meaningful only within this serialisation. @see [SPARQL 1.1 Query Language](https://www.w3.org/TR/sparql11-query/#rVar) */ - SERD_VARIABLE = 5 + SERD_VARIABLE = 4 } SerdNodeType; /** @@ -639,11 +631,6 @@ SERD_API SerdNode* SERD_ALLOCATED serd_new_blank(SerdStringView string); -/// Create a new CURIE node -SERD_API -SerdNode* SERD_ALLOCATED -serd_new_curie(SerdStringView string); - /// Create a new URI node SERD_API SerdNode* SERD_ALLOCATED @@ -1000,15 +987,6 @@ const SerdNode* SERD_ALLOCATED serd_nodes_uri(SerdNodes* SERD_NONNULL nodes, SerdStringView string); /** - Make a CURIE node. - - A new node will be added if an equivalent node is not already in the set. -*/ -SERD_API -const SerdNode* SERD_ALLOCATED -serd_nodes_curie(SerdNodes* SERD_NONNULL nodes, SerdStringView string); - -/** Make a blank node. A new node will be added if an equivalent node is not already in the set. @@ -1636,25 +1614,50 @@ serd_env_set_prefix(SerdEnv* SERD_NONNULL env, SerdStringView uri); /** - Qualify `uri` into a CURIE if possible. + Qualify `uri` into a prefix and suffix (like a CURIE) if possible. + + @param env Environment with prefixes to use. + + @param uri URI to qualify. + + @param prefix On success, pointed to a prefix string slice, which is only + valid until the next time `env` is mutated. - Returns null if `uri` can not be qualified (usually because no corresponding - prefix is defined). + @param suffix On success, pointed to a suffix string slice, which is only + valid until the next time `env` is mutated. + + @return #SERD_SUCCESS, or #SERD_FAILURE if `uri` can not be qualified with + `env`. +*/ +SERD_API +SerdStatus +serd_env_qualify(const SerdEnv* SERD_NULLABLE env, + SerdStringView uri, + SerdStringView* SERD_NONNULL prefix, + SerdStringView* SERD_NONNULL suffix); + +/** + Expand `curie` to an absolute URI if possible. + + For example, if `env` has the prefix "rdf" set to + <http://www.w3.org/1999/02/22-rdf-syntax-ns#>, then calling this with curie + "rdf:type" will produce <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>. + + Returns null if `node` can not be expanded. */ SERD_API SerdNode* SERD_ALLOCATED -serd_env_qualify(const SerdEnv* SERD_NULLABLE env, - const SerdNode* SERD_NULLABLE uri); +serd_env_expand_curie(const SerdEnv* SERD_NULLABLE env, SerdStringView curie); /** - Expand `node`, which must be a CURIE or URI, to a full URI. + Expand `node` to an absolute URI if possible. Returns null if `node` can not be expanded. */ SERD_API SerdNode* SERD_ALLOCATED -serd_env_expand(const SerdEnv* SERD_NULLABLE env, - const SerdNode* SERD_NULLABLE node); +serd_env_expand_node(const SerdEnv* SERD_NULLABLE env, + const SerdNode* SERD_NULLABLE node); /// Write all prefixes in `env` to `sink` SERD_API @@ -1740,8 +1743,7 @@ typedef enum { SERD_READ_LAX = 1u << 0u, ///< Tolerate invalid input where possible SERD_READ_VARIABLES = 1u << 1u, ///< Support variable nodes SERD_READ_EXACT_BLANKS = 1u << 2u, ///< Allow clashes with generated blanks - SERD_READ_PREFIXED = 1u << 3u, ///< Do not expand prefixed names - SERD_READ_RELATIVE = 1u << 4u, ///< Do not expand relative URI references + SERD_READ_RELATIVE = 1u << 3u, ///< Do not expand relative URI references } SerdReaderFlag; /// Bitwise OR of SerdReaderFlag values @@ -208,51 +208,29 @@ serd_env_set_prefix(SerdEnv* const env, return SERD_SUCCESS; } -bool -serd_env_qualify_in_place(const SerdEnv* const env, - const SerdNode* const uri, - const SerdNode** const prefix, - SerdStringView* const suffix) +SerdStatus +serd_env_qualify(const SerdEnv* const env, + const SerdStringView uri, + SerdStringView* const prefix, + SerdStringView* const suffix) { for (size_t i = 0; i < env->n_prefixes; ++i) { - const SerdNode* const prefix_uri = env->prefixes[i].uri; - if (uri->length >= prefix_uri->length) { + const SerdNode* const prefix_uri = env->prefixes[i].uri; + const size_t prefix_uri_len = serd_node_length(prefix_uri); + if (uri.len >= prefix_uri_len) { const char* prefix_str = serd_node_string(prefix_uri); - const char* uri_str = serd_node_string(uri); + const char* uri_str = uri.buf; - if (!strncmp(uri_str, prefix_str, prefix_uri->length)) { - *prefix = env->prefixes[i].name; - suffix->buf = uri_str + prefix_uri->length; - suffix->len = uri->length - prefix_uri->length; - return true; + if (!strncmp(uri_str, prefix_str, prefix_uri_len)) { + *prefix = serd_node_string_view(env->prefixes[i].name); + suffix->buf = uri_str + prefix_uri_len; + suffix->len = uri.len - prefix_uri_len; + return SERD_SUCCESS; } } } - return false; -} - -SerdNode* -serd_env_qualify(const SerdEnv* const env, const SerdNode* const uri) -{ - if (!env || !uri) { - return NULL; - } - const SerdNode* prefix = NULL; - SerdStringView suffix = {NULL, 0}; - if (serd_env_qualify_in_place(env, uri, &prefix, &suffix)) { - const size_t prefix_len = serd_node_length(prefix); - const size_t length = prefix_len + 1 + suffix.len; - SerdNode* node = serd_node_malloc(length, 0, SERD_CURIE); - - memcpy(serd_node_buffer(node), serd_node_string(prefix), prefix_len); - serd_node_buffer(node)[prefix_len] = ':'; - memcpy(serd_node_buffer(node) + 1 + prefix_len, suffix.buf, suffix.len); - node->length = length; - return node; - } - - return NULL; + return SERD_FAILURE; } SerdStatus @@ -288,15 +266,16 @@ expand_uri(const SerdEnv* env, const SerdNode* node) return serd_new_resolved_uri(serd_node_string_view(node), env->base_uri); } -static SerdNode* -expand_curie(const SerdEnv* env, const SerdNode* node) +SerdNode* +serd_env_expand_curie(const SerdEnv* const env, const SerdStringView curie) { - assert(serd_node_type(node) == SERD_CURIE); + if (!env) { + return NULL; + } SerdStringView prefix; SerdStringView suffix; - if (serd_env_expand_in_place( - env, serd_node_string_view(node), &prefix, &suffix)) { + if (serd_env_expand_in_place(env, curie, &prefix, &suffix)) { return NULL; } @@ -310,7 +289,7 @@ expand_curie(const SerdEnv* env, const SerdNode* node) } SerdNode* -serd_env_expand(const SerdEnv* env, const SerdNode* node) +serd_env_expand_node(const SerdEnv* const env, const SerdNode* const node) { if (!env || !node) { return NULL; @@ -321,8 +300,6 @@ serd_env_expand(const SerdEnv* env, const SerdNode* node) break; case SERD_URI: return expand_uri(env, node); - case SERD_CURIE: - return expand_curie(env, node); case SERD_BLANK: case SERD_VARIABLE: break; @@ -21,13 +21,6 @@ #include <stdbool.h> -/// Qualify `uri` into a CURIE if possible -bool -serd_env_qualify_in_place(const SerdEnv* env, - const SerdNode* uri, - const SerdNode** prefix, - SerdStringView* suffix); - /** Expand `curie`. @@ -886,8 +886,7 @@ read_PrefixedName(SerdReader* const reader, } if ((st = push_byte(reader, dest, eat_byte_safe(reader, ':'))) || - (st = read_PN_LOCAL(reader, dest, ate_dot)) > SERD_FAILURE || - (reader->flags & SERD_READ_PREFIXED)) { + (st = read_PN_LOCAL(reader, dest, ate_dot)) > SERD_FAILURE) { return st; } @@ -1012,7 +1011,7 @@ read_iri(SerdReader* const reader, SerdNode** const dest, bool* const ate_dot) return read_IRIREF(reader, dest); } - if (!(*dest = push_node(reader, SERD_CURIE, "", 0))) { + if (!(*dest = push_node(reader, SERD_LITERAL, "", 0))) { return SERD_ERR_OVERFLOW; } @@ -1104,7 +1103,7 @@ read_verb(SerdReader* reader, SerdNode** dest) /* Either a qname, or "a". Read the prefix first, and if it is in fact "a", produce that instead. */ - if (!(*dest = push_node(reader, SERD_CURIE, "", 0))) { + if (!(*dest = push_node(reader, SERD_URI, "", 0))) { return SERD_ERR_OVERFLOW; } @@ -1328,7 +1327,7 @@ read_object(SerdReader* const reader, /* Either a boolean literal, or a qname. Read the prefix first, and if it is in fact a "true" or "false" literal, produce that instead. */ - if (!(o = push_node(reader, SERD_CURIE, "", 0))) { + if (!(o = push_node(reader, SERD_URI, "", 0))) { return SERD_ERR_OVERFLOW; } @@ -1533,7 +1532,9 @@ read_subject(SerdReader* const reader, st = read_BLANK_NODE_LABEL(reader, dest, &ate_dot); break; default: - st = read_iri(reader, dest, &ate_dot); + if ((st = read_iri(reader, dest, &ate_dot))) { + return r_err(reader, st, "expected subject"); + } } if (ate_dot) { @@ -170,8 +170,7 @@ result(const SerdStatus status, const size_t count) SerdNode* serd_new_simple_node(const SerdNodeType type, const SerdStringView str) { - if (type != SERD_BLANK && type != SERD_CURIE && type != SERD_URI && - type != SERD_VARIABLE) { + if (type != SERD_BLANK && type != SERD_URI && type != SERD_VARIABLE) { return NULL; } @@ -287,12 +286,6 @@ serd_new_blank(const SerdStringView str) return serd_new_simple_node(SERD_BLANK, str); } -SerdNode* -serd_new_curie(const SerdStringView str) -{ - return serd_new_simple_node(SERD_CURIE, str); -} - ExessResult serd_node_get_value_as(const SerdNode* const node, const ExessDatatype value_type, @@ -748,7 +741,7 @@ serd_node_datatype(const SerdNode* const node) } const SerdNode* const datatype = serd_node_meta_c(node); - assert(datatype->type == SERD_URI || datatype->type == SERD_CURIE); + assert(datatype->type == SERD_URI); return datatype; } diff --git a/src/nodes.c b/src/nodes.c index e6476f81..412d0d24 100644 --- a/src/nodes.c +++ b/src/nodes.c @@ -179,12 +179,6 @@ serd_nodes_uri(SerdNodes* const nodes, const SerdStringView string) } const SerdNode* -serd_nodes_curie(SerdNodes* const nodes, const SerdStringView string) -{ - return serd_nodes_manage(nodes, serd_new_curie(string)); -} - -const SerdNode* serd_nodes_blank(SerdNodes* const nodes, const SerdStringView string) { return serd_nodes_manage(nodes, serd_new_blank(string)); diff --git a/src/statement.c b/src/statement.c index 0ec6520a..f3034566 100644 --- a/src/statement.c +++ b/src/statement.c @@ -28,8 +28,7 @@ is_resource(const SerdNode* const node) { const SerdNodeType type = serd_node_type(node); - return type == SERD_URI || type == SERD_CURIE || type == SERD_BLANK || - type == SERD_VARIABLE; + return type == SERD_URI || type == SERD_BLANK || type == SERD_VARIABLE; } bool diff --git a/src/writer.c b/src/writer.c index c86b066d..bfce4f9e 100644 --- a/src/writer.c +++ b/src/writer.c @@ -761,7 +761,7 @@ is_name(const char* buf, const size_t len) { // TODO: This is more strict than it should be for (size_t i = 0; i < len; ++i) { - if (!(is_alpha(buf[i]) || is_digit(buf[i]))) { + if (!(is_alpha(buf[i]) || is_digit(buf[i]) || lname_must_escape(buf[i]))) { return false; } } @@ -811,11 +811,11 @@ write_uri_node(SerdWriter* const writer, const SerdNode* const node, const SerdField field) { - SerdStatus st = SERD_SUCCESS; - const SerdNode* prefix = NULL; - SerdStringView suffix = {NULL, 0}; - const char* node_str = serd_node_string(node); - const bool has_scheme = serd_uri_string_has_scheme(node_str); + SerdStatus st = SERD_SUCCESS; + SerdStringView prefix = {NULL, 0}; + SerdStringView suffix = {NULL, 0}; + const char* node_str = serd_node_string(node); + const bool has_scheme = serd_uri_string_has_scheme(node_str); if (supports_abbrev(writer)) { if (field == SERD_PREDICATE && serd_node_equals(node, writer->world->rdf_type)) { @@ -827,12 +827,12 @@ write_uri_node(SerdWriter* const writer, } if (has_scheme && !(writer->flags & SERD_WRITE_UNQUALIFIED) && - serd_env_qualify_in_place(writer->env, node, &prefix, &suffix) && - is_name(serd_node_string(prefix), serd_node_length(prefix)) && - is_name(suffix.buf, suffix.len)) { - TRY(st, write_uri_from_node(writer, prefix)); + !serd_env_qualify( + writer->env, serd_node_string_view(node), &prefix, &suffix) && + is_name(prefix.buf, prefix.len) && is_name(suffix.buf, suffix.len)) { + TRY(st, write_lname(writer, prefix.buf, prefix.len)); TRY(st, esink(":", 1, writer)); - return ewrite_uri(writer, suffix.buf, suffix.len); + return write_lname(writer, suffix.buf, suffix.len); } } @@ -848,33 +848,6 @@ write_uri_node(SerdWriter* const writer, } SERD_WARN_UNUSED_RESULT static SerdStatus -write_curie(SerdWriter* const writer, const SerdNode* const node) -{ - writer->last_sep = SEP_NONE; - - SerdStringView prefix = {NULL, 0}; - SerdStringView suffix = {NULL, 0}; - SerdStatus st = SERD_SUCCESS; - - if (writer->syntax == SERD_NTRIPLES || writer->syntax == SERD_NQUADS) { - const SerdStringView curie = serd_node_string_view(node); - if ((st = serd_env_expand_in_place(writer->env, curie, &prefix, &suffix))) { - return w_err(writer, - st, - "undefined namespace prefix in `%s'", - serd_node_string(node)); - } - - TRY(st, esink("<", 1, writer)); - TRY(st, ewrite_uri(writer, prefix.buf, prefix.len)); - TRY(st, ewrite_uri(writer, suffix.buf, suffix.len)); - return esink(">", 1, writer); - } - - return write_lname(writer, serd_node_string(node), node->length); -} - -SERD_WARN_UNUSED_RESULT static SerdStatus write_blank(SerdWriter* const writer, const SerdNode* node, const SerdField field, @@ -940,9 +913,6 @@ write_node(SerdWriter* const writer, case SERD_URI: st = write_uri_node(writer, node, field); break; - case SERD_CURIE: - st = write_curie(writer, node); - break; case SERD_BLANK: st = write_blank(writer, node, field, flags); break; diff --git a/test/test_env.c b/test/test_env.c index 9e60104d..41e2060b 100644 --- a/test/test_env.c +++ b/test/test_env.c @@ -67,20 +67,15 @@ test_comparison(void) static void test_null(void) { - SerdNode* const eg = serd_new_uri(SERD_STRING(NS_EG)); - // "Copying" NULL returns null assert(!serd_env_copy(NULL)); // Accessors are tolerant to a NULL env for convenience assert(!serd_env_base_uri(NULL)); - assert(!serd_env_expand(NULL, NULL)); - assert(!serd_env_qualify(NULL, eg)); + assert(!serd_env_expand_node(NULL, NULL)); // Only null is equal to null assert(serd_env_equals(NULL, NULL)); - - serd_node_free(eg); } static SerdStatus @@ -158,7 +153,7 @@ test_expand_untyped_literal(void) SerdNode* const untyped = serd_new_string(SERD_STRING("data")); SerdEnv* const env = serd_env_new(SERD_EMPTY_STRING()); - assert(!serd_env_expand(env, untyped)); + assert(!serd_env_expand_node(env, untyped)); serd_env_free(env); serd_node_free(untyped); @@ -172,7 +167,7 @@ test_expand_bad_uri_datatype(void) SerdNode* const typed = serd_new_typed_literal(SERD_STRING("data"), type); SerdEnv* const env = serd_env_new(SERD_EMPTY_STRING()); - assert(!serd_env_expand(env, typed)); + assert(!serd_env_expand_node(env, typed)); serd_env_free(env); serd_node_free(typed); @@ -185,9 +180,9 @@ test_expand_uri(void) SerdEnv* const env = serd_env_new(base); SerdNode* const rel = serd_new_uri(SERD_STRING("rel")); - SerdNode* const rel_out = serd_env_expand(env, rel); + SerdNode* const rel_out = serd_env_expand_node(env, rel); SerdNode* const empty = serd_new_uri(SERD_EMPTY_STRING()); - SerdNode* const empty_out = serd_env_expand(env, empty); + SerdNode* const empty_out = serd_env_expand_node(env, empty); assert(!strcmp(serd_node_string(rel_out), "http://example.org/b/rel")); assert(!strcmp(serd_node_string(empty_out), "http://example.org/b/")); @@ -206,7 +201,7 @@ test_expand_empty_uri_ref(void) SerdNode* const rel = serd_new_uri(SERD_STRING("rel")); SerdEnv* const env = serd_env_new(base); - SerdNode* const rel_out = serd_env_expand(env, rel); + SerdNode* const rel_out = serd_env_expand_node(env, rel); assert(!strcmp(serd_node_string(rel_out), "http://example.org/b/rel")); serd_node_free(rel_out); @@ -221,7 +216,7 @@ test_expand_bad_uri(void) SerdNode* const bad_uri = serd_new_uri(SERD_STRING("rel")); SerdEnv* const env = serd_env_new(SERD_EMPTY_STRING()); - assert(!serd_env_expand(env, bad_uri)); + assert(!serd_env_expand_node(env, bad_uri)); serd_env_free(env); serd_node_free(bad_uri); @@ -233,30 +228,31 @@ test_expand_curie(void) static const SerdStringView name = SERD_STRING("eg.1"); static const SerdStringView eg = SERD_STRING(NS_EG); - SerdNode* const curie = serd_new_curie(SERD_STRING("eg.1:foo")); - SerdEnv* const env = serd_env_new(SERD_EMPTY_STRING()); + SerdEnv* const env = serd_env_new(SERD_EMPTY_STRING()); assert(!serd_env_set_prefix(env, name, eg)); - SerdNode* const curie_out = serd_env_expand(env, curie); - assert(curie_out); - assert(!strcmp(serd_node_string(curie_out), "http://example.org/foo")); - serd_node_free(curie_out); + SerdNode* const expanded = + serd_env_expand_curie(env, SERD_STRING("eg.1:foo")); + + assert(expanded); + assert(!strcmp(serd_node_string(expanded), "http://example.org/foo")); + serd_node_free(expanded); serd_env_free(env); - serd_node_free(curie); } static void test_expand_bad_curie(void) { - SerdNode* const curie = serd_new_curie(SERD_STRING("eg.1:foo")); - SerdEnv* const env = serd_env_new(SERD_EMPTY_STRING()); + SerdEnv* const env = serd_env_new(SERD_EMPTY_STRING()); - assert(!serd_env_expand(env, curie)); + assert(!serd_env_expand_curie(NULL, SERD_EMPTY_STRING())); + assert(!serd_env_expand_curie(NULL, SERD_STRING("what:ever"))); + assert(!serd_env_expand_curie(env, SERD_STRING("eg.1:foo"))); + assert(!serd_env_expand_curie(env, SERD_STRING("nocolon"))); serd_env_free(env); - serd_node_free(curie); } static void @@ -265,45 +261,13 @@ test_expand_blank(void) SerdNode* const blank = serd_new_blank(SERD_STRING("b1")); SerdEnv* const env = serd_env_new(SERD_EMPTY_STRING()); - assert(!serd_env_expand(env, blank)); + assert(!serd_env_expand_node(env, blank)); serd_env_free(env); serd_node_free(blank); } static void -test_qualify(void) -{ - static const SerdStringView eg = SERD_STRING(NS_EG); - - SerdNodes* const nodes = serd_nodes_new(); - - const SerdNode* const name = serd_nodes_string(nodes, SERD_STRING("eg")); - const SerdNode* const c1 = serd_nodes_curie(nodes, SERD_STRING("eg:foo")); - - const SerdNode* const u1 = - serd_nodes_uri(nodes, SERD_STRING("http://example.org/foo")); - - const SerdNode* const u2 = - serd_nodes_uri(nodes, SERD_STRING("http://drobilla.net/bar")); - - SerdEnv* const env = serd_env_new(SERD_EMPTY_STRING()); - - assert(!serd_env_set_prefix(env, serd_node_string_view(name), eg)); - - assert(!serd_env_expand(env, name)); - - SerdNode* const u1_out = serd_env_qualify(env, u1); - assert(serd_node_equals(u1_out, c1)); - serd_node_free(u1_out); - - assert(!serd_env_qualify(env, u2)); - - serd_env_free(env); - serd_nodes_free(nodes); -} - -static void test_equals(void) { static const SerdStringView name1 = SERD_STRING("n1"); @@ -355,7 +319,6 @@ main(void) test_expand_curie(); test_expand_bad_curie(); test_expand_blank(); - test_qualify(); test_equals(); return 0; } diff --git a/test/test_node.c b/test/test_node.c index 1775a669..8de81e08 100644 --- a/test/test_node.c +++ b/test/test_node.c @@ -422,10 +422,6 @@ test_node_equals(void) assert(serd_node_equals(lhs, lhs)); assert(!serd_node_equals(lhs, rhs)); - SerdNode* const qnode = serd_new_curie(SERD_STRING("foo:bar")); - assert(!serd_node_equals(lhs, qnode)); - serd_node_free(qnode); - assert(!serd_node_copy(NULL)); serd_node_free(lhs); diff --git a/test/test_nodes.c b/test/test_nodes.c index 9605f3b1..7e67eb30 100644 --- a/test/test_nodes.c +++ b/test/test_nodes.c @@ -150,24 +150,6 @@ test_uri(void) } static void -test_curie(void) -{ - static const SerdStringView string = SERD_STRING("eg:name"); - - SerdNodes* const nodes = serd_nodes_new(); - const SerdNode* const node = serd_nodes_curie(nodes, string); - - assert(node); - assert(serd_node_type(node) == SERD_CURIE); - assert(!serd_node_datatype(node)); - assert(!serd_node_language(node)); - assert(serd_node_length(node) == string.len); - assert(!strcmp(serd_node_string(node), string.buf)); - - serd_nodes_free(nodes); -} - -static void test_blank(void) { static const SerdStringView string = SERD_STRING("b42"); @@ -228,7 +210,6 @@ main(void) test_plain_literal(); test_typed_literal(); test_uri(); - test_curie(); test_blank(); test_deref(); test_get(); diff --git a/test/test_overflow.c b/test/test_overflow.c index 02b71008..d94d7e90 100644 --- a/test/test_overflow.c +++ b/test/test_overflow.c @@ -196,6 +196,10 @@ test_turtle_overflow(void) "@base <http://example.org/ns/test> .\n" "<http://example.org/s> <http://example.org/p> <rel> .", + // NOLINTNEXTLINE(bugprone-suspicious-missing-comma) + "@base <http://example.org/ns/test> .\n" + "<http://example.org/s> <http://example.org/p> <rel> .", + NULL, }; diff --git a/test/test_writer.c b/test/test_writer.c index 0ced87d6..c9a77354 100644 --- a/test/test_writer.c +++ b/test/test_writer.c @@ -263,7 +263,8 @@ test_write_empty_syntax(void) const SerdNode* p = serd_nodes_uri(nodes, SERD_STRING("http://example.org/p")); - const SerdNode* o = serd_nodes_curie(nodes, SERD_STRING("eg:o")); + const SerdNode* o = + serd_nodes_uri(nodes, SERD_STRING("http://example.org/o")); SerdBuffer buffer = {NULL, 0}; SerdByteSink* byte_sink = serd_byte_sink_new_buffer(&buffer); @@ -311,6 +312,7 @@ test_write_bad_uri(void) const SerdStatus st = serd_sink_write(serd_writer_sink(writer), 0u, s, p, rel, NULL); + assert(st); assert(st == SERD_ERR_BAD_ARG); |