-
Notifications
You must be signed in to change notification settings - Fork 123
csv-filter: add --quote-char #340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -137,4 +137,19 @@ def test_option_col_sep | |||||||||||||
| assert_equal(["aaa.bbb.ccc\nddd.eee.fff\n", ""], | ||||||||||||||
| run_csv_filter(csv, "--col-sep=:", "--output-col-sep=.")) | ||||||||||||||
| end | ||||||||||||||
|
|
||||||||||||||
| def test_option_quote_char | ||||||||||||||
| quote_char = "'" | ||||||||||||||
| csv = CSV.generate(quote_char: quote_char) do |csv| | ||||||||||||||
| csv << ['foo', 0] | ||||||||||||||
| csv << ["'bar'", 1] | ||||||||||||||
| csv << ['"baz"', 2] | ||||||||||||||
| end | ||||||||||||||
| assert_equal(["foo,0\n'''bar''',1\n\"baz\",2\n", ""], | ||||||||||||||
| run_csv_filter(csv, "--quote-char=:")) | ||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we have the same situation for
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Really? They use csv/test/csv/test_csv_filter.rb Lines 132 to 134 in 7eea19a
csv/test/csv/test_csv_filter.rb Lines 122 to 124 in 7eea19a
|
||||||||||||||
| assert_equal(["foo,0\n'''bar''',1\n\"\"\"baz\"\"\",2\n", ""], | ||||||||||||||
| run_csv_filter(csv, "--input-quote-char=:")) | ||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we specify
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand. Doesn't the default value serve us well enough?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If we want to test only |
||||||||||||||
| assert_equal(["foo,0\n'''bar''',1\nbaz,2\n", ""], | ||||||||||||||
| run_csv_filter(csv, "--output-quote-char=:")) | ||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||||||||||||||
| end | ||||||||||||||
| end | ||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.