diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-22 05:32:34 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-22 05:32:34 +0000 |
commit | 2c69f7b278b782b2243fd9eec71264d4d7cab78c (patch) | |
tree | 408065d4cf1d5ca53928c93f88c729c72ed09213 /test | |
parent | 84bc175cab620279d22ccf560685d7d0b79e9f00 (diff) | |
download | ruby-2c69f7b278b782b2243fd9eec71264d4d7cab78c.tar.gz |
Escape skip_lines string before convert to Regexp.
It ignored all of lines when given Regexp special characters.
[Feature #9147][ruby-core:58549]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rwxr-xr-x | test/csv/test_features.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/csv/test_features.rb b/test/csv/test_features.rb index a1f1ddbd15..3f9359faaf 100755 --- a/test/csv/test_features.rb +++ b/test/csv/test_features.rb @@ -353,6 +353,15 @@ class TestCSV::Features < TestCSV assert_equal [["line", "1", "a"], ["line", "2", "b"]], c.each.to_a end + def test_comment_rows_are_ignored_with_heredoc + c = csv = CSV.new(<<~EOL, skip_lines: ".") + 1,foo + .2,bar + 3,baz + EOL + assert_equal [["1", "foo"], ["3", "baz"]], c.each.to_a + end + def test_quoted_skip_line_markers_are_ignored sample_data = "line,1,a\n\"#not\",a,line\nline,2,b" c = CSV.new sample_data, :skip_lines => /\A\s*#/ |