curl-library
Re: curl unit testing
Date: Mon, 3 Jan 2011 22:32:18 +0100 (CET)
On Mon, 3 Jan 2011, Amr Shahin wrote:
> Are we still on deciding ? If so i can try compiling with a C98
No, we're not deciding anymore, I've put down my large dictator foot and made
my choice. The answer might still be interesting to someone but I find the
response telling enough. If they don't put efforts into being C89 compliant
they surely will not be that in the long run.
(This should not be read as any sort of criticism against the Check project or
software, it looks neat but isn't really suitable for this project at this
point.)
Right now I'm fiddling with a way to build a separate (static) library to use
for the unit tests and I'm attaching my work so far on that (to be applied on
top of the previous patch).
I tried to build libcurl with -Dstatic= passed to the compiler for the fun of
it, and it shows that when we want to add unit tests for any function that is
currently declared static, we should:
A) use a define for that function's static, perhaps UNITSTATIC or something so
that we can move one function at a time to this and the functions that we
won't bother to unittest we can leave as-is
B) provide prototypes internally for the UNITSTATIC functions as otherwise we
get warnings from picky compilers
Having a separate define also is good as it shows to the reader of the code
that the function is unit-tested so when it is to be changed, the tests might
need to get adjusted.
-- / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
- TEXT/x-diff attachment: 0001-unittesting-build-a-separate-static-lib.patch