bu5hm4n pushed a commit to branch master. http://git.enlightenment.org/core/efl.git/commit/?id=e1f2b9d23593302b3c7f1e05b933b551cee1bbbe
commit e1f2b9d23593302b3c7f1e05b933b551cee1bbbe Author: Mike Blumenkrantz <[email protected]> Date: Wed Jul 24 12:44:31 2019 -0400 elm_test: replace bespoke arg handling with a for loop this fixes handling of --help regardless of its position in the arg array Reviewed-by: Marcel Hollerbach <[email protected]> Differential Revision: https://phab.enlightenment.org/D9405 --- src/bin/elementary/test.c | 48 ++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c index 4a77460058..3222fad2c9 100644 --- a/src/bin/elementary/test.c +++ b/src/bin/elementary/test.c @@ -1387,33 +1387,39 @@ efl_main(void *data EINA_UNUSED, /* if called with a single argument try to autorun a test with * the same name as the given param * ex: elementary_test "Box Vert 2" */ - if (eina_array_count(arge->argv) == 2) + if (eina_array_count(arge->argv) >= 2) { - if ((!strcmp(eina_array_data_get(arge->argv, 1), "--help")) || - (!strcmp(eina_array_data_get(arge->argv, 1), "-help")) || - (!strcmp(eina_array_data_get(arge->argv, 1), "-h"))) + unsigned int i; + for (i = 1; i < eina_array_count(arge->argv); i++) { - efl_loop_quit(ev->object, - eina_value_string_init("Usages:\n" - "$ elementary_test\n" - "$ elementary_test --test-win-only [TEST_NAME]\n" - "$ elementary_test -to [TEST_NAME]\n\n" - "Examples:\n" - "$ elementary_test -to Button\n\n")); - return ; + char *arg = eina_array_data_get(arge->argv, i); + if ((!strcmp(arg, "--help")) || + (!strcmp(arg, "-help")) || + (!strcmp(arg, "-h"))) + { + efl_loop_quit(ev->object, + eina_value_string_init("Usages:\n" + "$ elementary_test\n" + "$ elementary_test --test-win-only [TEST_NAME]\n" + "$ elementary_test -to [TEST_NAME]\n\n" + "Examples:\n" + "$ elementary_test -to Button\n\n")); + return ; + } + /* Just a workaround to make the shot module more + * useful with elementary test. */ + if ((!strcmp(arg, "--test-win-only")) || + (!strcmp(arg, "-to"))) + { + test_win_only = EINA_TRUE; + } + else if ((i == eina_array_count(arge->argv) - 1) && (arg[0] != '-')) + autorun = arg; + } - autorun = eina_array_data_get(arge->argv, 1); } else if (eina_array_count(arge->argv) == 3) { - /* Just a workaround to make the shot module more - * useful with elementary test. */ - if ((!strcmp(eina_array_data_get(arge->argv, 1), "--test-win-only")) || - (!strcmp(eina_array_data_get(arge->argv, 1), "-to"))) - { - test_win_only = EINA_TRUE; - autorun = eina_array_data_get(arge->argv, 2); - } } my_win_main(autorun, test_win_only); /* create main window */ --
