From 79367b620492ac941f41c61adbffc29867ac0998 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 10 Nov 2020 08:20:52 +0100 Subject: Clean up file URI tests --- test/test_uri.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/test_uri.c b/test/test_uri.c index 6eac9bb5..88aa342c 100644 --- a/test/test_uri.c +++ b/test/test_uri.c @@ -26,10 +26,10 @@ #include static void -test_file_uri(const char* hostname, - const char* path, - const char* expected_uri, - const char* expected_path) +test_file_uri(const char* const hostname, + const char* const path, + const char* const expected_uri, + const char* expected_path) { if (!expected_path) { expected_path = path; @@ -43,6 +43,7 @@ test_file_uri(const char* hostname, char* out_path = serd_parse_file_uri(node_str, &out_hostname); assert(!strcmp(node_str, expected_uri)); assert((hostname && out_hostname) || (!hostname && !out_hostname)); + assert(!hostname || !strcmp(hostname, out_hostname)); assert(!strcmp(out_path, expected_path)); serd_free(out_path); @@ -54,12 +55,9 @@ static void test_uri_parsing(void) { test_file_uri(NULL, "C:/My 100%", "file:///C:/My%20100%%", NULL); - test_file_uri("ahost", - "C:\\Pointless Space", - "file://ahost/C:/Pointless%20Space", - "C:/Pointless Space"); + test_file_uri("me", "C:\\Sp Ace", "file://me/C:/Sp%20Ace", "C:/Sp Ace"); test_file_uri(NULL, "/foo/bar", "file:///foo/bar", NULL); - test_file_uri("bhost", "/foo/bar", "file://bhost/foo/bar", NULL); + test_file_uri("you", "/foo/bar", "file://you/foo/bar", NULL); test_file_uri(NULL, "a/relative ", "a/relative%20%3Cpath%3E", NULL); // Missing trailing '/' after authority -- cgit v1.2.1