jackdanielz pushed a commit to branch master.

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

commit 946f845a2b92299846fa9b13610e588fde7339c7
Author: Daniel Zaoui <daniel.za...@samsung.com>
Date:   Wed May 21 11:39:16 2014 +0300

    Eolian/Tests: add test for consts
    
    This tests checks the different 'const' possibilities in the .eo file
    and their good parsing.
---
 src/Makefile_Eolian.am            |  3 ++-
 src/tests/eolian/data/consts.eo   | 28 ++++++++++++++++++++++++++++
 src/tests/eolian/eolian_parsing.c | 28 ++++++++++++++++++++++++++++
 3 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/src/Makefile_Eolian.am b/src/Makefile_Eolian.am
index a945ea1..e4a189f 100644
--- a/src/Makefile_Eolian.am
+++ b/src/Makefile_Eolian.am
@@ -93,5 +93,6 @@ tests/eolian/data/typedef.eo \
 tests/eolian/data/object_impl.eo \
 tests/eolian/data/object_impl_ref.c \
 tests/eolian/data/object_impl_add.eo \
-tests/eolian/data/object_impl_add_ref.c
+tests/eolian/data/object_impl_add_ref.c \
+tests/eolian/data/consts.eo
 
diff --git a/src/tests/eolian/data/consts.eo b/src/tests/eolian/data/consts.eo
new file mode 100644
index 0000000..b139317
--- /dev/null
+++ b/src/tests/eolian/data/consts.eo
@@ -0,0 +1,28 @@
+class Const {
+   properties {
+      a {
+         set {
+            return Eina_Bool (EINA_TRUE); /*@ comment for property set return 
*/
+         }
+         get {
+            buffer: const;
+         }
+         values {
+            int value; /*@ Value description */
+            char *buffer;
+         }
+      }
+   }
+   methods {
+      foo {
+         /*@ comment foo */
+         params {
+            @in int a; /*@ a */
+            @inout char *b;
+            @out double c;
+         }
+         const;
+         return char *(NULL); /*@ comment for method return */
+      }
+   }
+};
diff --git a/src/tests/eolian/eolian_parsing.c 
b/src/tests/eolian/eolian_parsing.c
index 2f9afc9..3589c88 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -9,6 +9,33 @@
 #include "Eolian.h"
 #include "eolian_suite.h"
 
+START_TEST(eolian_consts)
+{
+   Eolian_Function fid = NULL;
+   const char *class_name = "Const";
+   Eolian_Function_Parameter param = NULL;
+
+   eolian_init();
+   /* Parsing */
+   fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/consts.eo"));
+
+   /* Class */
+   fail_if(!eolian_class_exists(class_name));
+
+   /* Property */
+   fail_if(!(fid = eolian_class_function_find_by_name(class_name, "a", 
EOLIAN_PROPERTY)));
+   fail_if(!(param = eolian_function_parameter_get(fid, "buffer")));
+   fail_if(eolian_parameter_const_attribute_get(param, EINA_FALSE));
+   fail_if(!eolian_parameter_const_attribute_get(param, EINA_TRUE));
+
+   /* Method */
+   fail_if(!(fid = eolian_class_function_find_by_name(class_name, "foo", 
EOLIAN_METHOD)));
+   fail_if(EINA_FALSE == eolian_function_object_is_const(fid));
+
+   eolian_shutdown();
+}
+END_TEST
+
 START_TEST(eolian_ctor_dtor)
 {
    const char *class_name = "Ctor_Dtor";
@@ -277,5 +304,6 @@ void eolian_parsing_test(TCase *tc)
    tcase_add_test(tc, eolian_scope);
    tcase_add_test(tc, eolian_complex_type);
    tcase_add_test(tc, eolian_typedef);
+   tcase_add_test(tc, eolian_consts);
 }
 

-- 


Reply via email to