Add function _parse_str for string.

This commit is contained in:
Patrick Pelissier committed 2018-05-02 19:36:51 +02:00
1 parent 9fed336c9e
commit 47a49263ae
3 files changed
+55 -1

No files matched your search

+10
View File
@@ -288,6 +288,16 @@ static void test0(void)
string_get_str(s2, s1, true);
assert (string_cmp_str (s2, "\"Hello world\"\"Hello \\\"world\\\"\"") == 0);
const char *sp = string_get_cstr(s2);
b = string_parse_str(s1, &sp);
assert (b == true);
assert (strcmp(sp, "\"Hello \\\"world\\\"\"") == 0);
assert (string_cmp_str(s1, "Hello world") == 0);
b = string_parse_str(s1, &sp);
assert (b == true);
assert (strcmp(sp, "") == 0);
assert (string_cmp_str(s1, "Hello \"world\"") == 0);
string_set_str(s1, "Hello \"world\"");
FILE *f = fopen ("a-mstring.dat", "wt");
assert (f != NULL);