Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more tests #46

Merged
merged 1 commit into from
Jan 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .test/config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

# https://github.com/docker-library/official-images/blob/618a85a87796c8bbea059011d94d888dc7554158/test/config.sh

imageTests+=(
[bash]='bash-optional-features'
)
49 changes: 49 additions & 0 deletions .test/tests/bash-optional-features/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash
set -Eeuo pipefail

# there's a lot of commands we expect Bash to have, but that it might not due to compilation quirks
# see https://github.com/tianon/docker-bash/pull/45
# and https://www.gnu.org/software/bash/manual/html_node/Optional-Features.html#:~:text=unless%20the%20operating%20system%20does%20not%20provide%20the%20necessary%20support

image="$1"

args=( --rm --interactive )
if [ -t 0 ] && [ -t 1 ]; then
args+=( --tty )
fi

docker run "${args[@]}" "$image" -Eeuo pipefail -xc '
# --enable-array-variables 😏
cmds=(
# --enable-alias
alias unalias
# --enable-command-timing
time
# --enable-cond-command
"[["
# --enable-directory-stack
pushd popd dirs
# --enable-disabled-builtins
builtin enable
# --enable-help-builtin
help
# --enable-history
fc history
# --enable-job-control
bg fg jobs kill wait disown suspend
# --enable-progcomp
complete
# --enable-select
select
)
if [ "${BASH_VERSINFO:-0}" -ge 4 ]; then
# Bash 3.0 does not support arr+=( ... ) and balks at this syntax even in an optional block 😂
cmds=( "${cmds[@]}"
# --enable-coprocesses
coproc
)
fi
for cmd in "${cmds[@]}"; do
PATH= command -v "$cmd"
done
'
Loading