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

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

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