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)
downloadefl-d503dbeed1b2e26272893f86c37df3eaeb270e30.tar.gz
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)
}
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);
}
-