summaryrefslogtreecommitdiff
path: root/test/csv/parse
diff options
context:
space:
mode:
authorKouhei Sutou <kou@clear-code.com>2019-04-23 05:54:44 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2019-07-14 23:07:31 +0900
commit198281a71d95c1a48445dc6e913bc1bd62350054 (patch)
treef8807d290bd0391312e4cf5b20d679cdeb9e3b35 /test/csv/parse
parent8c0edbd79d59789b9543d00322d6bde72f86bfda (diff)
[ruby/csv] Fix a bug that strip: true removes newlines
https://github.com/ruby/csv/commit/5540d35a30
Diffstat (limited to 'test/csv/parse')
-rw-r--r--test/csv/parse/test_strip.rb30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/csv/parse/test_strip.rb b/test/csv/parse/test_strip.rb
index 160407bd94..0255bb9a30 100644
--- a/test/csv/parse/test_strip.rb
+++ b/test/csv/parse/test_strip.rb
@@ -45,4 +45,34 @@ class TestCSVParseStrip < Test::Unit::TestCase
strip: %Q{"},
quote_char: nil))
end
+
+ def test_do_not_strip_cr
+ assert_equal([
+ ["a", "b "],
+ ["a", "b "],
+ ],
+ CSV.parse(%Q{"a" ,"b " \r} +
+ %Q{"a" ,"b " \r},
+ strip: true))
+ end
+
+ def test_do_not_strip_lf
+ assert_equal([
+ ["a", "b "],
+ ["a", "b "],
+ ],
+ CSV.parse(%Q{"a" ,"b " \n} +
+ %Q{"a" ,"b " \n},
+ strip: true))
+ end
+
+ def test_do_not_strip_crlf
+ assert_equal([
+ ["a", "b "],
+ ["a", "b "],
+ ],
+ CSV.parse(%Q{"a" ,"b " \r\n} +
+ %Q{"a" ,"b " \r\n},
+ strip: true))
+ end
end