aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-14 16:02:35 +0200
committerDavid Robillard <d@drobilla.net>2020-08-14 19:07:52 +0200
commita9a6a4e417189b53ee559278be5d242986120422 (patch)
tree76b4df6c11520af0f2998cdd1b1914122524458f /tests
parent1172f40724d2774be6c9f089c46ef377f2325957 (diff)
downloadserd-a9a6a4e417189b53ee559278be5d242986120422.tar.gz
serd-a9a6a4e417189b53ee559278be5d242986120422.tar.bz2
serd-a9a6a4e417189b53ee559278be5d242986120422.zip
Fix Wswitch-enum warnings
Diffstat (limited to 'tests')
-rw-r--r--tests/serd_test.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/serd_test.c b/tests/serd_test.c
index 5e67eca1..2bf249b7 100644
--- a/tests/serd_test.c
+++ b/tests/serd_test.c
@@ -486,6 +486,10 @@ test_env(void)
const SerdNode lit = serd_node_from_string(SERD_LITERAL, USTR("hello"));
assert(serd_env_set_prefix(env, &b, &lit));
+ const SerdNode blank = serd_node_from_string(SERD_BLANK, USTR("b1"));
+ const SerdNode xblank = serd_env_expand_node(env, &blank);
+ assert(serd_node_equals(&xblank, &SERD_NODE_NULL));
+
int n_prefixes = 0;
serd_env_set_prefix_from_strings(env, USTR("eg.2"), USTR("http://example.org/"));
serd_env_foreach(env, count_prefixes, &n_prefixes);
@@ -588,6 +592,23 @@ test_writer(const char* const path)
assert(!strcmp((const char*)out, "@base <http://example.org/base> .\n"));
serd_free(out);
+
+ // Test writing empty node
+ SerdNode nothing = serd_node_from_string(SERD_NOTHING, USTR(""));
+ FILE* const empty = tmpfile();
+
+ writer = serd_writer_new(
+ SERD_TURTLE, (SerdStyle)0, env, NULL, serd_file_sink, empty);
+
+ // FIXME: error handling
+ serd_writer_write_statement(writer, 0, NULL,
+ &s, &p, &nothing, NULL, NULL);
+
+ assert((size_t)ftell(empty) == strlen("<>\n\t<http://example.org/pred> "));
+
+ serd_writer_free(writer);
+ fclose(empty);
+
serd_env_free(env);
fclose(fd);
}