Skip to content

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 gaelicWizard force-pushed the bats branch 5 times, most recently from 45e6985 to 6c7616f Compare December 28, 2021 21:49
@gaelicWizard
Copy link
Contributor Author

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

@gaelicWizard gaelicWizard changed the title tests: improvements to quoting and verbosity tests: path quoting and boilerplate Jan 1, 2022
@gaelicWizard gaelicWizard force-pushed the bats branch 2 times, most recently from dc67273 to cace1cb Compare January 4, 2022 02:02
@gaelicWizard gaelicWizard requested a review from NoahGorny January 4, 2022 02:03
@gaelicWizard gaelicWizard force-pushed the bats branch 2 times, most recently from 3272aa5 to 723bebd Compare January 7, 2022 03:17
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