Open mvalin opened 7 years ago
This is the expected behaviour. This has to do with how bats processes test files, and the explanation is the same as to your other question in #185.
Thank you for your answer, I understand your point, and it is clear, but I can't realize why this doesn't work:
filetail=/etc/motd.tail
@test "Check ${filetail} for WARNING!!!" {
run grep -qse "WARNING \!\!\!" ${filetail}
[ ${status} -eq 0 ]
}
filemotd=/etc/motd
@test "Check ${filemotd} for WARNING!!!" {
run grep -qse "WARNING \!\!\!" ${filemotd}
[ ${status} -eq 0 ]
}
Because this works with others contents but not with this in particular, I used in other cases, but with this particular content doesn't work.
Do you have any idea?
Regards
Hi, I have a question, I realized that you can't use variables in the same ways as bash files inside bats, for instance for the next file:
All the test is done using /home/file2, for both test, although in the first one I set /home/file1. To try to solve that issue I set different variables, as follow:
With this workaround works. But I found one situation where the error persist and I couldn't solve using variables, I have to hard code the filenames, the case is the following:
And the output is as follow:
Always, it is used the last valor of the variable, if I change the order, the output is:
I don't know if this behavior is by design, but I'd like to use variables, is there a way to solve that or it uses a workaround.
Regards