Re: [hackers] [sbase][PATCH v2] Add tests for some utilities

From: Silvan Jegen <s.jegen_AT_gmail.com>
Date: Fri, 3 Aug 2018 15:09:57 +0200

Hi Roberto

On Fri, Aug 3, 2018 at 8:32 AM, Roberto E. Vargas Caballero
<k0ga_AT_shike2.com> wrote:
> 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.

Yeah, the shell functions I wrote compare the output of a tool with
the expected output. Calling that a functional test is more accurate
than calling it a unit test.


>> 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.

The shell script functions I posted are only marginally bigger than
[1] and could be reused for all tests. What we would end up with when
using those wouldn't be much different than what you are using for
your tests.


Cheers,

Silvan


>> 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
>
Received on Fri Aug 03 2018 - 15:09:57 CEST

This archive was generated by hypermail 2.3.0 : Fri Aug 03 2018 - 15:12:22 CEST