From ab89a23a350016ba6633d4584584f23767977fb4 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 30 Sep 2018 17:31:10 +0200 Subject: Add serd_env_copy() and serd_env_equals() --- test/test_env.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test') diff --git a/test/test_env.c b/test/test_env.c index da53df45..c00ae37b 100644 --- a/test/test_env.c +++ b/test/test_env.c @@ -93,11 +93,34 @@ test_env(void) SerdNode* qualified = serd_env_qualify(env, foo_u); assert(serd_node_equals(qualified, foo_c)); + SerdEnv* env_copy = serd_env_copy(env); + assert(serd_env_equals(env, env_copy)); + assert(!serd_env_equals(env, NULL)); + assert(!serd_env_equals(NULL, env)); + assert(serd_env_equals(NULL, NULL)); + + SerdNode* qualified2 = serd_env_expand(env_copy, foo_u); + assert(serd_node_equals(qualified, foo_c)); + serd_node_free(qualified2); + + serd_env_set_prefix(env_copy, + SERD_STATIC_STRING("test"), + SERD_STATIC_STRING("http://example.org/test")); + + assert(!serd_env_equals(env, env_copy)); + + serd_env_set_prefix(env, + SERD_STATIC_STRING("test2"), + SERD_STATIC_STRING("http://example.org/test")); + + assert(!serd_env_equals(env, env_copy)); + serd_node_free(qualified); serd_sink_free(count_prefixes_sink); serd_node_free(foo_c); serd_node_free(foo_u); serd_node_free(b); + serd_env_free(env_copy); serd_env_free(env); } -- cgit v1.2.1