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

tests: path quoting and boilerplate #2002

Merged
merged 10 commits into from
Jan 8, 2022
Merged

Conversation

gaelicWizard
Copy link
Contributor

Description

All tests now run when there are spaces in $BASH_IT, and boilerplate removed from the top of most test files.

Motivation and Context

As I'm learning BATS, I'm cleaning up duplicate code and hopefully making the tests faster and more reliable. There's more to do! This is just my first pass.

How Has This Been Tested?

I run the tests manually myself, and alsö through GitHub Actions.

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 marked this pull request as ready for review December 28, 2021 21:16
@gaelicWizard
Copy link
Contributor Author

:grumble grumble: the OSX.11 test runner is so slow that it fails the plugin/cmd-returned-notify test!!

Copy link
Member

@NoahGorny NoahGorny left a comment

Choose a reason for hiding this comment

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

We could add test/run to clean_files.txt as well

For testing non-core files, just `load ../test_helper_libs` after `load ../test_helper` instead of trying to guess which libs must be loaded, in which order, for testing to succeed.

`_command_exists` spews log messages, so our test log is littered with `_log_debug not found`. This fixes that too.
Literally copying a line from the source to be tested is perhaps not the best way to test that code. 😉

That said, we do want to verify that the function was actually loaded.

TODO: actually test the function.
Test was failing only on Mac OS X for some reason, so refactor a little. It turned out to be due to explicitly setting `$HOME` *after* loading the plugin.
This subshell is...wut
Symlink `/test_lib/bats-core/test/fixtures/parallel/suite/helper.bash` references a not-existing file, but it's in a submodule so I can't just fix it. Exclude it from `rsync` in `setup_test_fixture()`.
Copy link
Member

@NoahGorny NoahGorny left a comment

Choose a reason for hiding this comment

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

Horray!
Great work @gaelicWizard

@NoahGorny NoahGorny merged commit 4ec1b5f into Bash-it:master Jan 8, 2022
@gaelicWizard gaelicWizard deleted the bats branch January 9, 2022 02:01
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