Eo: Fix return value of eo_do_super to depend on error_set.

And added tests to check it.

SVN revision: 72550
This commit is contained in:
Tom Hacohen 2012-06-20 15:56:17 +00:00
parent 68bf4c2e2e
commit ab39c0d399
6 changed files with 59 additions and 1 deletions

View File

@ -474,6 +474,9 @@ eo_do_super_internal(Eo *obj, Eo_Op_Type op_type, Eo_Op op, ...)
}
va_end(p_list);
if (obj->do_error)
ret = EINA_FALSE;
return ret;
}

View File

@ -6,6 +6,7 @@ LIST(APPEND CONSTRUCTORS_CC_SOURCES
simple4.c
simple5.c
simple6.c
simple7.c
mixin.c
)

View File

@ -5,6 +5,7 @@
#include "simple4.h"
#include "simple5.h"
#include "simple6.h"
#include "simple7.h"
#include "mixin.h"
#include "../eunit_tests.h"
@ -48,11 +49,16 @@ main(int argc, char *argv[])
fail_if(my_init_count != 0);
obj = eo_add(SIMPLE5_CLASS, NULL);
fail_if(!obj);
eo_unref(obj);
obj = eo_add(SIMPLE6_CLASS, NULL);
fail_if(!obj);
eo_unref(obj);
obj = eo_add(SIMPLE7_CLASS, NULL);
fail_if(obj);
eo_shutdown();
return ret;
}

View File

@ -9,7 +9,7 @@
static void
_destructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
{
eo_do_super(obj, eo_constructor());
eo_do_super(obj, eo_destructor());
eo_error_set(obj);
}

View File

@ -0,0 +1,39 @@
#include "Eo.h"
#include "mixin.h"
#include "simple7.h"
#include "simple2.h"
#include "config.h"
#include "../eunit_tests.h"
#define MY_CLASS SIMPLE7_CLASS
static void
_constructor(Eo *obj, void *class_data EINA_UNUSED, va_list *list EINA_UNUSED)
{
fail_if(eo_do_super(obj, eo_constructor()));
}
static void
_class_constructor(Eo_Class *klass)
{
const Eo_Op_Func_Description func_desc[] = {
EO_OP_FUNC(EO_BASE_ID(EO_BASE_SUB_ID_CONSTRUCTOR), _constructor),
EO_OP_FUNC_SENTINEL
};
eo_class_funcs_set(klass, func_desc);
}
static const Eo_Class_Description class_desc = {
"Simple7",
EO_CLASS_TYPE_REGULAR,
EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
NULL,
0,
_class_constructor,
NULL
};
EO_DEFINE_CLASS(simple7_class_get, &class_desc, SIMPLE2_CLASS, NULL);

View File

@ -0,0 +1,9 @@
#ifndef SIMPLE7_H
#define SIMPLE7_H
#include "Eo.h"
#define SIMPLE7_CLASS simple7_class_get()
const Eo_Class *simple7_class_get(void);
#endif