Diff for /embedaddon/confuse/tests/list_plus_syntax.c between versions 1.1.1.1 and 1.1.1.2

version 1.1.1.1, 2017/01/24 14:48:56 version 1.1.1.2, 2021/03/17 00:49:17
Line 3 Line 3
   
 int main(void)  int main(void)
 {  {
    cfg_opt_t opts[] = {        cfg_opt_t opts[] = {
        CFG_STR_LIST("stringproperty", 0, CFGF_NONE),                CFG_STR_LIST("stringproperty", 0, CFGF_NONE),
        CFG_END()                CFG_END()
    };        };
   
    cfg_t *cfg = cfg_init(opts, CFGF_NONE);        int rc;
    fail_unless(cfg);        cfg_t *cfg = cfg_init(opts, CFGF_NONE);
   
    int rc = cfg_parse_buf(cfg,        fail_unless(cfg);
            " stringproperty = {\"this\"}\n" 
            " stringproperty += {\"that\"}\n" 
            " stringproperty += {\"other\"}\n"); 
   
    fail_unless(rc == CFG_SUCCESS);        rc = cfg_parse_buf(cfg,
                            " stringproperty = {\"this\"}\n"
                            " stringproperty += {\"that\"}\n"
                            " stringproperty += {\"other\"}\n");
   
    fail_unless(cfg_size(cfg, "stringproperty") == 3);        fail_unless(rc == CFG_SUCCESS);
   
    fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 0), "this") == 0);        fail_unless(cfg_size(cfg, "stringproperty") == 3);
    fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 1), "that") == 0); 
    fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 2), "other") == 0); 
   
    rc = cfg_parse_buf(cfg,        fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 0), "this") == 0);
            " stringproperty = \"this\"\n"        fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 1), "that") == 0);
            " stringproperty += \"that\"\n"        fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 2), "other") == 0);
            " stringproperty += \"other\"\n"); 
   
    fail_unless(rc == CFG_SUCCESS);        rc = cfg_parse_buf(cfg,
                            " stringproperty = \"this\"\n"
                            " stringproperty += \"that\"\n"
                            " stringproperty += \"other\"\n");
   
    fail_unless(cfg_size(cfg, "stringproperty") == 3);        fail_unless(rc == CFG_SUCCESS);
   
    fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 0), "this") == 0);        fail_unless(cfg_size(cfg, "stringproperty") == 3);
    fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 1), "that") == 0); 
    fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 2), "other") == 0); 
   
    cfg_free(cfg);        fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 0), "this") == 0);
         fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 1), "that") == 0);
         fail_unless(strcmp(cfg_getnstr(cfg, "stringproperty", 2), "other") == 0);
   
    return 0;        cfg_free(cfg);
 
         return 0;
 }  }
   
   /**
    * Local Variables:
    *  indent-tabs-mode: t
    *  c-file-style: "linux"
    * End:
    */

Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.2


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