summaryrefslogtreecommitdiffstats
path: root/test/helper-config-cmdline-parser.c
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-10-20 19:34:03 +0200
committerDave Davenport <qball@gmpclient.org>2016-10-20 19:34:03 +0200
commitc8d206909874d986ea6640e917e49c67322915e4 (patch)
tree32e04116d12781d61b467c518f7a58521aa4421d /test/helper-config-cmdline-parser.c
parent881056ea9b1a606d1d979be631795a3a07d5621e (diff)
Add more tests and re-add textbox_test to normal check set.
Diffstat (limited to 'test/helper-config-cmdline-parser.c')
-rw-r--r--test/helper-config-cmdline-parser.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/test/helper-config-cmdline-parser.c b/test/helper-config-cmdline-parser.c
index 861b43bf..c1521aa5 100644
--- a/test/helper-config-cmdline-parser.c
+++ b/test/helper-config-cmdline-parser.c
@@ -47,17 +47,45 @@ int main ( int argc, char ** argv )
char **list = NULL;
int llength = 0;
char * test_str =
- "{host} {terminal} -e bash -c \"{ssh-client} {host}; echo '{terminal} {host}'\"";
+ "{host} {terminal} -e bash -c \"{ssh-client} {host}; echo '{terminal} {host}'\" -i -3 -u 4";
helper_parse_setup ( test_str, &list, &llength, "{host}", "chuck",
"{terminal}", "x-terminal-emulator", NULL );
- TASSERT ( llength == 6 );
+ TASSERT ( llength == 10);
TASSERT ( strcmp ( list[0], "chuck" ) == 0 );
TASSERT ( strcmp ( list[1], "x-terminal-emulator" ) == 0 );
TASSERT ( strcmp ( list[2], "-e" ) == 0 );
TASSERT ( strcmp ( list[3], "bash" ) == 0 );
TASSERT ( strcmp ( list[4], "-c" ) == 0 );
TASSERT ( strcmp ( list[5], "ssh chuck; echo 'x-terminal-emulator chuck'" ) == 0 );
+ TASSERT ( strcmp ( list[6], "-i" ) == 0 );
+ TASSERT ( strcmp ( list[7], "-3" ) == 0 );
+ TASSERT ( strcmp ( list[8], "-u" ) == 0 );
+ TASSERT ( strcmp ( list[9], "4" ) == 0 );
+
+ cmd_set_arguments ( llength, list);
+ TASSERT( find_arg ( "-e") == 2 );
+ TASSERT( find_arg ( "-x") == -1 );
+ char *str;
+ TASSERT( find_arg_str ( "-e", &str) == TRUE );
+ TASSERT ( str == list[3] );
+ TASSERT( find_arg_str ( "-x", &str) == FALSE );
+ // Should be unmodified.
+ TASSERT ( str == list[3] );
+
+ unsigned int u = 1234;
+ unsigned int i = -1234;
+ TASSERT ( find_arg_uint ( "-x", &u ) == FALSE );
+ TASSERT ( u == 1234 );
+ TASSERT ( find_arg_int ( "-x", &i ) == FALSE );
+ TASSERT ( i == -1234 );
+ TASSERT ( find_arg_uint ( "-u", &u ) == TRUE );
+ TASSERT ( u == 4 );
+ TASSERT ( find_arg_uint ( "-i", &u ) == TRUE );
+ TASSERT ( u == 4294967293 );
+ TASSERT ( find_arg_int ( "-i", &i ) == TRUE );
+ TASSERT ( i == -3 );
+
g_strfreev ( list );
}