diff options
author | Dmitri Pal <dpal@redhat.com> | 2012-12-23 16:54:22 -0500 |
---|---|---|
committer | Ondrej Kos <okos@redhat.com> | 2013-01-07 09:25:44 +0100 |
commit | 6c3a184c9345ab35bb64002530dc68074cc3a10b (patch) | |
tree | c8e5d0a0eb5a29cba4d480aaa89d652591552972 /ini/ini_parse_ut.c | |
parent | 75fb29de5f180ff7a672865629c83367c10ae5ee (diff) | |
download | ding-libs2-6c3a184c9345ab35bb64002530dc68074cc3a10b.tar.gz ding-libs2-6c3a184c9345ab35bb64002530dc68074cc3a10b.tar.xz ding-libs2-6c3a184c9345ab35bb64002530dc68074cc3a10b.zip |
Add INI_GET_LAST_VALUE
Refactored the defines to enum.
Added support for fetching last value from the section.
Diffstat (limited to 'ini/ini_parse_ut.c')
-rw-r--r-- | ini/ini_parse_ut.c | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/ini/ini_parse_ut.c b/ini/ini_parse_ut.c index 521c2f7..e743eae 100644 --- a/ini/ini_parse_ut.c +++ b/ini/ini_parse_ut.c @@ -2307,6 +2307,31 @@ int get_test(void) /***************************************/ + INIOUT(printf("\nGet last value\n")); + + vo = NULL; + error = ini_get_config_valueobj("domains/EXAMPLE.COM", + "server", + ini_config, + INI_GET_LAST_VALUE, + &vo); + if(error) { + printf("Expected success but got error! %d\n", error); + ini_config_destroy(ini_config); + return error; + } + + /* Value should be found */ + if (vo == NULL) { + printf("Expected success but got NULL.\n"); + ini_config_destroy(ini_config); + return -1; + } + + INIOUT(value_print("server", vo)); + + /***************************************/ + INIOUT(printf("\nGet sequence of the multi-value keys\n")); vo = NULL; @@ -2330,6 +2355,7 @@ int get_test(void) INIOUT(value_print("server", vo)); + do { vo = NULL; @@ -2388,7 +2414,7 @@ int get_test(void) "server", ini_config, INI_GET_NEXT_VALUE, - &vo); + &vo); if(error) { printf("Expected success but got error! %d\n", error); ini_config_destroy(ini_config); @@ -2406,7 +2432,7 @@ int get_test(void) "empty_value", ini_config, INI_GET_NEXT_VALUE, - &vo); + &vo); if(error) { printf("Expected success but got error! %d\n", error); ini_config_destroy(ini_config); @@ -2424,7 +2450,7 @@ int get_test(void) /***************************************/ - INIOUT(printf("\nGet multi-value keys with key interrupt\n")); + INIOUT(printf("\nGet multi-value keys with section interrupt\n")); i = 0; |