skip/pass-comments UT iterate

This commit is contained in:
John Kerl 2018-01-04 10:08:45 -05:00
parent f3ead1eef0
commit 7741da01ce
3 changed files with 131 additions and 1 deletions

View file

@ -160,8 +160,9 @@ static void lrec_reader_stdio_json_sof(void* pvstate, void* pvhandle) {
pstate->comment_handling, pstate->comment_string, line_term);
}
mlr_json_end_strip(phandle->sof, &phandle->eof);
length = phandle->eof - phandle->sof;
if (phandle->sof >= phandle->eof) {
if (length > 0) {
while (TRUE) {
parsed_top_level_json = json_parse(item_start, length, error_buf, &item_start);

View file

@ -45267,6 +45267,97 @@ mlr --pass-comments --inidx --oxtab cat ./reg_test/input/comments/comments3.nidx
# hello world 3
================================================================
SKIP/PASS COMMENTS JSON
---------------------------------------------------------------- input comments1.json
cat ./reg_test/input/comments/comments1.json
# hello world 1
{ "a":1, "b":2, "c":3 }
{ "a":4, "b":5, "c":6 }
---------------------------------------------------------------- skip comments1.json
mlr --skip-comments --ijson --odkvp cat
a=1,b=2,c=3
a=4,b=5,c=6
mlr --skip-comments --ijson --odkvp cat ./reg_test/input/comments/comments1.json
a=1,b=2,c=3
a=4,b=5,c=6
---------------------------------------------------------------- pass comments1.json
mlr --pass-comments --ijson --odkvp cat
# hello world 1
a=1,b=2,c=3
a=4,b=5,c=6
mlr --pass-comments --ijson --odkvp cat ./reg_test/input/comments/comments1.json
# hello world 1
a=1,b=2,c=3
a=4,b=5,c=6
---------------------------------------------------------------- input comments2.json
cat ./reg_test/input/comments/comments2.json
{ "a":1, "b":2, "c":3 }
# hello world 2
{ "a":4, "b":5, "c":6 }
---------------------------------------------------------------- skip comments2.json
mlr --skip-comments --ijson --odkvp cat
a=1,b=2,c=3
a=4,b=5,c=6
mlr --skip-comments --ijson --odkvp cat ./reg_test/input/comments/comments2.json
a=1,b=2,c=3
a=4,b=5,c=6
---------------------------------------------------------------- pass comments2.json
mlr --pass-comments --ijson --odkvp cat
# hello world 2
a=1,b=2,c=3
a=4,b=5,c=6
mlr --pass-comments --ijson --odkvp cat ./reg_test/input/comments/comments2.json
# hello world 2
a=1,b=2,c=3
a=4,b=5,c=6
---------------------------------------------------------------- input comments3.json
cat ./reg_test/input/comments/comments3.json
{ "a":1, "b":2, "c":3 }
{ "a":4, "b":5, "c":6 }
# hello world 3
---------------------------------------------------------------- skip comments3.json
mlr --skip-comments --ijson --odkvp cat
a=1,b=2,c=3
a=4,b=5,c=6
mlr --skip-comments --ijson --odkvp cat ./reg_test/input/comments/comments3.json
a=1,b=2,c=3
a=4,b=5,c=6
---------------------------------------------------------------- pass comments3.json
mlr --pass-comments --ijson --odkvp cat
# hello world 3
a=1,b=2,c=3
a=4,b=5,c=6
mlr --pass-comments --ijson --odkvp cat ./reg_test/input/comments/comments3.json
# hello world 3
a=1,b=2,c=3
a=4,b=5,c=6
================================================================
MMAP AT PAGE BOUNDARIES

View file

@ -5241,6 +5241,44 @@ mention pass comments3.nidx
run_mlr --pass-comments --inidx --oxtab cat < $indir/comments/comments3.nidx
run_mlr --pass-comments --inidx --oxtab cat $indir/comments/comments3.nidx
# ----------------------------------------------------------------
announce SKIP/PASS COMMENTS JSON
mention input comments1.json
run_cat $indir/comments/comments1.json
mention skip comments1.json
run_mlr --skip-comments --ijson --odkvp cat < $indir/comments/comments1.json
run_mlr --skip-comments --ijson --odkvp cat $indir/comments/comments1.json
mention pass comments1.json
run_mlr --pass-comments --ijson --odkvp cat < $indir/comments/comments1.json
run_mlr --pass-comments --ijson --odkvp cat $indir/comments/comments1.json
mention input comments2.json
run_cat $indir/comments/comments2.json
mention skip comments2.json
run_mlr --skip-comments --ijson --odkvp cat < $indir/comments/comments2.json
run_mlr --skip-comments --ijson --odkvp cat $indir/comments/comments2.json
mention pass comments2.json
run_mlr --pass-comments --ijson --odkvp cat < $indir/comments/comments2.json
run_mlr --pass-comments --ijson --odkvp cat $indir/comments/comments2.json
mention input comments3.json
run_cat $indir/comments/comments3.json
mention skip comments3.json
run_mlr --skip-comments --ijson --odkvp cat < $indir/comments/comments3.json
run_mlr --skip-comments --ijson --odkvp cat $indir/comments/comments3.json
mention pass comments3.json
run_mlr --pass-comments --ijson --odkvp cat < $indir/comments/comments3.json
run_mlr --pass-comments --ijson --odkvp cat $indir/comments/comments3.json
# ----------------------------------------------------------------
announce MMAP AT PAGE BOUNDARIES