diff options
author | Vitor Sousa <vitorsousasilva@gmail.com> | 2015-10-21 18:14:22 +0100 |
---|---|---|
committer | Daniel Kolesa <d.kolesa@osg.samsung.com> | 2015-10-21 18:15:55 +0100 |
commit | d6055e952782cfe9b570eb414417f60cb4538f83 (patch) | |
tree | 0655a01cdf472b0ef7bdb4cffd540e7cb8962224 | |
parent | 8b489064019622cbe1a1f70cb09d7caf158ac893 (diff) | |
download | efl-d6055e952782cfe9b570eb414417f60cb4538f83.tar.gz |
eolian: Test recognition of struct types used in methods
Summary:
Add code to unit test to check if Eolian correctly recognize a struct
name as a struct type when it is used in a method.
Add new method to struct.eo to create this test.
Update struct_ref.c accordingly.
Reviewers: tasn, q66
Differential Revision: https://phab.enlightenment.org/D3213
-rw-r--r-- | src/tests/eolian/data/struct.eo | 3 | ||||
-rw-r--r-- | src/tests/eolian/data/struct_ref.c | 2 | ||||
-rw-r--r-- | src/tests/eolian/eolian_parsing.c | 10 |
3 files changed, 15 insertions, 0 deletions
diff --git a/src/tests/eolian/data/struct.eo b/src/tests/eolian/data/struct.eo index 15010a65dc..cbdec54fce 100644 --- a/src/tests/eolian/data/struct.eo +++ b/src/tests/eolian/data/struct.eo @@ -23,5 +23,8 @@ class Struct { } return: own(char*); } + bar { + return: Named *; + } } } diff --git a/src/tests/eolian/data/struct_ref.c b/src/tests/eolian/data/struct_ref.c index af162a831f..9fdecb267e 100644 --- a/src/tests/eolian/data/struct_ref.c +++ b/src/tests/eolian/data/struct_ref.c @@ -39,5 +39,7 @@ EAPI const Eo_Class *struct_class_get(void) EINA_CONST; */ EOAPI char * struct_foo(int idx); +EOAPI Named * struct_bar(void); + #endif diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c index 6717e65860..6b37c4d335 100644 --- a/src/tests/eolian/eolian_parsing.c +++ b/src/tests/eolian/eolian_parsing.c @@ -647,6 +647,7 @@ START_TEST(eolian_struct) const Eolian_Struct_Type_Field *field = NULL; const Eolian_Type *type = NULL, *ftype = NULL; const Eolian_Class *class; + const Eolian_Function *func; const char *type_name; const char *file; @@ -697,6 +698,15 @@ START_TEST(eolian_struct) fail_if(!(type = eolian_type_struct_get_by_name("Opaque"))); fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_STRUCT_OPAQUE); + /* use in function */ + fail_if(!(func = eolian_class_function_get_by_name(class, "bar", EOLIAN_METHOD))); + fail_if(!(type = eolian_function_return_type_get(func, EOLIAN_METHOD))); + fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_POINTER); + fail_if(!(type = eolian_type_base_type_get(type))); + fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_REGULAR); + fail_if(!(type = eolian_type_base_type_get(type))); + fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_STRUCT); + eolian_shutdown(); } END_TEST |