Don't parse CSV comments (#1859)

* `mlr sort -b` feature

* mlr regtest -p test/cases/cli-help && make dev

* Don't parse CSV comments

* Add tests for PR 1346

* Add tests for PR 1787

* Add test CSV files
This commit is contained in:
John Kerl 2025-08-13 17:07:32 -05:00 committed by GitHub
parent 369156b70d
commit 06e16ea3ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 62 additions and 37 deletions

View file

@ -0,0 +1 @@
mlr --skip-comments --csv --pass-comments cat test/input/pr-1346.csv

View file

@ -0,0 +1 @@
mlr: mlr: CSV header/data length mismatch 2 != 1 at filename test/input/pr-1346.csv row 4.

View file

@ -0,0 +1,5 @@
field1,field2
a,b
# that was the first record
c,d
# that was the second record, and there is no more data

View file

@ -0,0 +1 @@
mlr --csv cat test/input/pr-1787.csv

View file

@ -0,0 +1 @@
mlr: parse error on line 3, column 4: bare " in non-quoted-field.

View file

@ -0,0 +1,2 @@
a,b,c
1,2,3

View file

@ -0,0 +1 @@
mlr --csv --pass-comments cat test/input/pr-1787.csv

View file

@ -0,0 +1,4 @@
a,b,c
1,2,3
# x"y
4,5,6

View file

@ -0,0 +1 @@
mlr --csv --skip-comments cat test/input/pr-1787.csv

View file

@ -0,0 +1,3 @@
a,b,c
1,2,3
4,5,6

6
test/input/pr-1346.csv Normal file
View file

@ -0,0 +1,6 @@
field1,field2
a,b
# that was the first record
c,d
# that was the second record, and there is no more data
1 field1,field2
2 a,b
3 # that was the first record
4 c,d
5 # that was the second record, and there is no more data

4
test/input/pr-1787.csv Normal file
View file

@ -0,0 +1,4 @@
a,b,c
1,2,3
# x"y
4,5,6
Can't render this file because it contains an unexpected character in line 3 and column 4.