summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-07-24 12:44:31 -0400
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-29 16:06:21 +0200
commite1f2b9d23593302b3c7f1e05b933b551cee1bbbe (patch)
tree259a0c045d78d713e843a4da36aac5db2ccb126e /src/bin
parente0ae3a9a768f1c8b7b840e250ef0d7a4c8b39d13 (diff)
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 <mail@marcel-hollerbach.de> Differential Revision: https://phab.enlightenment.org/D9405
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/elementary/test.c48
1 files 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,
1387 /* if called with a single argument try to autorun a test with 1387 /* if called with a single argument try to autorun a test with
1388 * the same name as the given param 1388 * the same name as the given param
1389 * ex: elementary_test "Box Vert 2" */ 1389 * ex: elementary_test "Box Vert 2" */
1390 if (eina_array_count(arge->argv) == 2) 1390 if (eina_array_count(arge->argv) >= 2)
1391 { 1391 {
1392 if ((!strcmp(eina_array_data_get(arge->argv, 1), "--help")) || 1392 unsigned int i;
1393 (!strcmp(eina_array_data_get(arge->argv, 1), "-help")) || 1393 for (i = 1; i < eina_array_count(arge->argv); i++)
1394 (!strcmp(eina_array_data_get(arge->argv, 1), "-h")))
1395 { 1394 {
1396 efl_loop_quit(ev->object, 1395 char *arg = eina_array_data_get(arge->argv, i);
1397 eina_value_string_init("Usages:\n" 1396 if ((!strcmp(arg, "--help")) ||
1398 "$ elementary_test\n" 1397 (!strcmp(arg, "-help")) ||
1399 "$ elementary_test --test-win-only [TEST_NAME]\n" 1398 (!strcmp(arg, "-h")))
1400 "$ elementary_test -to [TEST_NAME]\n\n" 1399 {
1401 "Examples:\n" 1400 efl_loop_quit(ev->object,
1402 "$ elementary_test -to Button\n\n")); 1401 eina_value_string_init("Usages:\n"
1403 return ; 1402 "$ elementary_test\n"
1403 "$ elementary_test --test-win-only [TEST_NAME]\n"
1404 "$ elementary_test -to [TEST_NAME]\n\n"
1405 "Examples:\n"
1406 "$ elementary_test -to Button\n\n"));
1407 return ;
1408 }
1409 /* Just a workaround to make the shot module more
1410 * useful with elementary test. */
1411 if ((!strcmp(arg, "--test-win-only")) ||
1412 (!strcmp(arg, "-to")))
1413 {
1414 test_win_only = EINA_TRUE;
1415 }
1416 else if ((i == eina_array_count(arge->argv) - 1) && (arg[0] != '-'))
1417 autorun = arg;
1418
1404 } 1419 }
1405 autorun = eina_array_data_get(arge->argv, 1);
1406 } 1420 }
1407 else if (eina_array_count(arge->argv) == 3) 1421 else if (eina_array_count(arge->argv) == 3)
1408 { 1422 {
1409 /* Just a workaround to make the shot module more
1410 * useful with elementary test. */
1411 if ((!strcmp(eina_array_data_get(arge->argv, 1), "--test-win-only")) ||
1412 (!strcmp(eina_array_data_get(arge->argv, 1), "-to")))
1413 {
1414 test_win_only = EINA_TRUE;
1415 autorun = eina_array_data_get(arge->argv, 2);
1416 }
1417 } 1423 }
1418 1424
1419 my_win_main(autorun, test_win_only); /* create main window */ 1425 my_win_main(autorun, test_win_only); /* create main window */