summaryrefslogtreecommitdiff
path: root/src/tests/ecore
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-02-12 21:34:30 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-02-12 21:42:33 +0100
commit3b262340babc57058f3e97b10ca56c0adb1c3efe (patch)
tree161bc332ec179ad89badec243d4c272712ee9c8c /src/tests/ecore
parent06160466e8c54fd31926f7102268a8a6afde537e (diff)
Revert "Revert command line array object because it's broken by design"
This reverts commit a57c7f751023fe1d1edeabbf8683574ac7497e5e. I pretty much hate to just revert your revert, but you failed to read my replies, and failed to understand what i was talking about. And YES we talked at fosdem about the platform issue, and do you remember my answer, that back in time this might be the case, today is different freebsd suppoerts setenv, and for windows we have a setenv implementation in evil. And yes, vtorri also created a issue how bad and evil this commit is, however, i still fail to see the issue since setenv unsetenv and clearenv usages are taken as needed. (T7693) The ownership question is answered in https://phab.enlightenment.org/D7516#137367. Can we please get into a state of technical discussions, and not *oh shit, i am going to revert this* this has been in review for a long time, a lots of people have tested it, we discussed things on it, and there was 3 weeks of no reply from you. The issues that exist will be dealed with. Feel free to create tasks if you want :)
Diffstat (limited to 'src/tests/ecore')
-rw-r--r--src/tests/ecore/efl_app_suite.c1
-rw-r--r--src/tests/ecore/efl_app_suite.h1
-rw-r--r--src/tests/ecore/efl_app_test_cml.c85
-rw-r--r--src/tests/ecore/efl_app_test_cml.eo4
-rw-r--r--src/tests/ecore/meson.build22
5 files changed, 111 insertions, 2 deletions
diff --git a/src/tests/ecore/efl_app_suite.c b/src/tests/ecore/efl_app_suite.c
index cd26e2d95e..2cab632622 100644
--- a/src/tests/ecore/efl_app_suite.c
+++ b/src/tests/ecore/efl_app_suite.c
@@ -53,6 +53,7 @@ static const Efl_Test_Case etc[] = {
53 { "Promise", efl_app_test_promise_3 }, 53 { "Promise", efl_app_test_promise_3 },
54 { "Promise", efl_app_test_promise_safety }, 54 { "Promise", efl_app_test_promise_safety },
55 { "Env", efl_test_efl_env }, 55 { "Env", efl_test_efl_env },
56 { "CML", efl_test_efl_cml },
56 { NULL, NULL } 57 { NULL, NULL }
57}; 58};
58 59
diff --git a/src/tests/ecore/efl_app_suite.h b/src/tests/ecore/efl_app_suite.h
index 3a66dcdfcf..874d2bb503 100644
--- a/src/tests/ecore/efl_app_suite.h
+++ b/src/tests/ecore/efl_app_suite.h
@@ -12,5 +12,6 @@ void efl_app_test_promise_2(TCase *tc);
12void efl_app_test_promise_3(TCase *tc); 12void efl_app_test_promise_3(TCase *tc);
13void efl_app_test_promise_safety(TCase *tc); 13void efl_app_test_promise_safety(TCase *tc);
14void efl_test_efl_env(TCase *tc); 14void efl_test_efl_env(TCase *tc);
15void efl_test_efl_cml(TCase *tc);
15 16
16#endif /* _EFL_APP_SUITE_H */ 17#endif /* _EFL_APP_SUITE_H */
diff --git a/src/tests/ecore/efl_app_test_cml.c b/src/tests/ecore/efl_app_test_cml.c
new file mode 100644
index 0000000000..1b7cebf552
--- /dev/null
+++ b/src/tests/ecore/efl_app_test_cml.c
@@ -0,0 +1,85 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
5#define EFL_CORE_COMMAND_LINE_PROTECTED
6
7#include <stdio.h>
8#include <unistd.h>
9#define EFL_NOLEGACY_API_SUPPORT
10#include <Efl_Core.h>
11#include "efl_app_suite.h"
12#include "../efl_check.h"
13
14typedef struct {
15
16} Efl_App_Test_CML_Data;
17
18#include "efl_app_test_cml.eo.h"
19#include "efl_app_test_cml.eo.c"
20
21static Eina_Array*
22_construct_array(void)
23{
24 Eina_Array *array = eina_array_new(16);
25
26 eina_array_push(array, "/bin/sh");
27 eina_array_push(array, "-C");
28 eina_array_push(array, "foo");
29 eina_array_push(array, "--test");
30 eina_array_push(array, "--option=done");
31 eina_array_push(array, "--");
32 eina_array_push(array, "asdf --test");
33 return array;
34}
35
36static const char*
37_construct_string(void)
38{
39 return "/bin/sh -C foo --test --option=done -- \"asdf --test\"";
40}
41
42EFL_START_TEST(efl_core_cml_string)
43{
44 Efl_App_Test_CML *cml = efl_add_ref(EFL_APP_TEST_CML_CLASS, NULL);
45 Eina_Array *content = _construct_array();
46 Eina_Stringshare *str;
47 Eina_Bool b;
48 int i = 0;
49
50 b = efl_core_command_line_command_string_set(cml, _construct_string());
51 ck_assert_int_ne(b, 0);
52
53 EINA_ACCESSOR_FOREACH(efl_core_command_line_command_access(cml), i, str)
54 {
55 ck_assert_str_eq(eina_array_data_get(content, i), str);
56 }
57 ck_assert_str_eq(efl_core_command_line_command_get(cml), _construct_string());
58}
59EFL_END_TEST
60
61EFL_START_TEST(efl_core_cml_array)
62{
63 Efl_App_Test_CML *cml = efl_add_ref(EFL_APP_TEST_CML_CLASS, NULL);
64 Eina_Array *content1 = _construct_array();
65 Eina_Array *content2 = _construct_array();
66 Eina_Stringshare *str;
67 Eina_Bool b;
68 int i = 0;
69
70 b = efl_core_command_line_command_array_set(cml, content1);
71 ck_assert_int_ne(b, 0);
72
73 EINA_ACCESSOR_FOREACH(efl_core_command_line_command_access(cml), i, str)
74 {
75 ck_assert_str_eq(eina_array_data_get(content2, i), str);
76 }
77 ck_assert_str_eq(efl_core_command_line_command_get(cml), _construct_string());
78}
79EFL_END_TEST
80
81void efl_test_efl_cml(TCase *tc)
82{
83 tcase_add_test(tc, efl_core_cml_string);
84 tcase_add_test(tc, efl_core_cml_array);
85}
diff --git a/src/tests/ecore/efl_app_test_cml.eo b/src/tests/ecore/efl_app_test_cml.eo
new file mode 100644
index 0000000000..b0877e0cf7
--- /dev/null
+++ b/src/tests/ecore/efl_app_test_cml.eo
@@ -0,0 +1,4 @@
1class Efl.App.Test.CML extends Efl.Object implements Efl.Core.Command_Line
2{
3
4}
diff --git a/src/tests/ecore/meson.build b/src/tests/ecore/meson.build
index e3b4f6c851..c49d941355 100644
--- a/src/tests/ecore/meson.build
+++ b/src/tests/ecore/meson.build
@@ -76,14 +76,32 @@ efl_app_suite_src = [
76 'efl_app_test_loop_fd.c', 76 'efl_app_test_loop_fd.c',
77 'efl_app_test_loop_timer.c', 77 'efl_app_test_loop_timer.c',
78 'efl_app_test_promise.c', 78 'efl_app_test_promise.c',
79 'efl_app_test_env.c' 79 'efl_app_test_env.c',
80 'efl_app_test_cml.c',
80] 81]
81 82
83priv_eo_files = [
84 'efl_app_test_cml.eo',
85]
86
87priv_eo_file_target = []
88foreach eo_file : priv_eo_files
89 priv_eo_file_target += custom_target('eolian_gen_' + eo_file,
90 input : eo_file,
91 output : [eo_file + '.h'],
92 depfile : eo_file + '.d',
93 command : eolian_gen + [ '-I', meson.current_source_dir(), eolian_include_directories,
94 '-o', 'h:' + join_paths(meson.current_build_dir(), eo_file + '.h'),
95 '-o', 'c:' + join_paths(meson.current_build_dir(), eo_file + '.c'),
96 '-o', 'd:' + join_paths(meson.current_build_dir(), eo_file + '.d'),
97 '-gchd', '@INPUT@'])
98endforeach
99
82efl_app_suite_deps = [m] 100efl_app_suite_deps = [m]
83efl_app_suite_deps += ecore 101efl_app_suite_deps += ecore
84 102
85efl_app_suite = executable('efl_app_suite', 103efl_app_suite = executable('efl_app_suite',
86 efl_app_suite_src, 104 efl_app_suite_src, priv_eo_file_target,
87 dependencies: [efl_app_suite_deps, check], 105 dependencies: [efl_app_suite_deps, check],
88 c_args : [ 106 c_args : [
89 '-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"', 107 '-DTESTS_BUILD_DIR="'+meson.current_build_dir()+'"',