Eolian/Tests: add test for events.

This commit is contained in:
Daniel Zaoui 2014-05-23 17:38:39 +03:00
parent 62082548bc
commit 5b2ce095a3
5 changed files with 504 additions and 448 deletions

View File

@ -95,5 +95,6 @@ tests/eolian/data/object_impl_ref.c \
tests/eolian/data/object_impl_add.eo \
tests/eolian/data/object_impl_add_ref.c \
tests/eolian/data/consts.eo \
tests/eolian/data/override.eo
tests/eolian/data/override.eo \
tests/eolian/data/events.eo

File diff suppressed because it is too large Load Diff

View File

@ -910,7 +910,7 @@ _eo_tokenizer_implement_get(Eo_Tokenizer *toknz, char *p)
event_comment = ws* eo_comment %end_event_comment;
event_type = begin_list ws* alpha_u >save_fpc (alnum_u | '*' | ws )* ws* end_list %end_event_type;
event_it = event %end_event_name ws* event_type? ignore* end_statement event_comment? ignore*;
event_it = event %end_event_name ws* event_type? ignore* end_statement event_comment? ignore* comment* ignore*;
events = 'events' ignore* begin_def ignore* event_it* end_def;
constructors = 'constructors' ignore* begin_def;

View File

@ -0,0 +1,6 @@
class Events {
events {
clicked; /*@ Comment for clicked */
clicked,double (Evas_Event_Clicked_Double_Info); /* No comment */
}
}

View File

@ -9,6 +9,37 @@
#include "Eolian.h"
#include "eolian_suite.h"
START_TEST(eolian_events)
{
Eolian_Class class;
const Eina_List *list = NULL;
const char *name, *type, *comment;
eolian_init();
/* Parsing */
fail_if(!eolian_eo_file_parse(PACKAGE_DATA_DIR"/data/events.eo"));
/* Class */
fail_if(!(class = eolian_class_find_by_name("Events")));
/* Events */
fail_if(!(list = eolian_class_events_list_get(class)));
fail_if(eina_list_count(list) != 2);
/* Clicked */
fail_if(!eolian_class_event_information_get(eina_list_nth(list, 0), &name, &type, &comment));
fail_if(strcmp(name, "clicked"));
fail_if(type);
fail_if(strcmp(comment, "Comment for clicked"));
/* Clicked,double */
fail_if(!eolian_class_event_information_get(eina_list_nth(list, 1), &name, &type, &comment));
fail_if(strcmp(name, "clicked,double"));
fail_if(strcmp(type, "Evas_Event_Clicked_Double_Info"));
fail_if(comment);
eolian_shutdown();
}
END_TEST
START_TEST(eolian_override)
{
Eolian_Function fid = NULL;
@ -346,5 +377,6 @@ void eolian_parsing_test(TCase *tc)
tcase_add_test(tc, eolian_typedef);
tcase_add_test(tc, eolian_consts);
tcase_add_test(tc, eolian_override);
tcase_add_test(tc, eolian_events);
}