maint(common): address builder.sh test script review comments

Co-authored-by: Marc Durdin <marc@durdin.net>
This commit is contained in:
Joshua Horton 2025-05-05 12:36:01 +07:00
parent 85046ceb6d
commit 519a5b79e9

View file

@ -90,7 +90,7 @@ builder_parse_test() {
local expected="$1"
local expected_options="$2"
# Minor override for local testing of builder-script mechanics: --debug will always be added.
# When testing in a local environment, --debug will be added by default (see #11106)
if [[ $VERSION_ENVIRONMENT == "local" ]]; then
expected_options="${expected_options} --debug"
fi
@ -104,8 +104,6 @@ builder_parse_test() {
builder_die " Test: builder_parse $parameters action:target != \"$expected\""
fi
if [[ "${expected_options}" != "${_builder_chosen_options[@]}" ]]; then
echo "${_builder_chosen_options[@]}"
echo "${_builder_chosen_options[@]}"
builder_die " Test: builder_parse $parameters, options != \"${expected_options}\""
fi
}
@ -194,11 +192,8 @@ parse_output=$(builder_parse --feature xyzzy --bar abc --baz def test)
expected="$(builder_echo setmark "test.sh parameters: <--feature xyzzy --bar abc --baz def test>")"
if [[ $VERSION_ENVIRONMENT == "local" ]]; then
expected="$(builder_echo setmark "test.sh parameters: <--feature xyzzy --bar abc --baz def test --debug>")"
# Yay, the fun of getting the second line... that newline before the closing brace is intentional. :(
parse_output=${parse_output#*
}
# When run in a local-dev environment, an extra line appears about the automatic --debug option.
expected="$(builder_echo grey "Local build environment detected: setting --debug")"$'\n'"$(builder_echo setmark "test.sh parameters: <--feature xyzzy --bar abc --baz def test --debug>")"
fi
if [[ "${parse_output[*]}" != "${expected}" ]]; then
builder_die "FAIL: Wrong output for '--feature xyzzy --bar abc --baz def test':\n Actual : ${parse_output[*]}\n Expected: ${expected}"