Skip to content

Conversation

@FranklinYu
Copy link
Contributor

The test works in GitHub Action environment, but it doesn’t work on all environments. This PR is trying to make the test more robust, and allow it to run on more environments (such as the one I develop on).

The two tests hardcode the error message, so they are language-
dependent.
Otherwise it returns with the last status, and shows misleading error
messages like

    shunit2:WARN oneTimeTearDown() returned non-zero return code.
Otherwise, the developer’s shell configuration might break tests when
running locally.
@FranklinYu
Copy link
Contributor Author

FranklinYu commented Jan 28, 2022

Quote from Bash manual supporting 49c9b49:

If a numeric argument is given to return, that is the function’s return status; otherwise the function’s return status is the exit status of the last command executed before the return.

Example:

func() { return; }

false
func || echo 'Error!'

@FranklinYu FranklinYu marked this pull request as ready for review January 28, 2022 06:48
Copy link
Owner

@postmodern postmodern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor question regarding bash vs zsh with LANG.

@FranklinYu FranklinYu requested a review from postmodern January 30, 2022 09:17
@postmodern postmodern merged commit b14b94b into postmodern:master Jan 30, 2022
@postmodern
Copy link
Owner

Merged!

@FranklinYu FranklinYu deleted the fix-tests branch February 1, 2022 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants