q66 pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=d6055e952782cfe9b570eb414417f60cb4538f83

commit d6055e952782cfe9b570eb414417f60cb4538f83
Author: Vitor Sousa <vitorsousasi...@gmail.com>
Date:   Wed Oct 21 18:14:22 2015 +0100

    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
---
 src/tests/eolian/data/struct.eo    |  3 +++
 src/tests/eolian/data/struct_ref.c |  2 ++
 src/tests/eolian/eolian_parsing.c  | 10 ++++++++++
 3 files changed, 15 insertions(+)

diff --git a/src/tests/eolian/data/struct.eo b/src/tests/eolian/data/struct.eo
index 15010a6..cbdec54 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 af162a8..9fdecb2 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 6717e65..6b37c4d 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

-- 


Reply via email to