diff options
author | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2019-10-29 22:16:20 +0100 |
---|---|---|
committer | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2019-10-29 22:16:20 +0100 |
commit | 9b1bdcd94db8cf5266e5b754227b5d8c2170673a (patch) | |
tree | 97d67dc1fb608feb3252fd9d55a7a68f5c23c152 /man/mt_run.3 | |
parent | a771456205242fffeac4b6c48e171db3f315629e (diff) | |
download | mtest-9b1bdcd94db8cf5266e5b754227b5d8c2170673a.tar.gz mtest-9b1bdcd94db8cf5266e5b754227b5d8c2170673a.tar.bz2 mtest-9b1bdcd94db8cf5266e5b754227b5d8c2170673a.zip |
mtest.sh: add support for custom parameters in shell scripts
It is possible now to run
mt_run test1 and add some params
mt_run_named test1 to-customize tests
Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
Diffstat (limited to 'man/mt_run.3')
-rw-r--r-- | man/mt_run.3 | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/man/mt_run.3 b/man/mt_run.3 index c748ecd..1675a2e 100644 --- a/man/mt_run.3 +++ b/man/mt_run.3 @@ -27,7 +27,10 @@ c/c++ .PP shell .PP -.BI "mt_run <" function_name ">" +.BI "mt_run <" function_name "> [" param1 "] [" ... "]" +.br +.BI "mt_run_named <" function_name "> <" test_name "> [" param1 "] \ +[" ... "]" .SH DESCRIPTION .PP .BR mt_run (3) @@ -63,6 +66,19 @@ works in the same way as they non-parameter counterpart, but .I parameter will be passed to .IR function_name_param . +When using shell functions, there is no +.I param +functions, but you can pass unspecified number of parameters to both +.BR mt_run (3) +and +.BR mt_run_named (3). +Since +.I function_name +is run via +.B eval +program, when you want to pass parameter with spaces, you need to use +double quotes like +.BR """'parameter\ with\ spaces'""" . .PP Optionally user can also set two function pointers .I mt_prepare_test @@ -123,6 +139,14 @@ shell . ./mtest.sh + test_two() + { + a=$1 + b=$2 + c=$((a + b)) + mt_fail "[ $b -eq $(( c - a )) ]" + } + test_one() { a=1 @@ -131,6 +155,8 @@ shell } mt_run test_one + mt_run test_two 5 3 + mt_return .EE .SH "SEE ALSO" |