Eobj: Add a couple of funcs_set tests and fixed a bug related.
authortasn <tasn>
Mon, 23 Apr 2012 08:09:37 +0000 (08:09 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Mon, 23 Apr 2012 08:09:37 +0000 (08:09 +0000)
git-svn-id: http://svn.enlightenment.org/svn/e/trunk/PROTO/eobj@70402 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

lib/eobj.c
tests/eobj_test_general.c

index 5aab226..8875bce 100644 (file)
@@ -151,6 +151,7 @@ dich_func_set(Eobj_Class *klass, Eobj_Op op, eobj_op_func_type func)
           {
              ERR("OP %x is too big for the domain '%s', expected value < %x.",
                    op, op_klass->desc->name, op_klass->desc->ops.count);
+             return;
           }
      }
    else
index 03c3090..9d1973a 100644 (file)
@@ -103,10 +103,45 @@ START_TEST(eobj_weak_reference)
 }
 END_TEST
 
+static void
+_a_set(Eobj *obj EINA_UNUSED, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
+{
+   fail_if(EINA_TRUE);
+}
+
+static void
+_op_errors_class_constructor(Eobj_Class *klass)
+{
+   const Eobj_Op_Func_Description func_desc[] = {
+        EOBJ_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_LAST), _a_set),
+        EOBJ_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_LAST + 1), _a_set),
+        EOBJ_OP_FUNC(0x0F010111, _a_set),
+        EOBJ_OP_FUNC_SENTINEL
+   };
+
+   eobj_class_funcs_set(klass, func_desc);
+}
+
 START_TEST(eobj_op_errors)
 {
    eobj_init();
-   Eobj *obj = eobj_add(SIMPLE_CLASS, NULL);
+
+   static const Eobj_Class_Description class_desc = {
+        "Simple",
+        EOBJ_CLASS_TYPE_REGULAR,
+        EOBJ_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
+        NULL,
+        0,
+        NULL,
+        NULL,
+        _op_errors_class_constructor,
+        NULL
+   };
+
+   const Eobj_Class *klass = eobj_class_new(&class_desc, SIMPLE_CLASS, NULL);
+   fail_if(!klass);
+
+   Eobj *obj = eobj_add(klass, NULL);
 
    /* Out of bounds op for a legal class. */
    fail_if(eobj_do(obj, 0x00010111));