Tests: move invalid tests in test_utils_expand_path that should be valid
[lttng-tools.git] / tests / unit / test_utils_expand_path.c
index 27bfe8fd2f92e81b313315c11a709fa3b150ac5b..bb460a2a18caec9abe1a373f5162211e0fe07daa 100644 (file)
@@ -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);
        }
This page took 0.023224 seconds and 4 git commands to generate.