Ceedling icon indicating copy to clipboard operation
Ceedling copied to clipboard

Configure test function prefix?

Open sison54 opened this issue 5 years ago • 5 comments

Is it true that the function prefix is not configurable? The Test Files & Executable Test Fixtures section of the doc says:

There are no configuration options for the naming convention of your test case functions. A test case function signature must have these three elements: void return, void parameter list, and the function name prepended with lowercase "test"

Thoughts on making this configurable? Is there some issue on why this isn't supported? How difficult would it be?

Thanks

sison54 avatar Nov 23 '20 21:11 sison54

Hi this is configurable with :test_file_prefix: test_ in your yaml project file.

JuPrgn avatar Nov 24 '20 07:11 JuPrgn

I am talking about the test function. Not the test file.

sison54 avatar Nov 24 '20 08:11 sison54

Hi. I'll need to fix that part of the documentation. It is incorrect (outdated).

In the :unity section of the config file, you want to set the :test_prefix string. This string is set to test|spec|should by default, which means it will accept tests with any of these names:

void testThis(void);
void test_AlsoThis(void);
void specification(void);
void spec_ForSomething(void);
void should_prove_things_work(void);
//etc. you get the idea.

mvandervoord avatar Nov 24 '20 12:11 mvandervoord

Awesome, that works. Thanks!

sison54 avatar Nov 24 '20 15:11 sison54

It works. Thank you

binarymaker avatar Feb 27 '23 11:02 binarymaker