Skip to content
Myr

Fix #1534

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by William Langford · committed by William Langford · parent 0c9eace · Browse files · 2 files+12 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+12 added−1 removed

  • tests:+6 added−0 removed
  • other:+6 added−1 removed

2 files+12 added−1 removed

modified:src/util.c+6 added-1 removed
408 unmodified lines
409// Blocks to read one more input from stdin and/or given files410// When slurping, it returns just one value411jv jq_util_input_next_input(jq_util_input_state *state) {412 int is_last = 0;413 int has_more = 0;414 jv value = jv_invalid(); // need more input415 do {416 if (state->parser == NULL) {417 // Raw input
26 unmodified lines
444 if (jv_is_valid(state->slurped)) {445 if (jv_is_valid(value)) {446 state->slurped = jv_array_append(state->slurped, value);447 value = jv_invalid();448 // When slurping an input that doesn't have a trailing newline,449 // we might have more than one value on the same line, so let's check450 // to see if we have more data to parse.451 has_more = jv_parser_remaining(state->parser);452 } else if (jv_invalid_has_msg(jv_copy(value)))453 return value; // Not slurped parsed input454 } else if (jv_is_valid(value) || jv_invalid_has_msg(jv_copy(value))) {455 return value;456 }457 }453 } while (!is_last);458 } while (!is_last || has_more);459460 if (jv_is_valid(state->slurped)) {461 value = state->slurped;462 state->slurped = jv_invalid();
3 unmodified lines
modified:tests/shtest+6 added
120 unmodified lines
121 printf 'Issue #951 is back?\n' 1>&2122 exit 2123fi124125# Regression test for #1534126echo "[1,2,3,4]" > $d/expected127printf "[1,2][3,4]" | $JQ -cs add > $d/out 2>&1128cmp $d/out $d/expected129130131## Test streaming parser132133## If we add an option to stream to the `import ... as $symbol;` directive134## then we can move these tests into tests/all.test.
173 unmodified lines