aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-11-10 08:20:52 +0100
committerDavid Robillard <d@drobilla.net>2021-03-08 23:23:06 -0500
commit79367b620492ac941f41c61adbffc29867ac0998 (patch)
tree4e88bd0851e4572ec860a55f4aee0f6e500282b0
parentaaee2ac6d1149027d4eef4708e09a33f9a2f8649 (diff)
downloadserd-79367b620492ac941f41c61adbffc29867ac0998.tar.gz
serd-79367b620492ac941f41c61adbffc29867ac0998.tar.bz2
serd-79367b620492ac941f41c61adbffc29867ac0998.zip
Clean up file URI tests
-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