bats/helpers: Add run convenience functions#196
Merged
Conversation
Also adds `restore_programs_in_path`, which allows a single call to remove multiple command stub scripts. `run_test_script` creates and runs a test script in one step, so that `create_bats_test_script` and `run` need not be called separately. `run_bats_test_suite` is a specialized version of `run_test_script` specifically for generating and running Bats test cases. `run_bats_test_suite_in_isolation` is an even more specialized version of `run_bats_test_suite` to ensure that `PATH` is restricted to `BATS_TEST_BINDIR` and the Bats `libexec/` directory within the suite. Along with `stub_program_in_path` and `create_forwarding_script`, this is useful for testing helper functions whose behavior depends on the available system commands, such as `skip_if_...` helpers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also adds
restore_programs_in_path, which allows a single call to remove multiple command stub scripts.run_test_scriptcreates and runs a test script in one step, so thatcreate_bats_test_scriptandrunneed not be called separately.run_bats_test_suiteis a specialized version ofrun_test_scriptspecifically for generating and running Bats test cases.run_bats_test_suite_in_isolationis an even more specialized version ofrun_bats_test_suiteto ensure thatPATHis restricted toBATS_TEST_BINDIRand the Batslibexec/directory within the suite. Along withstub_program_in_pathandcreate_forwarding_script, this is useful for testing helper functions whose behavior depends on the available system commands, such asskip_if_...helpers.