[ccan] [PATCH 7/9] darray: test: only use darray_make_room() if we HAVE_STATEMENT_EXPR

Cody P Schafer dev at codyps.com
Sun Jun 22 04:25:14 EST 2014


On Sat, Jun 21, 2014 at 3:31 AM, Rusty Russell <rusty at rustcorp.com.au> wrote:
> Cody P Schafer <dev at codyps.com> writes:
>> CC: Joseph Adams <joeyadams3.14159 at gmail.com>
>> Signed-off-by: Cody P Schafer <dev at codyps.com>
>
> I can't generally apply these, since it's Joey's module, but one
> comment:
>
>> ---
>>  ccan/darray/test/run.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/ccan/darray/test/run.c b/ccan/darray/test/run.c
>> index 3d96fa5..b652948 100644
>> --- a/ccan/darray/test/run.c
>> +++ b/ccan/darray/test/run.c
>> @@ -38,7 +38,7 @@ int main(void) {
>>       trace("Generating amalgams (internal)");
>>       generateAmalgams();
>>
>> -     plan_tests(41);
>> +     plan_tests(38 + HAVE_STATEMENT_EXPR * 3);
>
> This breaks autoconf-generated config.h, since this won't be defined.

autoconf generated? This is in tests, do we even expect autoconf
(instead of ccan's configurator) to be used to generate the config for
tests?

That said:

> Better is probably to do:
>
>> +#if HAVE_STATEMENT_EXPR
>>       testing(darray_make_room);
>>       {
>>               for (i=0; i < ARRAY_SIZE(lotsOfStrings); i++) {
>> @@ -233,6 +234,7 @@ int main(void) {
>>               ok1(!strcmp(str.item, amalgams.stringsF));
>>       }
>>       reset(str);
>> +#endif
>
> #else
>         skip(3, "Need HAVE_STATEMENT_EXPR to test darray_make_room");
> #endif

Yep, that looks much nicer.


More information about the ccan mailing list