summaryrefslogtreecommitdiff
path: root/test/csv
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-22 05:32:34 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-08-22 05:32:34 +0000
commit2c69f7b278b782b2243fd9eec71264d4d7cab78c (patch)
tree408065d4cf1d5ca53928c93f88c729c72ed09213 /test/csv
parent84bc175cab620279d22ccf560685d7d0b79e9f00 (diff)
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/csv')
-rwxr-xr-xtest/csv/test_features.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/csv/test_features.rb b/test/csv/test_features.rb
index a1f1ddb..3f9359f 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*#/