Hi, On Wed, Aug 01, 2018 at 04:36:35PM +0200, Silvan Jegen wrote: > I definitely think we should have unit tests for sbase (and other > projects?) as soon as possible. What concerns me with your approach is > that we have about 700 lines of C code in testing-common.{c,h} of which > I feel quite a bit could be dropped.
No, unit test no.What sbase needs is functional tests. Take a look to [1], [2] and [3]. You don't need anything else. > > I have written some (crappy and probably non-portable) shell script > functions to check the stdout and stderr of a process. It's about 40 > lines. I also converted your tests for dirname to use these functions > (both files attached. The test coverage is not exactly the same but > relatively similar). They are totally bloated. You don't need a framework, you only need a shell script that returns success or fail for every test. and after that, you only have to run over all the test files in the directory. > What do you think? Totally bloated. If you want, you can take a look to the full test structure in scc. Regards. [1] https://git.simple-cc.org/scc/file/tests/ar/execute/0001-append.sh.html [2] https://git.simple-cc.org/scc/file/tests/ar/execute/chktest.sh.html [3] https://git.simple-cc.org/scc/file/tests/ar/execute/Makefile.html