pipeseroni / pipes.sh

Animated pipes terminal screensaver
https://pipeseroni.github.io/
MIT License
2.45k stars 75 forks source link

migrate unittest framework from Bats to shunit2 #53

Closed livibetter closed 6 years ago

livibetter commented 6 years ago

There was nothing really wrong about Bats , however one thing I dislike is the use of Bash errexit, which affects how we can write.

For common unittest framework, say, a test function with three assertions, whether each of the assertions fails or passes, all three assertions are evaluated.

But in Bats, the assertions are written as three test [ ], and if first test fails, the rest two won't be evaluated. It's likely we group the three assertions for a reason, and it could also be crucial to get important insights to see all the results of assertions. But with errexit, it's impossible.

Furthermore, errexit doesn't just affect the issue described above, it might also cause unwanted failure when testing a function -- if without using Bats run function -- which may have a command returning non-zero status, and in turn causing the test to fail, even the result of said command doesn't matter by our perspective.

Another issue about Bats is its currently unclear about the future of Bats, even there is a community fork under active development, but the release version is still v0.4.0 (2014-08-13).

Nevertheless, there are a few things that I like about Bats.

shunit2 has none of these.