Add function _parse_str for string.
This commit is contained in:
1 parent
9fed336c9e
commit
47a49263ae
3 files changed
+55
-1
No files matched your search
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user