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

DRAFT: BATS: unofficial strict mode #2032

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

gaelicWizard
Copy link
Contributor

@gaelicWizard gaelicWizard commented Jan 11, 2022

Description

This branch adds set -Eeuo pipefail to the bottom of setup(), so each test is run with extremely strict environment.

Motivation and Context

Hence Chapter 4. This will help to prevent regressions, as well as catch omissions that shellcheck misses (like unbound positional parameters).

How Has This Been Tested?

This is built in top of my precommit branch (#2033), so the *.bats tests themselves are already fairly tight, so this PR is just for actually applying the strictness to the main code.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code follows the code style of this project.
  • If my change requires a change to the documentation, I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • If I have added a new file, I also added it to clean_files.txt and formatted it using lint_clean_files.sh.
  • I have added tests to cover my changes, and all the new and existing tests pass.

@gaelicWizard gaelicWizard force-pushed the bats-nounset branch 30 times, most recently from 6b5ddbd to 76f3f6b Compare January 12, 2022 06:45
gaelicWizard and others added 13 commits March 4, 2022 14:17
BATS: add `*.bats` to `.gitattributes`
test: don't clobber `$PATH`

BATS depends on `$PATH` somehow and if not handled properly, modifying `$PATH` breaks BATS badly. But, it doesn't seem like we have any reason to modify `$PATH` in the first place...so don't.

test/svn: don't clobber `$PATH`
test/ruby: don't clobber `$PATH`
test/search: don't clobber `$PATH`
Make library loading overridable default for all tests, up through "seach".
My apologies to future `git blame` hunters ♥
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.

1 participant