From 4c6600603704454df7c3a21039111f195d2d0ff1 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 3 Jan 2017 15:53:48 -0500 Subject: Test file URI escaping --- tests/serd_test.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tests/serd_test.c') 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); -- cgit v1.2.1