summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hirt <daniel.hirt@samsung.com>2015-02-05 15:01:12 +0100
committerCedric BAIL <cedric@osg.samsung.com>2015-02-05 15:37:15 +0100
commitd503dbeed1b2e26272893f86c37df3eaeb270e30 (patch)
tree22a23a1f0e4e6af0289489edfa92cc555c7b6360
parente1eff60c802a25772595edd39ca1ffe35fea1894 (diff)
eina: Eina_File - add test case for path resolution.
Summary: This is a follow-up to the 7cbf22212f0c3292dbd1919f4cdd15802e9b9d84 revert commit. It's a bit late, as the issue has already been fixed with the later 7143bd7fb5196f97003216528bfbfb8bec4826bd 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>
-rw-r--r--src/tests/eina/eina_test_file.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/tests/eina/eina_test_file.c b/src/tests/eina/eina_test_file.c
index 17518bd512..8dc123a4ab 100644
--- a/src/tests/eina/eina_test_file.c
+++ b/src/tests/eina/eina_test_file.c
@@ -474,6 +474,30 @@ START_TEST(eina_test_file_thread)
474} 474}
475END_TEST 475END_TEST
476 476
477static const struct {
478 const char *test;
479 const char *result;
480} sanitize[] = {
481 { "/home/mydir/../myfile", "/home/myfile" }
482};
483
484START_TEST(eina_test_file_path)
485{
486 unsigned int i;
487 char *path;
488
489 fail_if(!eina_init());
490
491 for (i = 0; i < sizeof (sanitize) / sizeof (sanitize[0]); i++)
492 {
493 path = eina_file_path_sanitize(sanitize[i].test);
494 fail_if(strcmp(path, sanitize[i].result));
495 }
496
497 eina_shutdown();
498}
499END_TEST
500
477void 501void
478eina_test_file(TCase *tc) 502eina_test_file(TCase *tc)
479{ 503{
@@ -483,5 +507,5 @@ eina_test_file(TCase *tc)
483 tcase_add_test(tc, eina_file_map_new_test); 507 tcase_add_test(tc, eina_file_map_new_test);
484 tcase_add_test(tc, eina_test_file_virtualize); 508 tcase_add_test(tc, eina_test_file_virtualize);
485 tcase_add_test(tc, eina_test_file_thread); 509 tcase_add_test(tc, eina_test_file_thread);
510 tcase_add_test(tc, eina_test_file_path);
486} 511}
487