aboutsummaryrefslogtreecommitdiff
path: root/tests/test_ini.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@users.noreply.github.com>2024-08-08 12:45:05 -0400
committerGitHub <noreply@github.com>2024-08-08 12:45:05 -0400
commitc9579598c5a1b49f7fe8e353623175bf8f3cc236 (patch)
treecf7ef75a4bea7b16713a172d17b82a0c1ad9904b /tests/test_ini.c
parent99edcf7b998a1ac83b75ef3cc117c5b91c874782 (diff)
downloadstasis-c9579598c5a1b49f7fe8e353623175bf8f3cc236.tar.gz
Return of the INI refactor (#20)
* Continuation of #19 * Fixes always_update_base_environment override bug added by PR #19 * Finish type hinting implementation * ini_getval_* functions now able to affect rendering mode using INI_READ_RAW and INI_READ_RENDER * Created pointers to deeply nested structures to increase readability * Output from ini_write() is more consistent, with fewer errant spaces and line feeds * Fixes accidental regression in #19. INIVAL_TYPE_STR_ARRAY never produced an array of pointers to char. This needs to be corrected in the future. i.e. It has always generated a new-line delimited string, not a StrList, or array. * Fix strlist_append_tokenize * original pointer is no longer modified * token strings are stripped of leading space before appending to the list * Use defines instead of magic numbers * delivery_init: add render_mode argument * test_conda: Add render mode * test_ini: Add render mode * Only add conda packages and wheels to the image * docker images are saved to the packages directory and will be consumed by the image if present. * Render template variables after bootstrapping the delivery
Diffstat (limited to 'tests/test_ini.c')
-rw-r--r--tests/test_ini.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/test_ini.c b/tests/test_ini.c
index 5958cfd..7fb13a0 100644
--- a/tests/test_ini.c
+++ b/tests/test_ini.c
@@ -73,6 +73,7 @@ void test_ini_has_key() {
}
void test_ini_setval_getval() {
+ int render_mode = INI_READ_RENDER;
const char *filename = "ini_open.ini";
const char *data = "[default]\na=1\nb=2\nc=3\n[section name here]\ntest=true\n";
struct INIFILE *ini;
@@ -82,12 +83,12 @@ void test_ini_setval_getval() {
ini = ini_open(filename);
union INIVal val;
STASIS_ASSERT(ini_setval(&ini, INI_SETVAL_REPLACE, "default", "a", "changed") == 0, "failed to set value");
- STASIS_ASSERT(ini_getval(ini, "default", "a", INIVAL_TYPE_STR, &val) == 0, "failed to get value");
+ STASIS_ASSERT(ini_getval(ini, "default", "a", INIVAL_TYPE_STR, render_mode, &val) == 0, "failed to get value");
STASIS_ASSERT(strcmp(val.as_char_p, "a") != 0, "unexpected value loaded from modified variable");
STASIS_ASSERT(strcmp(val.as_char_p, "changed") == 0, "unexpected value loaded from modified variable");
STASIS_ASSERT(ini_setval(&ini, INI_SETVAL_APPEND, "default", "a", " twice") == 0, "failed to set value");
- STASIS_ASSERT(ini_getval(ini, "default", "a", INIVAL_TYPE_STR, &val) == 0, "failed to get value");
+ STASIS_ASSERT(ini_getval(ini, "default", "a", INIVAL_TYPE_STR, render_mode, &val) == 0, "failed to get value");
STASIS_ASSERT(strcmp(val.as_char_p, "changed") != 0, "unexpected value loaded from modified variable");
STASIS_ASSERT(strcmp(val.as_char_p, "changed twice") == 0, "unexpected value loaded from modified variable");
ini_free(&ini);