diff options
author | David Robillard <d@drobilla.net> | 2022-11-24 15:25:24 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-11-24 15:55:08 -0500 |
commit | 2a529fc48c6889570ae74a29953c554968daa021 (patch) | |
tree | 04d322238b9caebbd9990cf47993cb2e8aa53039 /test/test_uri.c | |
parent | 2a7fc07c2371c2bbfba74d2a97c0467f9f89a87d (diff) | |
download | serd-2a529fc48c6889570ae74a29953c554968daa021.tar.gz serd-2a529fc48c6889570ae74a29953c554968daa021.tar.bz2 serd-2a529fc48c6889570ae74a29953c554968daa021.zip |
Avoid mutation in test
Diffstat (limited to 'test/test_uri.c')
-rw-r--r-- | test/test_uri.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/test/test_uri.c b/test/test_uri.c index ea66d0f1..a333ff7d 100644 --- a/test/test_uri.c +++ b/test/test_uri.c @@ -45,32 +45,36 @@ test_file_uri(const char* hostname, static void test_uri_to_path(void) { - const uint8_t* uri = (const uint8_t*)"file:///home/user/foo.ttl"; - assert(!strcmp((const char*)serd_uri_to_path(uri), "/home/user/foo.ttl")); + assert(!strcmp( + (const char*)serd_uri_to_path((const uint8_t*)"file:///home/user/foo.ttl"), + "/home/user/foo.ttl")); - uri = (const uint8_t*)"file://localhost/home/user/foo.ttl"; - assert(!strcmp((const char*)serd_uri_to_path(uri), "/home/user/foo.ttl")); + assert(!strcmp((const char*)serd_uri_to_path( + (const uint8_t*)"file://localhost/home/user/foo.ttl"), + "/home/user/foo.ttl")); - uri = (const uint8_t*)"file:illegal/file/uri"; - assert(!serd_uri_to_path(uri)); + assert(!serd_uri_to_path((const uint8_t*)"file:illegal/file/uri")); - uri = (const uint8_t*)"file:///c:/awful/system"; - assert(!strcmp((const char*)serd_uri_to_path(uri), "c:/awful/system")); + assert(!strcmp( + (const char*)serd_uri_to_path((const uint8_t*)"file:///c:/awful/system"), + "c:/awful/system")); - uri = (const uint8_t*)"file:///c:awful/system"; - assert(!strcmp((const char*)serd_uri_to_path(uri), "/c:awful/system")); + assert(!strcmp( + (const char*)serd_uri_to_path((const uint8_t*)"file:///c:awful/system"), + "/c:awful/system")); - uri = (const uint8_t*)"file:///0/1"; - assert(!strcmp((const char*)serd_uri_to_path(uri), "/0/1")); + assert(!strcmp((const char*)serd_uri_to_path((const uint8_t*)"file:///0/1"), + "/0/1")); - uri = (const uint8_t*)"C:\\Windows\\Sucks"; - assert(!strcmp((const char*)serd_uri_to_path(uri), "C:\\Windows\\Sucks")); + assert( + !strcmp((const char*)serd_uri_to_path((const uint8_t*)"C:\\Windows\\Sucks"), + "C:\\Windows\\Sucks")); - uri = (const uint8_t*)"C|/Windows/Sucks"; - assert(!strcmp((const char*)serd_uri_to_path(uri), "C|/Windows/Sucks")); + assert( + !strcmp((const char*)serd_uri_to_path((const uint8_t*)"C|/Windows/Sucks"), + "C|/Windows/Sucks")); - uri = (const uint8_t*)"http://example.org/path"; - assert(!serd_uri_to_path(uri)); + assert(!serd_uri_to_path((const uint8_t*)"http://example.org/path")); } #if defined(__GNUC__) |