on_return
This commit is contained in:
+19
-5
@@ -33,11 +33,6 @@ function do_last_false {
|
||||
! true
|
||||
}
|
||||
|
||||
function do_return {
|
||||
echo START
|
||||
return 99
|
||||
}
|
||||
|
||||
function do_command_not_found {
|
||||
echo START
|
||||
command_not_found A B C
|
||||
@@ -50,6 +45,10 @@ function do_exit {
|
||||
echo SHOULD NOT APPEAR
|
||||
}
|
||||
|
||||
function do_return {
|
||||
should_return
|
||||
}
|
||||
|
||||
function do_unbound_associative {
|
||||
declare -A associative
|
||||
associative['A']='Abc'
|
||||
@@ -115,6 +114,10 @@ function call_function_which_will_exit {
|
||||
exit 99
|
||||
}
|
||||
|
||||
function call_function_which_will_return {
|
||||
return 199
|
||||
}
|
||||
|
||||
function F2 {
|
||||
echo "stdout A"
|
||||
# echo toto >>/tmp/toto
|
||||
@@ -155,6 +158,17 @@ function main {
|
||||
>&2 echo some trace in stderr2
|
||||
}
|
||||
|
||||
function should_return {
|
||||
echo A
|
||||
if call_function_which_will_return; then
|
||||
echo SUCCESS
|
||||
else
|
||||
echo FAILURE
|
||||
fi
|
||||
call_function_which_will_return
|
||||
echo SHOULD NOT APPEAR
|
||||
}
|
||||
|
||||
function F3 {
|
||||
echo F3
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user