From 2fc802b267092ad647672bcbfcd31f0117eec27c Mon Sep 17 00:00:00 2001 From: pommicket Date: Mon, 15 Sep 2025 22:00:24 -0400 Subject: Switch back to `pom_error` for typed get functions --- tests/interpretation.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'tests/interpretation.c') diff --git a/tests/interpretation.c b/tests/interpretation.c index bdae290..26846a1 100644 --- a/tests/interpretation.c +++ b/tests/interpretation.c @@ -26,9 +26,10 @@ void test_interpretation(void) { if (strstr(conf_path, "uint.pom")) { uint64_t val, val2; while ((key = pom_conf_next_key(bad, &iter))) { - if (!pom_conf_get_uint(bad, key, &val)) { + if (!(error = pom_conf_get_uint(bad, key, &val))) { test_fail("Key %s should be rejected as a uint", key); } + free(error); } while ((key = pom_conf_next_key(good, &iter))) { const pom_conf *section = pom_conf_section(good, key); @@ -49,9 +50,10 @@ void test_interpretation(void) { } else if (strstr(conf_path, "int.pom")) { int64_t val, val2; while ((key = pom_conf_next_key(bad, &iter))) { - if (!pom_conf_get_int(bad, key, &val)) { + if (!(error = pom_conf_get_int(bad, key, &val))) { test_fail("Key %s should be rejected as an int", key); } + free(error); } while ((key = pom_conf_next_key(good, &iter))) { const pom_conf *section = pom_conf_section(good, key); @@ -72,9 +74,10 @@ void test_interpretation(void) { } else if (strstr(conf_path, "float.pom")) { double val, val2; while ((key = pom_conf_next_key(bad, &iter))) { - if (!pom_conf_get_float(bad, key, &val)) { + if (!(error = pom_conf_get_float(bad, key, &val))) { test_fail("Key %s should be rejected as a float", key); } + free(error); } while ((key = pom_conf_next_key(good, &iter))) { const pom_conf *section = pom_conf_section(good, key); @@ -95,9 +98,10 @@ void test_interpretation(void) { } else if (strstr(conf_path, "bool.pom")) { bool val, val2; while ((key = pom_conf_next_key(bad, &iter))) { - if (!pom_conf_get_bool(bad, key, &val)) { + if (!(error = pom_conf_get_bool(bad, key, &val))) { test_fail("Key %s should be rejected as a bool", key); } + free(error); } while ((key = pom_conf_next_key(good, &iter))) { const pom_conf *section = pom_conf_section(good, key); -- cgit v1.2.3