summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVitor Sousa <vitorsousasilva@gmail.com>2015-10-21 18:14:22 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2015-10-21 18:15:55 +0100
commitd6055e952782cfe9b570eb414417f60cb4538f83 (patch)
tree0655a01cdf472b0ef7bdb4cffd540e7cb8962224
parent8b489064019622cbe1a1f70cb09d7caf158ac893 (diff)
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.eo3
-rw-r--r--src/tests/eolian/data/struct_ref.c2
-rw-r--r--src/tests/eolian/eolian_parsing.c10
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 {
23 } 23 }
24 return: own(char*); 24 return: own(char*);
25 } 25 }
26 bar {
27 return: Named *;
28 }
26 } 29 }
27} 30}
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;
39 */ 39 */
40EOAPI char * struct_foo(int idx); 40EOAPI char * struct_foo(int idx);
41 41
42EOAPI Named * struct_bar(void);
43
42 44
43#endif 45#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)
647 const Eolian_Struct_Type_Field *field = NULL; 647 const Eolian_Struct_Type_Field *field = NULL;
648 const Eolian_Type *type = NULL, *ftype = NULL; 648 const Eolian_Type *type = NULL, *ftype = NULL;
649 const Eolian_Class *class; 649 const Eolian_Class *class;
650 const Eolian_Function *func;
650 const char *type_name; 651 const char *type_name;
651 const char *file; 652 const char *file;
652 653
@@ -697,6 +698,15 @@ START_TEST(eolian_struct)
697 fail_if(!(type = eolian_type_struct_get_by_name("Opaque"))); 698 fail_if(!(type = eolian_type_struct_get_by_name("Opaque")));
698 fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_STRUCT_OPAQUE); 699 fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_STRUCT_OPAQUE);
699 700
701 /* use in function */
702 fail_if(!(func = eolian_class_function_get_by_name(class, "bar", EOLIAN_METHOD)));
703 fail_if(!(type = eolian_function_return_type_get(func, EOLIAN_METHOD)));
704 fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_POINTER);
705 fail_if(!(type = eolian_type_base_type_get(type)));
706 fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_REGULAR);
707 fail_if(!(type = eolian_type_base_type_get(type)));
708 fail_if(eolian_type_type_get(type) != EOLIAN_TYPE_STRUCT);
709
700 eolian_shutdown(); 710 eolian_shutdown();
701} 711}
702END_TEST 712END_TEST