[Geany-devel] Unit tests for Geany (continued from Github)

Matthew Brush mbrush at xxxxx
Wed Nov 30 07:17:03 UTC 2011


On 11/29/2011 10:36 PM, Nathan Broadbent wrote:

> As long as your headers are C++-compatible (not using C++ keywords,
> export symbols with correct linkage), it should be fine.
>

At one point, out of curiosity, I tried to make a C++ plugin for Geany 
and the compiler choked on some keywords (`template` comes to mind, some 
other too I'm sure).  It probably wouldn't be a big deal to make the 
needed changes though.


>>   3) Who's going to do it :)
>>
>>   If you want to help with this, I'm sure it would be appreciated.
>
> I could help start it off, but it would have to be an on-going thing.
> I wouldn't have the time to sit down and write tests for the whole
> application. Each developer could get into the habit of writing a test
> whenever they change something or add a new feature.
>

Yeah, I meant more with getting it all rigged up in the first place and 
maybe putting some info on the wiki how to use it.

>
>> The only real restriction IMO is that it not add any dependencies to the
>>   application or build system under normal conditions.  For example, it would be a bummer to make Joe Hacker have to install some exotic
>> unit testing framework libraries just to do a `make&&  make install`.
>
> I totally agree with not adding dependencies under normal conditions,
> and I don't think that will be an issue if the code is written well.
> Test-driven development often enforces particular design patterns, so
> there will probably need to be some refactoring involved.
>

Geany uses a lot of global variables/state, so the individual functions 
sometimes are pulling in context from the running instance, bypassing 
function parameters and return values, that would be harder to test 
probably.

The only way I can see it would actually work - keeping in mind I don't 
have much experience with unit testing - is that you would have to 
launch an instance of the GUI and for some functions even simulate mouse 
clicks or key presses and then read the display pixels or global geany 
variables/state afterwards and see if it passes the tests.

>
> To be honest, the real reason that I started talking about unit tests,
> is because I really need them in order to write a lexer for scintilla.
> Manual testing for lexers would be a nightmare.
>

That sounds much more approachable than doing it for Geany :)

Cheers,
Matthew Brush



More information about the Devel mailing list