X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Funit%2Ftest_utils_expand_path.c;h=bb460a2a18caec9abe1a373f5162211e0fe07daa;hp=27bfe8fd2f92e81b313315c11a709fa3b150ac5b;hb=ab5ff479ba76b1701715f8801861e7dce16b4a89;hpb=cc7f9e363bf9230260b2ef27c84e24f75a7535c0 diff --git a/tests/unit/test_utils_expand_path.c b/tests/unit/test_utils_expand_path.c index 27bfe8fd2..bb460a2a1 100644 --- a/tests/unit/test_utils_expand_path.c +++ b/tests/unit/test_utils_expand_path.c @@ -55,6 +55,8 @@ static struct valid_test_input valid_tests_inputs[] = { { "..", "..", "" }, { "./", ".", "/" }, { ".", ".", "" }, + { "/../a/b/c/d/e", "", "/a/b/c/d/e" }, + { "/a/b/c/d/../../../../../e", "", "/e" }, }; char **valid_tests_expected_results; static const int num_valid_tests = @@ -63,8 +65,6 @@ static const int num_valid_tests = /* Invalid test cases */ static char *invalid_tests_inputs[] = { NULL, - "/../a/b/c/d/e", - "/a/b/c/d/../../../../../e", }; static const int num_invalid_tests = sizeof(invalid_tests_inputs) / sizeof(invalid_tests_inputs[0]); @@ -135,7 +135,8 @@ static void test_utils_expand_path(void) sprintf(name, "valid test case: %s", valid_tests_inputs[i].input); result = utils_expand_path(valid_tests_inputs[i].input); - ok(strcmp(result, valid_tests_expected_results[i]) == 0, name); + ok(result != NULL && + strcmp(result, valid_tests_expected_results[i]) == 0, name); free(result); }