bunpen: cleanup the integration test infrastructure
This commit is contained in:
@@ -1,16 +1,49 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -xeu
|
||||
set -eu
|
||||
|
||||
# trivial:
|
||||
bunpen --bunpen-path / $(which true)
|
||||
die() {
|
||||
echo "$1"
|
||||
return 1
|
||||
}
|
||||
|
||||
test_01_trivial() {
|
||||
bunpen --bunpen-path / /usr/bin/env true
|
||||
}
|
||||
|
||||
# invoke by path
|
||||
bunpen --bunpen-path / true
|
||||
test_02_invoke_by_path() {
|
||||
bunpen --bunpen-path / true
|
||||
}
|
||||
|
||||
# invoke disabled
|
||||
test_03_disable_by_env_var() {
|
||||
BUNPEN_DISABLE=1 bunpen true
|
||||
}
|
||||
|
||||
# propagate exit code when disabled (i.e. it exec's)
|
||||
test_04_propagates_rc_when_disabled() {
|
||||
BUNPEN_DISABLE=1 bunpen false && exit false || true
|
||||
}
|
||||
|
||||
# propagate exit code
|
||||
test_05_propagates_rc() {
|
||||
bunpen --bunpen-path / false && exit false || true
|
||||
}
|
||||
|
||||
# forwards stdout
|
||||
stdout=$(bunpen --bunpen-path / echo "hello")
|
||||
test "$stdout" -eq "hello"
|
||||
test_06_forwards_stdout() {
|
||||
local stdout=$(bunpen --bunpen-path / echo "hello")
|
||||
test "$stdout" -eq "hello"
|
||||
}
|
||||
|
||||
# forwards exit code
|
||||
bunpen --bunpen-path / false && exit false || true
|
||||
for f in $(declare -F); do
|
||||
if [[ "$f" =~ test_* ]]; then
|
||||
echo -n "$f: ..."
|
||||
"$f" && echo " SUCCESS" || die " FAIL"
|
||||
fi
|
||||
done
|
||||
|
||||
# for n in {01..06}; do
|
||||
# $("test_$n_*)
|
||||
# done
|
||||
|
Reference in New Issue
Block a user