From b58174f0ebe31fb56fe891bfbcf10979079053e3 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 18 Dec 2020 16:54:14 +0100 Subject: Add lilv_path_absolute_child() --- test/test_filesystem.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/test_filesystem.c') diff --git a/test/test_filesystem.c b/test/test_filesystem.c index a3288ed..01ca5ae 100644 --- a/test/test_filesystem.c +++ b/test/test_filesystem.c @@ -104,6 +104,26 @@ test_path_absolute(void) free(cwd); } +static void +test_path_absolute_child(void) +{ + const char* const parent = "/parent"; + const char* const short_path = "a"; + const char* const long_path = "a/b/c"; + + char* const expected_short = lilv_path_join(parent, short_path); + char* const expected_long = lilv_path_join(parent, long_path); + + assert(equals(lilv_path_absolute_child(short_path, parent), + expected_short)); + + assert(equals(lilv_path_absolute_child(long_path, parent), + expected_long)); + + free(expected_long); + free(expected_short); +} + static void test_path_relative_to(void) { @@ -478,6 +498,7 @@ main(void) test_path_is_child(); test_path_current(); test_path_absolute(); + test_path_absolute_child(); test_path_relative_to(); test_path_parent(); test_path_filename(); -- cgit v1.2.1