diff options
author | David Robillard <d@drobilla.net> | 2017-01-03 15:53:48 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2017-01-03 15:53:48 -0500 |
commit | 4c6600603704454df7c3a21039111f195d2d0ff1 (patch) | |
tree | f4891ba5a03d6d1696bff6ed2e7d1e8a878bffbc /tests/serd_test.c | |
parent | c52a4f48e4fc945028cafb7189a8dd38d6a55abe (diff) | |
download | serd-4c6600603704454df7c3a21039111f195d2d0ff1.tar.gz serd-4c6600603704454df7c3a21039111f195d2d0ff1.tar.bz2 serd-4c6600603704454df7c3a21039111f195d2d0ff1.zip |
Test file URI escaping
Diffstat (limited to 'tests/serd_test.c')
-rw-r--r-- | tests/serd_test.c | 17 |
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); |