-
Notifications
You must be signed in to change notification settings - Fork 441
Closed
Labels
Description
Describe the bug
The value of a variable i
gets overwritten if run
uses any flags.
To Reproduce
Steps to reproduce the behavior:
- Create the file a.bats:
bats_require_minimum_version 1.5.0
@test i {
for ((i=0; i<3; i++)) {
echo before $i
run ! false
echo after $i
}
}
- Run it:
bats --show-output-of-passing-tests a.bats
- See what happens:
before 0
after 2
Expected behavior
I have expected the following output:
before 0
after 0
before 1
after 1
before 2
after 2
Environment (please complete the following information):
- Bats Version: 1.9.0
- OS: Linux
- Bash version: 5.2.15
Additional context
A variable i
is not declared as local in a few functions in common.bash.