aboutsummaryrefslogtreecommitdiff
path: root/test/config.c
blob: 8a1dc644443db364ce648b0437f1eaebdef595d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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");
}