Imported from ../bash-2.05.tar.gz.
[platform/upstream/bash.git] / tests / func.tests
index 8abf4ce..2095f24 100644 (file)
@@ -117,3 +117,44 @@ declare -f f1      # should print the definition, too
 # no functions should be exported, right?
 declare -xF
 declare -xf
+
+# FUNCNAME tests
+func2()
+{
+       echo FUNCNAME = $FUNCNAME
+}
+
+func()
+{
+       echo before: FUNCNAME = $FUNCNAME
+       func2
+       echo after: FUNCNAME = $FUNCNAME
+}
+
+echo before: try to assign to FUNCNAME
+FUCNAME=7
+
+echo outside: FUNCNAME = $FUNCNAME
+func
+echo outside2: FUNCNAME = $FUNCNAME
+
+# test exported functions (and cached exportstr)
+zf()
+{
+       echo this is zf
+}
+export -f zf
+
+${THIS_SH} -c 'type -t zf'
+${THIS_SH} -c 'type zf'
+
+${THIS_SH} ./func1.sub
+
+# tests for functions whose bodies are not group commands, with and without
+# attached redirections
+${THIS_SH} ./func2.sub
+
+# test for some posix-specific function behavior
+${THIS_SH} ./func3.sub
+
+exit 0