summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-06-08 15:49:09 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-06-08 15:49:09 +0100
commitb87c4f6de82065b22c2dab32acf27afcbd3824cb (patch)
treed8b4e731c6ef42d94bd15263a495b027aac555f4 /src/tests
parent08e189805d30c45a56e77e3c4cc222ead8f4ed70 (diff)
eolian: refine the ref system to suit more cases
Now references are first class (but still restricted to one level). Unlike pointers they only mark the type instead of introducing a whole new type.
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/eolian/data/class_simple.eo4
-rw-r--r--src/tests/eolian/data/struct.eo2
-rw-r--r--src/tests/eolian/eolian_parsing.c11
3 files changed, 9 insertions, 8 deletions
diff --git a/src/tests/eolian/data/class_simple.eo b/src/tests/eolian/data/class_simple.eo
index 4bae98ab47..8a64b92a77 100644
--- a/src/tests/eolian/data/class_simple.eo
+++ b/src/tests/eolian/data/class_simple.eo
@@ -27,7 +27,7 @@ class Class_Simple {
27 @in a: int; [[a]] 27 @in a: int; [[a]]
28 @inout b: char; 28 @inout b: char;
29 @out c: double (1337.6); 29 @out c: double (1337.6);
30 @ref d: int; 30 @in d: ref(int);
31 } 31 }
32 return: char * (null); [[comment for method return]] 32 return: char * (null); [[comment for method return]]
33 } 33 }
@@ -36,7 +36,7 @@ class Class_Simple {
36 params { 36 params {
37 x: int; 37 x: int;
38 } 38 }
39 return: int @ref; 39 return: ref(int);
40 } 40 }
41 } 41 }
42} 42}
diff --git a/src/tests/eolian/data/struct.eo b/src/tests/eolian/data/struct.eo
index 842b1b23c9..077e499591 100644
--- a/src/tests/eolian/data/struct.eo
+++ b/src/tests/eolian/data/struct.eo
@@ -1,5 +1,5 @@
1struct Named { 1struct Named {
2 @ref field: int; 2 field: ref(int);
3 something: string; 3 something: string;
4} 4}
5 5
diff --git a/src/tests/eolian/eolian_parsing.c b/src/tests/eolian/eolian_parsing.c
index 86ff77f151..9833db3597 100644
--- a/src/tests/eolian/eolian_parsing.c
+++ b/src/tests/eolian/eolian_parsing.c
@@ -606,7 +606,7 @@ START_TEST(eolian_simple_parsing)
606 /* Method */ 606 /* Method */
607 fail_if(!(fid = eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD))); 607 fail_if(!(fid = eolian_class_function_get_by_name(class, "foo", EOLIAN_METHOD)));
608 fail_if(!eolian_function_is_beta(fid)); 608 fail_if(!eolian_function_is_beta(fid));
609 fail_if(eolian_function_return_is_ref(fid, EOLIAN_METHOD)); 609 fail_if(eolian_type_is_ref(eolian_function_return_type_get(fid, EOLIAN_METHOD)));
610 /* Function return */ 610 /* Function return */
611 tp = eolian_function_return_type_get(fid, EOLIAN_METHOD); 611 tp = eolian_function_return_type_get(fid, EOLIAN_METHOD);
612 fail_if(!tp); 612 fail_if(!tp);
@@ -641,8 +641,9 @@ START_TEST(eolian_simple_parsing)
641 fail_if(v.type != EOLIAN_EXPR_DOUBLE); 641 fail_if(v.type != EOLIAN_EXPR_DOUBLE);
642 fail_if(v.value.d != 1337.6); 642 fail_if(v.value.d != 1337.6);
643 fail_if(!(eina_iterator_next(iter, (void**)&param))); 643 fail_if(!(eina_iterator_next(iter, (void**)&param)));
644 fail_if(eolian_parameter_direction_get(param) != EOLIAN_REF_PARAM); 644 fail_if(eolian_parameter_direction_get(param) != EOLIAN_IN_PARAM);
645 fail_if(strcmp(eolian_type_name_get(eolian_parameter_type_get(param)), "int")); 645 fail_if(strcmp(eolian_type_name_get(eolian_parameter_type_get(param)), "int"));
646 fail_if(!eolian_type_is_ref(eolian_parameter_type_get(param)));
646 fail_if(strcmp(eolian_parameter_name_get(param), "d")); 647 fail_if(strcmp(eolian_parameter_name_get(param), "d"));
647 fail_if(eina_iterator_next(iter, &dummy)); 648 fail_if(eina_iterator_next(iter, &dummy));
648 eina_iterator_free(iter); 649 eina_iterator_free(iter);
@@ -652,7 +653,7 @@ START_TEST(eolian_simple_parsing)
652 fail_if(!eolian_function_is_legacy_only(fid, EOLIAN_METHOD)); 653 fail_if(!eolian_function_is_legacy_only(fid, EOLIAN_METHOD));
653 fail_if(!eolian_function_is_c_only(fid)); 654 fail_if(!eolian_function_is_c_only(fid));
654 fail_if(eolian_function_is_beta(fid)); 655 fail_if(eolian_function_is_beta(fid));
655 fail_if(!eolian_function_return_is_ref(fid, EOLIAN_METHOD)); 656 fail_if(!eolian_type_is_ref(eolian_function_return_type_get(fid, EOLIAN_METHOD)));
656 657
657 eolian_shutdown(); 658 eolian_shutdown();
658} 659}
@@ -686,12 +687,12 @@ START_TEST(eolian_struct)
686 fail_if(strcmp(file, "struct.eo")); 687 fail_if(strcmp(file, "struct.eo"));
687 fail_if(!(field = eolian_typedecl_struct_field_get(tdl, "field"))); 688 fail_if(!(field = eolian_typedecl_struct_field_get(tdl, "field")));
688 fail_if(!(ftype = eolian_typedecl_struct_field_type_get(field))); 689 fail_if(!(ftype = eolian_typedecl_struct_field_type_get(field)));
689 fail_if(!eolian_typedecl_struct_field_is_ref(field)); 690 fail_if(!eolian_type_is_ref(ftype));
690 fail_if(!(type_name = eolian_type_name_get(ftype))); 691 fail_if(!(type_name = eolian_type_name_get(ftype)));
691 fail_if(strcmp(type_name, "int")); 692 fail_if(strcmp(type_name, "int"));
692 fail_if(!(field = eolian_typedecl_struct_field_get(tdl, "something"))); 693 fail_if(!(field = eolian_typedecl_struct_field_get(tdl, "something")));
693 fail_if(!(ftype = eolian_typedecl_struct_field_type_get(field))); 694 fail_if(!(ftype = eolian_typedecl_struct_field_type_get(field)));
694 fail_if(eolian_typedecl_struct_field_is_ref(field)); 695 fail_if(eolian_type_is_ref(ftype));
695 fail_if(!(type_name = eolian_type_c_type_get(ftype))); 696 fail_if(!(type_name = eolian_type_c_type_get(ftype)));
696 fail_if(strcmp(type_name, "const char *")); 697 fail_if(strcmp(type_name, "const char *"));
697 eina_stringshare_del(type_name); 698 eina_stringshare_del(type_name);