1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/csv.rb: Incorporating the fixes from the recent

FasterCSV releases:  1.5.2 and 1.5.3.  [ruby-core:25038]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27025 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
jeg2 2010-03-23 14:59:25 +00:00
parent 0471422beb
commit 1bd1128989
5 changed files with 115 additions and 89 deletions

View file

@ -115,6 +115,18 @@ class TestCSVParsing < Test::Unit::TestCase
assert_equal(Array.new, CSV.parse_line("\n1,2,3\n"))
end
def test_non_regex_edge_cases
# An early version of the non-regex parser fails this test
[ [ "foo,\"foo,bar,baz,foo\",\"foo\"",
["foo", "foo,bar,baz,foo", "foo"] ] ].each do |edge_case|
assert_equal(edge_case.last, CSV.parse_line(edge_case.first))
end
assert_raise(CSV::MalformedCSVError) do
CSV.parse_line("1,\"23\"4\"5\", 6")
end
end
def test_malformed_csv
assert_raise(CSV::MalformedCSVError) do
CSV.parse_line("1,2\r,3", row_sep: "\n")