diff options
Diffstat (limited to 'test/config.c')
| -rw-r--r-- | test/config.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/config.c b/test/config.c new file mode 100644 index 0000000..8a1dc64 --- /dev/null +++ b/test/config.c @@ -0,0 +1,21 @@ + +#include "kpl_test.h" + +KPL_TEST(config_show_help) { + kpl_config config; + const int32_t argc = 2; + const char *argv[] = { "./kpl", "--help", "not_used" }; + kpl_config_init(&config); + int32_t code = kpl_config_parse_args(&config, argc, argv); + KPL_ASSERT(code == KPL_EXIT_CODE_HELP, "Invalid help exit code"); +} + +KPL_TEST(config_change_module_extension) { + kpl_config config; + const int32_t argc = 3; + const char *argv[] = { "./kpl", "--module-extension=.l", "./file.l" }; + kpl_config_init(&config); + int32_t code = kpl_config_parse_args(&config, argc, argv); + KPL_ASSERT(code == KPL_EXIT_CODE_SUCCESS, "Invalid exit code"); + KPL_ASSERT(strcmp(config.module_extension, ".l") == 0, "Invalid new module extension"); +} |
