aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-01-03 15:53:48 -0500
committerDavid Robillard <d@drobilla.net>2017-01-03 15:53:48 -0500
commit4c6600603704454df7c3a21039111f195d2d0ff1 (patch)
treef4891ba5a03d6d1696bff6ed2e7d1e8a878bffbc /tests
parentc52a4f48e4fc945028cafb7189a8dd38d6a55abe (diff)
downloadserd-4c6600603704454df7c3a21039111f195d2d0ff1.tar.gz
serd-4c6600603704454df7c3a21039111f195d2d0ff1.tar.bz2
serd-4c6600603704454df7c3a21039111f195d2d0ff1.zip
Test file URI escaping
Diffstat (limited to 'tests')
-rw-r--r--tests/serd_test.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/serd_test.c b/tests/serd_test.c
index 7fb649c3..f03b1436 100644
--- a/tests/serd_test.c
+++ b/tests/serd_test.c
@@ -332,6 +332,23 @@ main(void)
free(out_path);
serd_node_free(&file_node);
+ // File URI with space and no escaping
+ path_str = USTR("a/relative path");
+ file_node = serd_node_new_file_uri(path_str, 0, 0, false);
+ out_path = serd_file_uri_parse(file_node.buf, &hostname);
+ if (strcmp((const char*)file_node.buf, "a/relative path")) {
+ return failure("Bad URI %s\n", file_node.buf);
+ } else if (hostname) {
+ return failure("hostname `%s' shouldn't exist\n", hostname);
+ } else if (strcmp((const char*)path_str, (const char*)out_path)) {
+ return failure("path=>URI=>path failure %s => %s => %s\n",
+ path_str, file_node.buf, out_path);
+ }
+ free(hostname);
+ free(out_path);
+ serd_node_free(&file_node);
+
+ // File URI with space and escaping
path_str = USTR("a/relative path");
file_node = serd_node_new_file_uri(path_str, 0, 0, false);
out_path = serd_file_uri_parse(file_node.buf, &hostname);