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

Rusty Russell rusty at rustcorp.com.au
Sat Jun 21 17:31:15 EST 2014


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.

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

Cheers,
Rusty.


More information about the ccan mailing list