[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] cmocka: Allow to pass initial data to test cases


Hello

On 07/01/2015 10:18 AM, Andreas Schneider wrote:

You can still achieve that by creating a function you call at the beginning of
the test which init's the state based on the function name or with a setup
function.

#define init_state(state) _init_state(state, __func__);
void _init_state(void **state, const char *function)
{
	if (strcmp(function, "mytest1") {
		*state = "my string";
	}
}

void mytest1(**state) {
	init_state(state);

	do something;
}

The patch breaks the API. It would mean that all the projects using cmocka
would break with a new release. I do not want to do that.


I do not see how this breaks the API. All unit_test macros are not changed from user point of view. Even when you want to manually initialize CMUnitTest structure, initial_state field can be left uninitialized and nothing bad happens when you don't use new functionality.


Follow-Ups:
Re: [PATCH] cmocka: Allow to pass initial data to test casesKrzysztof Opasiak <k.opasiak@xxxxxxxxxxx>
References:
Re: [PATCH] cmocka: Allow to pass initial data to test casesAndreas Schneider <asn@xxxxxxxxxxxxxx>