Files
sausage/userland/brush/source/brush-shell/tests/cases/compat/builtins/local.yaml
T
2026-11-11 22:04:16 +00:00

38 lines
832 B
YAML

name: "Builtins: local"
cases:
- name: "Basic local usage"
stdin: |
myfunc() {
local x=10
echo "in myfunc: x==$x"
}
x=5
echo "before call: x==$x"
myfunc
echo "after call: x==$x"
- name: "Local with empty array"
stdin: |
myfunc() {
local x=()
declare -p x
echo "x[0]: ${x[0]}"
}
myfunc
- name: "Multiple local operands expand before assignments are applied"
stdin: |
myfunc() {
unset first second
local first=one second=$first
declare -p first second
}
myfunc
- name: "local outside a function is refused before its options are read"
known_failure: true # TODO(local): brush reads options first
ignore_stderr: true
stdin: |
local -Z
echo "local: $?"