summaryrefslogtreecommitdiff
path: root/legacy/eobj/src/tests/mixin
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2012-07-31 07:15:33 +0000
committerTom Hacohen <tom@stosb.com>2012-07-31 07:15:33 +0000
commit7595ce698daf995914ea80d8fbe0a2c9096559ab (patch)
tree6fce15226248ca2b80b36caf40b75c3e91170df9 /legacy/eobj/src/tests/mixin
parent2aa4cd4bd52d48269d7b2d3392393fd51cc9b22f (diff)
Eo: Fixed an issue with mixins and super calls.
SVN revision: 74617
Diffstat (limited to 'legacy/eobj/src/tests/mixin')
-rw-r--r--legacy/eobj/src/tests/mixin/CMakeLists.txt2
-rw-r--r--legacy/eobj/src/tests/mixin/inherit.c38
-rw-r--r--legacy/eobj/src/tests/mixin/inherit.h11
-rw-r--r--legacy/eobj/src/tests/mixin/main.c7
-rw-r--r--legacy/eobj/src/tests/mixin/mixin4.c24
-rw-r--r--legacy/eobj/src/tests/mixin/mixin4.h9
6 files changed, 91 insertions, 0 deletions
diff --git a/legacy/eobj/src/tests/mixin/CMakeLists.txt b/legacy/eobj/src/tests/mixin/CMakeLists.txt
index 557cbd301a..557a3e6af3 100644
--- a/legacy/eobj/src/tests/mixin/CMakeLists.txt
+++ b/legacy/eobj/src/tests/mixin/CMakeLists.txt
@@ -1,9 +1,11 @@
1LIST(APPEND MIXIN_CC_SOURCES 1LIST(APPEND MIXIN_CC_SOURCES
2 main.c 2 main.c
3 simple.c 3 simple.c
4 inherit.c
4 mixin.c 5 mixin.c
5 mixin2.c 6 mixin2.c
6 mixin3.c 7 mixin3.c
8 mixin4.c
7 ) 9 )
8 10
9include_directories( 11include_directories(
diff --git a/legacy/eobj/src/tests/mixin/inherit.c b/legacy/eobj/src/tests/mixin/inherit.c
new file mode 100644
index 0000000000..53c8826953
--- /dev/null
+++ b/legacy/eobj/src/tests/mixin/inherit.c
@@ -0,0 +1,38 @@
1#include "Eo.h"
2#include "inherit.h"
3
4#include "config.h"
5
6#define MY_CLASS INHERIT_CLASS
7
8static void
9_a_get(Eo *obj, void *class_data EINA_UNUSED, va_list *list)
10{
11 int *name = va_arg(*list, int *);
12 eo_do_super(obj, simple_a_get(name));
13 printf("%s\n", __func__);
14}
15
16static void
17_class_constructor(Eo_Class *klass)
18{
19 const Eo_Op_Func_Description func_desc[] = {
20 EO_OP_FUNC(SIMPLE_ID(SIMPLE_SUB_ID_A_GET), _a_get),
21 EO_OP_FUNC_SENTINEL
22 };
23
24 eo_class_funcs_set(klass, func_desc);
25}
26
27static const Eo_Class_Description class_desc = {
28 EO_VERSION,
29 "Inherit",
30 EO_CLASS_TYPE_REGULAR,
31 EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
32 NULL,
33 0,
34 _class_constructor,
35 NULL
36};
37
38EO_DEFINE_CLASS(inherit_class_get, &class_desc, SIMPLE_CLASS, MIXIN4_CLASS, NULL);
diff --git a/legacy/eobj/src/tests/mixin/inherit.h b/legacy/eobj/src/tests/mixin/inherit.h
new file mode 100644
index 0000000000..b6d78fbf0b
--- /dev/null
+++ b/legacy/eobj/src/tests/mixin/inherit.h
@@ -0,0 +1,11 @@
1#ifndef INHERIT_H
2#define INHERIT_H
3
4#include "Eo.h"
5#include "simple.h"
6#include "mixin4.h"
7
8#define INHERIT_CLASS inherit_class_get()
9const Eo_Class *inherit_class_get(void);
10
11#endif
diff --git a/legacy/eobj/src/tests/mixin/main.c b/legacy/eobj/src/tests/mixin/main.c
index b7109a108d..c69754da78 100644
--- a/legacy/eobj/src/tests/mixin/main.c
+++ b/legacy/eobj/src/tests/mixin/main.c
@@ -1,5 +1,6 @@
1#include "Eo.h" 1#include "Eo.h"
2#include "simple.h" 2#include "simple.h"
3#include "inherit.h"
3#include "mixin.h" 4#include "mixin.h"
4#include "mixin2.h" 5#include "mixin2.h"
5#include "mixin3.h" 6#include "mixin3.h"
@@ -30,6 +31,12 @@ main(int argc, char *argv[])
30 fail_if(pd3->count != 9); 31 fail_if(pd3->count != 9);
31 32
32 eo_unref(obj); 33 eo_unref(obj);
34
35 obj = eo_add(INHERIT_CLASS, NULL);
36 eo_do(obj, simple_a_set(5), simple_a_get(&a));
37 fail_if(a != 5);
38
39 eo_unref(obj);
33 eo_shutdown(); 40 eo_shutdown();
34 return 0; 41 return 0;
35} 42}
diff --git a/legacy/eobj/src/tests/mixin/mixin4.c b/legacy/eobj/src/tests/mixin/mixin4.c
new file mode 100644
index 0000000000..17944bc901
--- /dev/null
+++ b/legacy/eobj/src/tests/mixin/mixin4.c
@@ -0,0 +1,24 @@
1#include "Eo.h"
2#include "mixin.h"
3#include "mixin4.h"
4#include "simple.h"
5
6#include "config.h"
7
8#include "../eunit_tests.h"
9
10#define MY_CLASS MIXIN4_CLASS
11
12static const Eo_Class_Description class_desc = {
13 EO_VERSION,
14 "Mixin4",
15 EO_CLASS_TYPE_MIXIN,
16 EO_CLASS_DESCRIPTION_OPS(NULL, NULL, 0),
17 NULL,
18 0,
19 NULL,
20 NULL
21};
22
23EO_DEFINE_CLASS(mixin4_class_get, &class_desc, NULL, NULL);
24
diff --git a/legacy/eobj/src/tests/mixin/mixin4.h b/legacy/eobj/src/tests/mixin/mixin4.h
new file mode 100644
index 0000000000..e924332fdc
--- /dev/null
+++ b/legacy/eobj/src/tests/mixin/mixin4.h
@@ -0,0 +1,9 @@
1#ifndef MIXIN4_H
2#define MIXIN4_H
3
4#include "Eo.h"
5
6#define MIXIN4_CLASS mixin4_class_get()
7const Eo_Class *mixin4_class_get(void);
8
9#endif