diff options
| author | Joseph Hunkeler <jhunkeler@users.noreply.github.com> | 2025-07-08 15:50:20 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-08 15:50:20 -0400 |
| commit | d90493618ce34a732c5411d1670be57d4dd9db4e (patch) | |
| tree | 99719cf91d7faaf8ad37ef70d3baaaf3ce316176 /tests/test_ini.c | |
| parent | e90140a7628d24edef090e548179c64170d3338b (diff) | |
| parent | 1e572f3a653ddd6385a0ea49cacfbf2f3a32ce87 (diff) | |
| download | stasis-d90493618ce34a732c5411d1670be57d4dd9db4e.tar.gz | |
Merge pull request #116 from jhunkeler/breakdown
Breakdown & Bug fixes
Diffstat (limited to 'tests/test_ini.c')
| -rw-r--r-- | tests/test_ini.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_ini.c b/tests/test_ini.c index e4a7808..af47ddf 100644 --- a/tests/test_ini.c +++ b/tests/test_ini.c @@ -195,6 +195,23 @@ void test_ini_getval_wrappers() { ini_free(&ini); } +void test_ini_getall() { + const char *filename = "ini_open.ini"; + struct INIFILE *ini = NULL; + const char *data = "[default]\nhello=world!\nthis=is a test\nx=1\ny=0\n"; + + stasis_testing_write_ascii(filename, data); + ini = ini_open(filename); + STASIS_ASSERT_FATAL(ini != NULL, "failed to open ini file"); + + const struct INIData *d = NULL; + for (size_t i = 0; (d = ini_getall(ini, "default")) != NULL; i++) { + STASIS_ASSERT(d->key != NULL, "INIData key should not be NULL"); + STASIS_ASSERT(d->value != NULL, "INIData key should not be NULL"); + } + ini_free(&ini); +} + int main(int argc, char *argv[]) { STASIS_TEST_BEGIN_MAIN(); STASIS_TEST_FUNC *tests[] = { @@ -204,6 +221,7 @@ int main(int argc, char *argv[]) { test_ini_has_key, test_ini_setval_getval, test_ini_getval_wrappers, + test_ini_getall, }; STASIS_TEST_RUN(tests); STASIS_TEST_END_MAIN(); |
