✨ feat(csv): add PSV (Pipe-Separated Values) support and tests#1355
Merged
✨ feat(csv): add PSV (Pipe-Separated Values) support and tests#1355
Conversation
- Add psv_parse function to csv.mq - Add module tests for PSV parsing and conversion - Ensures parity with CSV/TSV features Closes #1352
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Pipe-Separated Values (PSV) parsing support to the csv mq module and extends the module test suite to validate PSV parsing/conversion behavior, aligning it with existing CSV/TSV ergonomics.
Changes:
- Add
csv::psv_parse(input, has_header)as a delimiter-specific wrapper around the shared CSV parser. - Add module tests covering PSV parsing into dict/array forms and PSV→JSON conversion.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/mq-lang/modules/csv.mq | Adds psv_parse wrapper using ` |
| crates/mq-lang/modules/module_tests.mq | Adds PSV test cases for parsing (dict/array) and PSV→JSON conversion. |
Comment on lines
+33
to
+38
| | let psv_input = "a|b|c\n\"1,2\"|\"2,3\"|\"3,4\"\n4|5|6\n\"multi\nline\"|7|8\n9|10|\"quoted,comma\"\n\"\"|11|12\n13|14|15\n" | | ||
|
|
||
| def test_psv_parse_for_dict(): | ||
| let result = csv::psv_parse(psv_input, true) | ||
| | assert_eq(len(result), 6) | ||
| end |
There was a problem hiding this comment.
PSV tests currently mirror the CSV cases and don’t cover PSV-specific edge cases (e.g., unquoted commas inside fields, or a literal | inside a quoted field). Adding at least one row like a|"b|c"|d (and/or 1,2|3,4|5,6 without quotes) would better validate that psv_parse correctly treats | as the delimiter and respects quoting.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1352