MoonUnit
|
Macros to access resource strings. More...
Macros | |
#define | MU_RESOURCE(key) |
Access a resource string. More... | |
#define | MU_RESOURCE_FROM_SECTION(section, key) |
Access a resource string in a specific section. More... | |
This module contains macros and functions to access externally-defined resource strings, allowing unit tests to be parameterized. This is useful to avoid hard-coding constants or to abstract out certain external resources such as the location of a file or the name of a remote host.
#define MU_RESOURCE | ( | key | ) |
This macro finds the resource string for the given key, searching through available resource sections until a match is found. A section will be searched for the key if the section's name is a slash-separated path of the form library/suite/test which matches that of the current test. The section name may be a glob. The "global" section is also searched after all other eligible sections. If no key is found, the test immediately fails.
Example:
#define MU_RESOURCE_FROM_SECTION | ( | section, | |
key | |||
) |
This macro returns the resource string for the given key in a specific section. This macro does not perform the search procedure used by MU_RESOURCE. If the given key is not found, the test immediately fails.
Example: