-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Foundation for strictmode #241
Conversation
A few different kinds of changes are made: - Optional parameters/variables are changed to ${var-} to default to empty or given defaults with ${var=...}. - ((...)) arithmetic evaluation "fails" when the result happens to be zero, so silence this with "|| true"
This will help ensure that bashunit won't cause problems with tests that use "set -euo pipefail"
Support Bash "strict mode" (and fix one unit test)
df78662
to
e464032
Compare
Conflicts: CHANGELOG.md src/console_results.sh src/env_configuration.sh src/runner.sh
for some reason, having this set in all test files make some tests to break, and this needs some investigation. Therefore, to unblock the valid changes and enable merging them asap into main, I will remove that line from everywhere, and we can add it in a follow up PR.
Adding For example, And with the debug mode enabled we can already see something, but still is not clear how to fix it: Maybe @djpohly, @cmayo, @staabm might have some idea on this? 🤔
|
no ideas on my end to this - sorry. |
📚 Description
Original PR: #239 by @djpohly
Some script authors like to use "unofficial Bash strict mode", enough so that supporting it shows up in comparisons of shell testing frameworks.
Case in point: enabling the -u option uncovered a bug in
test_unsuccessful_assert_is_directory_not_writable
that is fixed in this PR.🔖 Changes
$a_file
was supposed to be$a_directory
).((...))
, which exit 1 if their result happens to be zero, are fixed with|| true
.check_duplicate_functions
does not appear to be intended to cause the script to fail, so it is also silenced with|| true
.${1-}
."${varname=default}"
.🏗️ Follow up
set -euo pipefail
to all tests. Currently not possible; needs some more investigation [wip]✅ To-do list
CHANGELOG.md
to reflect the new feature or fix