Commit f302ae6d authored by Peter W. Draper's avatar Peter W. Draper

Exercise the parser code for handling truncation of a list of strings

parent a060cb1d
......@@ -143,6 +143,18 @@ int main(int argc, char *argv[]) {
assert(strcmp("abcdefghijklmnopqrstuvwxyz", alphabet) == 0);
parser_free_param_string_array(nvar_result, var_result);
/* Unfinished list of values. Should read last improperly quoted string.
* Note length should be CHUNK + 1. */
parser_get_param_string_array(&param_file, "Words:unfinished", &nvar_result,
&var_result);
assert(nvar_result == 11);
printf("\nList from Words:unfinished parameter (%d)\n", nvar_result);
for (int i = 0; i < nvar_result; i++) {
printf(" %d: %s\n", i, var_result[i]);
}
assert(strcmp("abcdefg", var_result[nvar_result-1]) == 0);
parser_free_param_string_array(nvar_result, var_result);
/* Print the contents of the structure to stdout now used. */
printf("\n--- Values after being used:\n");
parser_print_params(&param_file);
......
......@@ -21,6 +21,7 @@ Words:
list: ['xyz', 'ABC', "ab'c", "de:f", "g,hi", "zzz", Hello World, once-again]
nonstdlist: 'xyz', 'ABC', "ab'c", "de:f", "g,hi", "zzz", Hello World, once-again
long: [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z]
unfinished: [a, b, c, d, e, f, g, h, i, j, 'abcdefg
# Spelling mistake, should go into unused list.
Box:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment