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/procsub.tests | |
parent | Initial commit. (diff) | |
download | bash-upstream/5.0.tar.xz bash-upstream/5.0.zip |
Adding upstream version 5.0.upstream/5.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/procsub.tests | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/tests/procsub.tests b/tests/procsub.tests new file mode 100644 index 0000000..01ba46a --- /dev/null +++ b/tests/procsub.tests @@ -0,0 +1,105 @@ +# process substitution constructs that have caused problems in the past +. ./test-glue-functions + +eval cat <(echo test1) +eval "echo foo;cat" <(echo test2) + +unset f +f=<(echo test3); cat "$f" + +unset f +eval f=<(echo test4) "; cat \$f" + +unset f + +FN=$TMPDIR/bashtest-procsub-$$ +cat >"$FN" <<EOF +echo "test 12" | wc -c | _cut_leading_spaces +cat "\$1" +EOF + +source "$FN" <(echo test5) +rm -f "$FN" +unset FN + +cat <( echo test6 ) <( echo test7 ) +cat <( echo test8 ; sleep 2; echo test8a ) <( echo test9 ) + +# Zev Weiss 11/7/2012 +fn() { cat | cat "$1"; } +fn <(:) < /dev/null + +unset -f fn + +f1(){ + cat $1 + date >/dev/null +} +f2(){ + date >/dev/null + cat $1 +} +cat <(echo hi) +f1 <(echo bye) +f2 <(echo l8r) + +unset -f f1 f2 + +# set up conditions for test +ulimit -n 256 + +bug() +{ +c=$(ulimit -n) +let c+=100 +while let c-- +do + while read -ru3 x + do + echo -n : + done 3< <(echo x) +done +echo +} + +bug +unset -f bug + +count_lines() +{ + wc -l < $1 + +# case "$1" in +# *sh-np*) [ -e "$1" ] || { echo 0; echo 0; echo 0; echo 0; return; } ;; +# *) ;; +# esac + + wc -l < $1 + wc -l < $1 + true | wc -l < $1 + wc -l < $1 +} + +echo intern +count_lines <(date) | _cut_leading_spaces +unset -f count_lines + +echo extern +FN=$TMPDIR/bashtest-$$ +cat >$FN << \EOF +wc -l < $1 +wc -l < $1 +wc -l < $1 +true | wc -l < $1 +wc -l < $1 +EOF + +${THIS_SH} -c "source $FN <(date)" | _cut_leading_spaces +rm -f $FN + +moo() { ls -l "$1" >/dev/null; ls -l "$1" >/dev/null; }; moo >(true) +moo() { ls -al "$1" >/dev/null; (true); ls -al "$1" >/dev/null; }; moo >(true) + +unset -f moo + +${THIS_SH} ./procsub1.sub |