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
