diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 18:33:23 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 18:33:23 +0000 |
commit | 1d5cace9db9aef76f26b2d7ba54bbb76443b00b2 (patch) | |
tree | 314a15dd1aa103da13bdc83ba1d2105a290bc5ba /tests/func.right | |
parent | Initial commit. (diff) | |
download | bash-89791e9f494bebe33a9c52292a98f4f079926078.tar.xz bash-89791e9f494bebe33a9c52292a98f4f079926078.zip |
Adding upstream version 5.0.upstream/5.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/func.right')
-rw-r--r-- | tests/func.right | 169 |
1 files changed, 169 insertions, 0 deletions
diff --git a/tests/func.right b/tests/func.right new file mode 100644 index 0000000..70bf123 --- /dev/null +++ b/tests/func.right @@ -0,0 +1,169 @@ +a returns 5 +b returns 4 +c returns 3 +d returns 2 +in e +e returned 25 +x is 25 +ZZ +abcde +defghi +ZZ +5 +0 +AVAR +AVAR +foo +foo +AVAR +5 +5 +f1 +f1 () +{ + ( return 5 ); + status=$?; + echo $status; + return $status +} +before: try to assign to FUNCNAME +outside: FUNCNAME = +before: FUNCNAME = func +FUNCNAME = func2 +after: FUNCNAME = func +outside2: FUNCNAME = +function +zf is a function +zf () +{ + echo this is zf +} +f is a function +f () +{ + echo f-x; + echo f-y +} 1>&2 +subshell +f is a function +f () +{ + echo f-x; + echo f-y +} 1>&2 +f2 is a function +f2 () +{ + echo f2-a; + function f3 () + { + echo f3-a; + echo f3-b + } 1>&2; + f3 +} +subshell +f2 is a function +f2 () +{ + echo f2-a; + function f3 () + { + echo f3-a; + echo f3-b + } 1>&2; + f3 +} +f4 is a function +f4 () +{ + echo f4-a; + function f5 () + { + echo f5-a; + echo f5-b + } 1>&2; + f5 +} 2>&1 +subshell +f4 is a function +f4 () +{ + echo f4-a; + function f5 () + { + echo f5-a; + echo f5-b + } 1>&2; + f5 +} 2>&1 +testgrp is a function +testgrp () +{ + echo testgrp-a; + { + echo tg-x; + echo tg-y + } 1>&2; + echo testgrp-b +} +subshell +testgrp is a function +testgrp () +{ + echo testgrp-a; + { + echo tg-x; + echo tg-y + } 1>&2; + echo testgrp-b +} +funca is a function +funca () +{ + ( echo func-a ) +} +funcb is a function +funcb () +{ + ( echo func-b ) +} +funcc is a function +funcc () +{ + ( echo func-c ) 2>&1 +} +func-a +func-b +func-c +foo-bar +foo-bar () +{ + : +} +expect 5 10 +5 10 +expect 20 +20 +expect 5 20 +5 20 +expect 5 30 +5 30 +expect 2 40 +2 40 +expect 5 20 +5 20 +./func4.sub: line 10: foo: maximum function nesting level exceeded (100) +1 +after: f = 100 +./func4.sub: line 10: foo: maximum function nesting level exceeded (100) +1 +after: f = 100 +7 +after FUNCNEST reset: f = 201 +7 +after FUNCNEST unset: f = 201 +./func4.sub: line 10: foo: maximum function nesting level exceeded (20) +1 +after FUNCNEST assign: f = 38 +5 |