Add test that all declared functions are inherited when marked for export

This commit is contained in:
Eric Levy 2022-01-25 16:56:06 -05:00
parent 9a81e1d831
commit 747bb59322
2 changed files with 18 additions and 0 deletions

View File

@ -5,3 +5,4 @@ subshell-source
subshell-export
function-list
function-unload
function-export

17
meta-tests/function-export.sh Executable file
View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
list_function_names() {
declare -F | while read l; do echo ${l/#* /}; done | sort
}
declare -xf list_function_names
f_orig=$(list_function_names)
source ./mo
moExport
f=$(bash -c list_function_names)
f_new=$(comm -13 <(echo $f_orig | tr ' ' '\n') <(echo $f | tr ' ' '\n'))
diff <(echo $f_new | tr ' ' '\n') <(moListFuncs | sort)