forked from enlightenment/efl
eina: Eina_File - add test case for path resolution.
Summary: This is a follow-up to the7cbf22212f
revert commit. It's a bit late, as the issue has already been fixed with the later7143bd7fb5
commit. This test checks eina_file_sanitize "../" case with absolute paths (i.e. that start with "/"), and should fail prior the revert mentioned above. Should come up with more tests like this one. Reviewers: stefan_schmidt, cedric Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D1937 Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This commit is contained in:
parent
e1eff60c80
commit
d503dbeed1
|
@ -474,6 +474,30 @@ START_TEST(eina_test_file_thread)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
static const struct {
|
||||
const char *test;
|
||||
const char *result;
|
||||
} sanitize[] = {
|
||||
{ "/home/mydir/../myfile", "/home/myfile" }
|
||||
};
|
||||
|
||||
START_TEST(eina_test_file_path)
|
||||
{
|
||||
unsigned int i;
|
||||
char *path;
|
||||
|
||||
fail_if(!eina_init());
|
||||
|
||||
for (i = 0; i < sizeof (sanitize) / sizeof (sanitize[0]); i++)
|
||||
{
|
||||
path = eina_file_path_sanitize(sanitize[i].test);
|
||||
fail_if(strcmp(path, sanitize[i].result));
|
||||
}
|
||||
|
||||
eina_shutdown();
|
||||
}
|
||||
END_TEST
|
||||
|
||||
void
|
||||
eina_test_file(TCase *tc)
|
||||
{
|
||||
|
@ -483,5 +507,5 @@ eina_test_file(TCase *tc)
|
|||
tcase_add_test(tc, eina_file_map_new_test);
|
||||
tcase_add_test(tc, eina_test_file_virtualize);
|
||||
tcase_add_test(tc, eina_test_file_thread);
|
||||
tcase_add_test(tc, eina_test_file_path);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue