66# a Bats assertion function complies with the expectations outlined in
77# `$_GO_CORE_DIR/lib/bats/assertions`, namely that it:
88#
9- # - begins with `set "$BATS_ASSERTION_DISABLE_SHELL_OPTIONS "`
10- # - calls `return_from_bats_assertion ` directly via every return path
9+ # - begins with `set "$DISABLE_BATS_SHELL_OPTIONS "`
10+ # - calls `restore_bats_shell_options ` directly via every return path
1111#
1212# They also enforce that the assertion produces no output when successful, and
1313# that it writes only to standard error (`>&2`) when it fails.
3636export TEST_OUTPUT_FILE=" $BATS_TEST_ROOTDIR /test-output.txt"
3737
3838# Path to the script generated by `expect_assertion_*` to test whether
39- # `return_from_bats_assertion ` was called or not.
39+ # `restore_bats_shell_options ` was called or not.
4040readonly ASSERTION_TEST_SCRIPT=" $BATS_TEST_ROOTDIR /assertion-test.bats"
4141
4242# Format for the error message emitted when `ASSERTION_TEST_SCRIPT` fails.
@@ -48,11 +48,11 @@ export ASSERTION_TEST_SCRIPT_FAILURE_MESSAGE=
4848! read -rd ' ' ASSERTION_TEST_SCRIPT_FAILURE_MESSAGE << END_OF_FAILURE_MESSAGE
4949The very first line of '%s' must be
5050
51- set "\$ BATS_ASSERTION_DISABLE_SHELL_OPTIONS "
51+ set "\$ DISABLE_BATS_SHELL_OPTIONS "
5252
53- and it must call 'return_from_bats_assertion ' directly from every return path.
53+ and it must call 'restore_bats_shell_options ' directly from every return path.
5454
55- For details, see the comments for 'return_from_bats_assertion ' from:
55+ For details, see the comments for 'restore_bats_shell_options ' from:
5656
5757 ${BASH_SOURCE%/* } /assertions
5858END_OF_FAILURE_MESSAGE
@@ -62,8 +62,7 @@ END_OF_FAILURE_MESSAGE
6262# Will execute the command and assertion directly using the `run` command to
6363# make sure the condition is satisfied as expected, then it will execute them
6464# in a test script to make sure the assertion calls `set
65- # "$BATS_ASSERTION_DISABLE_SHELL_OPTIONS` and `return_from_bats_assertion`
66- # appropriately.
65+ # "$DISABLE_BATS_SHELL_OPTIONS` and `restore_bats_shell_options` appropriately.
6766#
6867# Arguments:
6968# run_cmd: The full command to pass to `run` as a single string
@@ -90,11 +89,11 @@ expect_assertion_success() {
9089 else
9190 # Although we expect the assertion under test to pass, this script injects a
9291 # failing assertion after it to check that the assertion under test directly
93- # calls `return_from_bats_assertion ` upon returning. If it doesn't, `set
92+ # calls `restore_bats_shell_options ` upon returning. If it doesn't, `set
9493 # -eET` will not be in effect, so the failing assertion will not trigger the
9594 # ERR trap or fail the test case.
9695 #
97- # In an earlier incarnation of `return_from_bats_assertion ` that only
96+ # In an earlier incarnation of `restore_bats_shell_options ` that only
9897 # restored `set -o functrace` (and when tests only started with `set +o
9998 # functrace`, equivalent to `set +T`), the failing assertion would fire the
10099 # ERR trap and exit the test case, but Bats would show the passing
@@ -125,8 +124,7 @@ expect_assertion_success() {
125124# Will execute the command and assertion directly using the `run` command to
126125# make sure the condition fails and the output is as expected, then it will
127126# execute them in a test script to make sure the assertion calls `set
128- # "$BATS_ASSERTION_DISABLE_SHELL_OPTIONS` and `return_from_bats_assertion`
129- # appropriately.
127+ # "$DISABLE_BATS_SHELL_OPTIONS` and `restore_bats_shell_options` appropriately.
130128#
131129# Arguments:
132130# run_cmd: The full command to pass to `run` as a single string
@@ -300,7 +298,7 @@ __check_expected_output() {
300298 fi
301299}
302300
303- # Basically the same as `return_from_bats_assertion `, but specific to this file.
301+ # Basically the same as `restore_bats_shell_options `, but specific to this file.
304302#
305303# Arguments:
306304# result: Return value of the calling assertion; defaults to 0
0 commit comments