aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-11-23 14:49:49 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-11-23 15:14:41 +0900
commitd49c544e81c0d4da6d4c585b4033f9c5c6785bb4 (patch)
tree0119911d141cd4c3205dfab255e100ff8de94a37 /src/tests
parentbg: Remove trailing \n in ERR message (diff)
downloadefl-d49c544e81c0d4da6d4c585b4033f9c5c6785bb4.tar.gz
eolian: Add API's for part enumeration
@feature
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/eolian/data/parts.eo7
-rw-r--r--src/tests/eolian/eolian_parsing.c46
2 files changed, 53 insertions, 0 deletions
diff --git a/src/tests/eolian/data/parts.eo b/src/tests/eolian/data/parts.eo
new file mode 100644
index 0000000000..286d1e432f
--- /dev/null
+++ b/src/tests/eolian/data/parts.eo
@@ -0,0 +1,7 @@
+class Parts (Override, Base) {
+ parts {
+ part1: Override; [[Part 1]]
+ part2: Base; [[Part 2]]
+ part3: Parts; [[Part 3]]
+ }
+}
diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c
index 9297932451..ce18e4e137 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -1544,6 +1544,51 @@ START_TEST(eolian_function_as_arguments)
}
END_TEST
+START_TEST(eolian_parts)
+{
+ const Eolian_Unit *unit;
+ const Eolian_Class *cls;
+ Eina_Iterator *iter;
+ Eolian_Part *part;
+ int i = 0;
+
+ static const char *part_classes[] = {
+ "Override", "Base", "Parts"
+ };
+
+ eolian_init();
+
+ fail_if(!eolian_directory_scan(PACKAGE_DATA_DIR"/data"));
+
+ fail_if(!(unit = eolian_file_parse(PACKAGE_DATA_DIR"/data/parts.eo")));
+
+ fail_if(!(cls = eolian_class_get_by_name(unit, "Parts")));
+
+ fail_if(!(iter = eolian_class_parts_get(cls)));
+
+ EINA_ITERATOR_FOREACH(iter, part)
+ {
+ const Eolian_Documentation *doc;
+ const Eolian_Class *klass;
+ char pattern[24];
+
+ sprintf(pattern, "part%d", i + 1);
+ ck_assert_str_eq(pattern, eolian_part_name_get(part));
+
+ sprintf(pattern, "Part %d", i + 1);
+ fail_if(!(doc = eolian_part_documentation_get(part)));
+ ck_assert_str_eq(pattern, eolian_documentation_summary_get(doc));
+
+ fail_if(!(klass = eolian_part_class_get(part)));
+ ck_assert_str_eq(part_classes[i], eolian_class_name_get(klass));
+ i++;
+ }
+ eina_iterator_free(iter);
+
+ eolian_shutdown();
+}
+END_TEST
+
void eolian_parsing_test(TCase *tc)
{
tcase_add_test(tc, eolian_simple_parsing);
@@ -1567,4 +1612,5 @@ void eolian_parsing_test(TCase *tc)
tcase_add_test(tc, eolian_docs);
tcase_add_test(tc, eolian_function_types);
tcase_add_test(tc, eolian_function_as_arguments);
+ tcase_add_test(tc, eolian_parts);
}