tasn pushed a commit to branch master.

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

commit c6159e042bb08dffecf60de3497126d0c60d0b68
Author: Tom Hacohen <t...@stosb.com>
Date:   Wed Apr 6 10:16:24 2016 +0100

    Eo tests: Also test function calls in reinit test.
    
    Since we cache ops we also need to check function calls work
    when we reinit eo, not just class_get functions.
    
    This commit essentially verifies that
    5284b62e930f0bef0ed3125b3a485e0599451ef8 was done correctly.
---
 src/tests/eo/suite/eo_test_class_simple.c | 27 ++++++++++++++++++++++++++-
 src/tests/eo/suite/eo_test_class_simple.h |  5 +++++
 src/tests/eo/suite/eo_test_init.c         | 15 +++++++++++++++
 3 files changed, 46 insertions(+), 1 deletion(-)

diff --git a/src/tests/eo/suite/eo_test_class_simple.c 
b/src/tests/eo/suite/eo_test_class_simple.c
index 224e80a..8566ed9 100644
--- a/src/tests/eo/suite/eo_test_class_simple.c
+++ b/src/tests/eo/suite/eo_test_class_simple.c
@@ -89,7 +89,6 @@ EO_VOID_FUNC_BODY(simple_pure_virtual);
 EO_VOID_FUNC_BODY(simple_no_implementation);
 
 static Eo_Op_Description op_descs[] = {
-     EO_OP_FUNC_OVERRIDE(eo_dbg_info_get, _dbg_info_get),
      EO_OP_FUNC(simple_a_set, _a_set),
      EO_OP_FUNC(simple_a_get, _a_get),
      EO_OP_FUNC(simple_a_print, _a_print),
@@ -97,6 +96,7 @@ static Eo_Op_Description op_descs[] = {
      EO_OP_FUNC(simple_recursive, _recursive),
      EO_OP_FUNC(simple_part_get, _part_get),
      EO_OP_FUNC(simple_pure_virtual, NULL),
+     EO_OP_FUNC_OVERRIDE(eo_dbg_info_get, _dbg_info_get),
 };
 
 static const Eo_Class_Description class_desc = {
@@ -112,3 +112,28 @@ static const Eo_Class_Description class_desc = {
 
 EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_CLASS, NULL)
 
+
+static int
+_beef_get(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED)
+{
+   return 0xBEEF;
+}
+
+EO_FUNC_BODY_CONST(simple2_class_beef_get, int, 0);
+
+static Eo_Op_Description op_descs2[] = {
+     EO_OP_CLASS_FUNC(simple2_class_beef_get, _beef_get),
+};
+
+static const Eo_Class_Description class_desc2 = {
+     EO_VERSION,
+     "Simple2",
+     EO_CLASS_TYPE_REGULAR,
+     EO_CLASS_DESCRIPTION_OPS(op_descs2),
+     NULL,
+     0,
+     NULL,
+     NULL
+};
+
+EO_DEFINE_CLASS(simple2_class_get, &class_desc2, EO_CLASS, NULL)
diff --git a/src/tests/eo/suite/eo_test_class_simple.h 
b/src/tests/eo/suite/eo_test_class_simple.h
index 3360ea8..32e3844 100644
--- a/src/tests/eo/suite/eo_test_class_simple.h
+++ b/src/tests/eo/suite/eo_test_class_simple.h
@@ -24,4 +24,9 @@ extern const Eo_Event_Description _EV_A_CHANGED2;
 #define SIMPLE_CLASS simple_class_get()
 const Eo_Class *simple_class_get(void);
 
+EAPI int simple2_class_beef_get(const Eo_Class *obj);
+
+#define SIMPLE2_CLASS simple2_class_get()
+const Eo_Class *simple2_class_get(void);
+
 #endif
diff --git a/src/tests/eo/suite/eo_test_init.c 
b/src/tests/eo/suite/eo_test_init.c
index ef04d31..4a1948c 100644
--- a/src/tests/eo/suite/eo_test_init.c
+++ b/src/tests/eo/suite/eo_test_init.c
@@ -5,6 +5,7 @@
 #include <Eo.h>
 
 #include "eo_suite.h"
+#include "eo_test_class_simple.h"
 
 START_TEST(eo_test_simple)
 {
@@ -17,12 +18,26 @@ END_TEST
 
 START_TEST(eo_test_init_shutdown)
 {
+   Eo *obj;
+
    fail_if(!eo_init());
    ck_assert_str_eq("Eo_Base", eo_class_name_get(EO_BASE_CLASS));
+
+   /* XXX-1: Essential for the next test to assign the wrong op. */
+   obj = eo_add(SIMPLE_CLASS, NULL);
+   simple_a_set(obj, 1);
+   ck_assert_int_eq(1, simple_a_get(obj));
+
+   /* XXX-1: Essential for the next test to cache the op. */
+   ck_assert_int_eq(0xBEEF, simple2_class_beef_get(SIMPLE2_CLASS));
+   eo_unref(obj);
    fail_if(eo_shutdown());
 
    fail_if(!eo_init());
    ck_assert_str_eq("Eo_Base", eo_class_name_get(EO_BASE_CLASS));
+
+   /* XXX-1: Verify that the op was not cached. */
+   ck_assert_int_eq(0xBEEF, simple2_class_beef_get(SIMPLE2_CLASS));
    fail_if(eo_shutdown());
 }
 END_TEST

-- 


Reply via email to