aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test_uri.c16
1 files changed, 7 insertions, 9 deletions
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 <string.h>
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 <path>", "a/relative%20%3Cpath%3E", NULL);
// Missing trailing '/' after authority