From c75415ae369f5988975bc6e40378d9de5e2ccef0 Mon Sep 17 00:00:00 2001 From: Cedric BAIL Date: Fri, 10 May 2019 14:42:57 -0700 Subject: [PATCH] eina: add tests for the new Vpath syntax. Reviewed-by: Marcel Hollerbach Differential Revision: https://phab.enlightenment.org/D8884 --- src/tests/eina/eina_test_vpath.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/tests/eina/eina_test_vpath.c b/src/tests/eina/eina_test_vpath.c index 851c47ee2b..cad61bd831 100644 --- a/src/tests/eina/eina_test_vpath.c +++ b/src/tests/eina/eina_test_vpath.c @@ -21,8 +21,8 @@ EFL_START_TEST(eina_test_vpath_valid) snprintf(test, sizeof(test), "%s/bla", eina_environment_home_get()); ck_assert_str_eq(eina_vpath_resolve("(:home:)/bla"), test); + ck_assert_str_eq(eina_vpath_resolve("${home}/bla"), test); ck_assert_str_eq(eina_vpath_resolve("/test/for/the/last/case"), "/test/for/the/last/case"); - } EFL_END_TEST @@ -33,6 +33,13 @@ EFL_START_TEST(eina_test_vpath_invalid) ck_assert_ptr_eq(eina_vpath_resolve("(:"), NULL); ck_assert_ptr_eq(eina_vpath_resolve("(:home:)"), NULL); ck_assert_ptr_eq(eina_vpath_resolve("(:wrong_meta_key:)/"), NULL); + ck_assert_ptr_eq(eina_vpath_resolve("${asdfasdfafasdf"), NULL); + ck_assert_ptr_eq(eina_vpath_resolve("${missing_slash}"), NULL); + ck_assert_ptr_eq(eina_vpath_resolve("${"), NULL); + ck_assert_ptr_eq(eina_vpath_resolve("${home}"), NULL); + ck_assert_ptr_eq(eina_vpath_resolve("${wrong_meta_key}/"), NULL); + ck_assert_ptr_eq(eina_vpath_resolve("${home:)"), NULL); + ck_assert_ptr_eq(eina_vpath_resolve("${wrong_meta_key:)/"), NULL); } EFL_END_TEST @@ -47,6 +54,10 @@ EFL_START_TEST(eina_test_vpath_snprintf) eina_vpath_resolve_snprintf(buf, sizeof(buf), "(:home:)/%s/%d/", string, x); snprintf(cmp, sizeof(cmp), "%s/%s/%d/", eina_environment_home_get(), string, x); ck_assert_str_eq(buf, cmp); + + eina_vpath_resolve_snprintf(buf, sizeof(buf), "${home}/%s/%d/", string, x); + snprintf(cmp, sizeof(cmp), "%s/%s/%d/", eina_environment_home_get(), string, x); + ck_assert_str_eq(buf, cmp); } EFL_END_TEST