Closed utkarsh-aepl closed 5 months ago
Hi.
This is the first time I've heard this request. It's not a name which can be configured with settings at the moment. That's not to say there isn't a workaround, though.
A couple of options:
One option is that you can add a simple #define to do the job:
#define setUp() set_up()
#define tearDown() tear_down()
This could also be done at the command line (as part of your call to the compiler). For example, if you're using gcc:
-DsetUp=set_up -DtearDown=tear_down
Finally, you could add a unity_config.h
file (see option UNITY_INCLUDE_CONFIG_H
in UnityConfigurationGuide.h
). In the unity_config.h
file, you can add helpful settings, customer assertions, and helper functions. This can include the define above OR this:
extern void set_up();
extern void tear_down();
void setUp(void) {
set_up();
}
void tearDown(void) {
tear_down();
}
Thanks for the help. I went with the unity_config.h
approach.
I'm working on a project that enforces snake_case casing for function names. For consistency reasons, is there any way I can tell Unity to use function names like
set_up
andtear_down
?