mbland / go-script-bash

Framework for writing modular, discoverable, testable Bash scripts
ISC License
96 stars 16 forks source link

bats/helpers: Add `run` convenience functions #196

Closed mbland closed 7 years ago

mbland commented 7 years ago

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.

coveralls commented 7 years ago

Coverage Status

Coverage increased (+0.03%) to 94.68% when pulling 0c0536ae092d755f96a0cbc38d8cc4d8e404a85c on run-script-helpers into 736eb125690d53a4de779add306672a2f506bbec on master.