aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_env.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_env.c')
-rw-r--r--test/test_env.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/test_env.c b/test/test_env.c
index 198c7e9b..b1371d16 100644
--- a/test/test_env.c
+++ b/test/test_env.c
@@ -26,6 +26,7 @@ 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);
@@ -41,9 +42,12 @@ 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_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));
@@ -76,6 +80,12 @@ test_env(void)
assert(!serd_env_set_base_uri(env, u));
assert(serd_node_equals(serd_env_base_uri(env, NULL), 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));
@@ -84,6 +94,7 @@ test_env(void)
serd_node_free(badpre);
serd_node_free(s);
serd_node_free(c);
+ serd_node_free(e);
serd_node_free(b);
serd_node_free(u);