diff options
author | David Robillard <d@drobilla.net> | 2023-03-29 07:28:19 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-12-02 16:27:02 -0500 |
commit | fff826f406e0b9975fd8672041e50dd1a342339f (patch) | |
tree | 03a22b89b83a8b26fdf18dd8700e51833b488d81 /test/test_env.c | |
parent | 94d3433dcf0e77d2c867c9a2dd6928acfea4184c (diff) | |
download | serd-fff826f406e0b9975fd8672041e50dd1a342339f.tar.gz serd-fff826f406e0b9975fd8672041e50dd1a342339f.tar.bz2 serd-fff826f406e0b9975fd8672041e50dd1a342339f.zip |
Simplify URI API and implementation
Diffstat (limited to 'test/test_env.c')
-rw-r--r-- | test/test_env.c | 11 |
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); |