* In your project, create a tests/ directory. This directory will contain a number of *.sh files. You can have any number of test functions in them, named "shunittest_***".
* Only functions in the *sh files named "shunittest_" will be executed.
* Doing anything other than "source" at the top level of your *sh test file is considered Very Bad Form (tm)
* We don't care what your shunittest_ functions do, except that they MUST:
* Exit 0 to indicate that the test has succeeded, - OR -
* Print something informative to stderr, and Exit 1 to indicate that the test failed
shunit is just a set of bash functions for producing unit test output from bash scripts. I wrote this library because I often found myself writing things in bash whose output I wanted to consume as discrete pass/fail tasks into Bamboo, so I wrote the junit functions. Then later on, I got sick and tired of (as a human) reading junit output, so I wrote the tunit functions, so my scripts could output tunit or junit depending on which flags I passed.
Complete documentation is inside the functions (each function has --help) in ./lib/*unit.sh. A pair of complete examples are in tests/*unit.sh.
This library should not be confused with shunit2 (http://shunit2.googlecode.com/svn/trunk/source/2.1/doc/shunit2.html). They are completely unrelated! I didn't even know shunit2 existed until long after I made this.
shunit2 seems neat, but I prefer shunit's style. shunit2 looks like it's trying to be a java-ish unit testing library, and doesn't operate very much like bash. shunit is much simpler; you don't need to know any assert commands, special constants, or how to report failure. You do your tests however you want, report error on stderr, return non-zero to indicate failure. It doesn't get much simpler than that!