summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-10-11 21:45:03 +0000
committerMike Blumenkrantz <zmike@samsung.com>2019-11-27 09:42:53 -0500
commit3d3fe1ebcf568cf49a29e637335f3fbc598daf84 (patch)
tree508d790ad7648e296f2d3fdae097bc14cef758f9
parent35aef560fbd8a62578a5e8de4e4c26ddfa70748d (diff)
eolian-cxx: Make events inherit beta info from klass.
To mimic function behavior Reviewed-by: Felipe Magno de Almeida <felipe@expertisesolutions.com.br> Differential Revision: https://phab.enlightenment.org/D10381
-rw-r--r--src/lib/eolian_cxx/grammar/klass_def.hpp2
-rw-r--r--src/tests/eolian_cxx/beta_class.eo8
-rw-r--r--src/tests/eolian_cxx/eolian_cxx_test_binding.cc27
3 files changed, 36 insertions, 1 deletions
diff --git a/src/lib/eolian_cxx/grammar/klass_def.hpp b/src/lib/eolian_cxx/grammar/klass_def.hpp
index 58b8cbd219..6679e377d2 100644
--- a/src/lib/eolian_cxx/grammar/klass_def.hpp
+++ b/src/lib/eolian_cxx/grammar/klass_def.hpp
@@ -1201,7 +1201,7 @@ struct event_def
1201 } : eina::optional<type_def>{}) 1201 } : eina::optional<type_def>{})
1202 , name( ::eolian_event_name_get(event)) 1202 , name( ::eolian_event_name_get(event))
1203 , c_name( ::eolian_event_c_macro_get(event)) 1203 , c_name( ::eolian_event_c_macro_get(event))
1204 , is_beta( ::eolian_event_is_beta(event)) 1204 , is_beta( ::eolian_event_is_beta(event) || klass.is_beta)
1205 , is_protected( ::eolian_event_scope_get(event) == EOLIAN_SCOPE_PROTECTED) 1205 , is_protected( ::eolian_event_scope_get(event) == EOLIAN_SCOPE_PROTECTED)
1206 , documentation( ::eolian_event_documentation_get(event)) {} 1206 , documentation( ::eolian_event_documentation_get(event)) {}
1207}; 1207};
diff --git a/src/tests/eolian_cxx/beta_class.eo b/src/tests/eolian_cxx/beta_class.eo
index ba91bf7660..be796f1ab5 100644
--- a/src/tests/eolian_cxx/beta_class.eo
+++ b/src/tests/eolian_cxx/beta_class.eo
@@ -1,3 +1,11 @@
1class @beta Beta_Class extends Efl.Object 1class @beta Beta_Class extends Efl.Object
2{ 2{
3 methods {
4 method_should_be_beta {
5 [[ Method should be beta ]]
6 }
7 }
8 events {
9 event_should_be_beta: void; [[ Event should be beta.]]
10 }
3} 11}
diff --git a/src/tests/eolian_cxx/eolian_cxx_test_binding.cc b/src/tests/eolian_cxx/eolian_cxx_test_binding.cc
index adbb8b4978..498852f28b 100644
--- a/src/tests/eolian_cxx/eolian_cxx_test_binding.cc
+++ b/src/tests/eolian_cxx/eolian_cxx_test_binding.cc
@@ -206,6 +206,7 @@ using efl::eolian::grammar::attributes::klass_def;
206using efl::eolian::grammar::attributes::function_def; 206using efl::eolian::grammar::attributes::function_def;
207using efl::eolian::grammar::attributes::property_def; 207using efl::eolian::grammar::attributes::property_def;
208using efl::eolian::grammar::attributes::type_def; 208using efl::eolian::grammar::attributes::type_def;
209using efl::eolian::grammar::attributes::event_def;
209 210
210// FIXME Unify this definition some so we can share it with documentation tests. 211// FIXME Unify this definition some so we can share it with documentation tests.
211static 212static
@@ -333,6 +334,31 @@ EFL_START_TEST(eolian_cxx_test_beta)
333} 334}
334EFL_END_TEST 335EFL_END_TEST
335 336
337EFL_START_TEST(eolian_cxx_test_beta_cascading)
338{
339 efl::eolian::eolian_init eolian_init;
340 efl::eolian::eolian_state eolian_state;
341
342 klass_def cls = init_test_data("beta_class.eo", "Beta_Class", eolian_state);
343
344 ck_assert(cls.is_beta);
345
346 auto func = std::find_if(cls.functions.begin(), cls.functions.end(), [](function_def const& f) {
347 return f.name == "method_should_be_beta";
348 });
349
350 ck_assert(func != cls.functions.end());
351 ck_assert(func->is_beta);
352
353 auto evt = std::find_if(cls.events.begin(), cls.events.end(), [](event_def const& e) {
354 return e.name == "event_should_be_beta";
355 });
356
357 ck_assert(evt != cls.events.end());
358 ck_assert(evt->is_beta);
359}
360EFL_END_TEST
361
336void 362void
337eolian_cxx_test_binding(TCase* tc) 363eolian_cxx_test_binding(TCase* tc)
338{ 364{
@@ -348,4 +374,5 @@ eolian_cxx_test_binding(TCase* tc)
348 tcase_add_test(tc, eolian_cxx_test_cls_get); 374 tcase_add_test(tc, eolian_cxx_test_cls_get);
349 tcase_add_test(tc, eolian_cxx_test_constructors); 375 tcase_add_test(tc, eolian_cxx_test_constructors);
350 tcase_add_test(tc, eolian_cxx_test_beta); 376 tcase_add_test(tc, eolian_cxx_test_beta);
377 tcase_add_test(tc, eolian_cxx_test_beta_cascading);
351} 378}