Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@soda480
Copy link

@soda480 soda480 commented Mar 7, 2024

Having such a variable is useful for use cases where downstream functions can call bats with the original arguments, for example I am defining a setup_suite to automatically generate a coverage report and badge, I can use this variable like:

coverage() {
    if which kcov; then
        echo "# generating coverage report using kcov" >&3
        # strip --setup-suite-file argument to prevent infinite loop condition
        kcov --include-path=$WORK_DIR $WORK_DIR/coverage bats ${BATS_ARGS%--setup-suite-file*}
        coverage_badge
    else
        echo "# unable to generate coverage report because kcov is not installed" >&3
    fi
}

@soda480 soda480 requested a review from a team as a code owner March 7, 2024 18:09
@martin-schulze-vireso
Copy link
Member

I think we have to take more care with separators. Maybe printf -v BATS_ARGS '%q ' "$@"?

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