-
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: HighBroken behavior in specific environments like in parallel mode or only on some operating systemsBroken behavior in specific environments like in parallel mode or only on some operating systemsType: BugType: Enhancement
Milestone
Description
The bats code involved is also related to: #151
The faulty code is here
run() {
local origFlags="$-"
set +eET
local origIFS="$IFS"
output="$("$@" 2>&1)"
status="$?"
IFS=$'\n' lines=($output)
IFS="$origIFS"
set "-$origFlags"
}
Reproduce:
#!/bin/bash
usage() {
cat << EOT
pipo
molo
EOT
}
@test "test lines with empty line" {
run usage
echo "$output" >> log
num_lines=$(wc -l <<<"$output")
[[ $num_lines -eq 3 ]]
n=${#lines[@]}
for i in $(seq 0 $((n - 1)))
do
echo "$i:${lines[$i]}" >> log
done
[[ ${lines[0]} == "pipo" ]]
[[ ${lines[1]} == "" ]]
[[ ${lines[2]} == "molo" ]]
[[ $num_lines -eq ${#lines[@]} ]]
}
I suppose that fixing it will introduce some outside test failure based on this bugged behavior.
Metadata
Metadata
Assignees
Labels
Component: Bash CodeEverything regarding the bash codeEverything regarding the bash codePriority: HighBroken behavior in specific environments like in parallel mode or only on some operating systemsBroken behavior in specific environments like in parallel mode or only on some operating systemsType: BugType: Enhancement