Annotation of embedaddon/confuse/tests/list_plus_syntax.c, revision 1.1.1.2

1.1       misho       1: #include "check_confuse.h"
                      2: #include <string.h>
                      3: 
                      4: int main(void)
                      5: {
1.1.1.2 ! misho       6:        cfg_opt_t opts[] = {
        !             7:                CFG_STR_LIST("stringproperty", 0, CFGF_NONE),
        !             8:                CFG_END()
        !             9:        };
1.1       misho      10: 
1.1.1.2 ! misho      11:        int rc;
        !            12:        cfg_t *cfg = cfg_init(opts, CFGF_NONE);
1.1       misho      13: 
1.1.1.2 ! misho      14:        fail_unless(cfg);
1.1       misho      15: 
1.1.1.2 ! misho      16:        rc = cfg_parse_buf(cfg,
        !            17:                           " stringproperty = {\"this\"}\n"
        !            18:                           " stringproperty += {\"that\"}\n"
        !            19:                           " stringproperty += {\"other\"}\n");
1.1       misho      20: 
1.1.1.2 ! misho      21:        fail_unless(rc == CFG_SUCCESS);
1.1       misho      22: 
1.1.1.2 ! misho      23:        fail_unless(cfg_size(cfg, "stringproperty") == 3);
1.1       misho      24: 
1.1.1.2 ! misho      25:        fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 0), "this") == 0);
        !            26:        fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 1), "that") == 0);
        !            27:        fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 2), "other") == 0);
1.1       misho      28: 
1.1.1.2 ! misho      29:        rc = cfg_parse_buf(cfg,
        !            30:                           " stringproperty = \"this\"\n"
        !            31:                           " stringproperty += \"that\"\n"
        !            32:                           " stringproperty += \"other\"\n");
1.1       misho      33: 
1.1.1.2 ! misho      34:        fail_unless(rc == CFG_SUCCESS);
1.1       misho      35: 
1.1.1.2 ! misho      36:        fail_unless(cfg_size(cfg, "stringproperty") == 3);
1.1       misho      37: 
1.1.1.2 ! misho      38:        fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 0), "this") == 0);
        !            39:        fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 1), "that") == 0);
        !            40:        fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 2), "other") == 0);
1.1       misho      41: 
1.1.1.2 ! misho      42:        cfg_free(cfg);
        !            43: 
        !            44:        return 0;
1.1       misho      45: }
                     46: 
1.1.1.2 ! misho      47: /**
        !            48:  * Local Variables:
        !            49:  *  indent-tabs-mode: t
        !            50:  *  c-file-style: "linux"
        !            51:  * End:
        !            52:  */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>