-
Notifications
You must be signed in to change notification settings - Fork 440
Closed
Labels
Component: Bash CodeEverything regarding the bash codeEverything regarding the bash codePriority: CriticalBroken behavior in nearly all environments, e.g. wrong test results, internal bats errorBroken behavior in nearly all environments, e.g. wrong test results, internal bats errorStatus: ConfirmedThe reproducer worked as describedThe reproducer worked as describedType: Bug
Milestone
Description
Describe the bug
Invoking the run
command with --keep-empty-lines
causes an empty line to be appended to the end of the output.
To Reproduce
bats_require_minimum_version 1.9.0
f::lines() {
echo "Line #1"
echo "Line #2"
}
@test "f::lines produces only 2 lines -- Test shows 2 lines, 0 empty lines" {
run f::lines
[ "${lines[0]}" == "Line #1" ]
[ "${lines[1]}" == "Line #2" ]
[ "${#lines[*]}" -eq 2 ]
}
@test "f::lines produces only 2 lines -- --keep-empty-lines adds an empty line to output" {
run --keep-empty-lines f::lines
[ "${lines[0]}" == "Line #1" ]
[ "${lines[1]}" == "Line #2" ]
## Third line exists and is empty
[ "${lines[2]}" == "" ]
[ "${#lines[*]}" -eq 2 ]
}
Expected behavior
Empty lines in the output should be preserved and no additional empty lines are added.
Environment (please complete the following information):
- Bats Version: 1.9.0
- OS: MacOS 13.2.1
- Bash version: 5.2.15
Metadata
Metadata
Assignees
Labels
Component: Bash CodeEverything regarding the bash codeEverything regarding the bash codePriority: CriticalBroken behavior in nearly all environments, e.g. wrong test results, internal bats errorBroken behavior in nearly all environments, e.g. wrong test results, internal bats errorStatus: ConfirmedThe reproducer worked as describedThe reproducer worked as describedType: Bug