summaryrefslogtreecommitdiff
path: root/test/csv
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-04-27 21:07:09 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-04-27 21:07:09 +0000
commite858442f4f9ca8dead0413a8fa140be92240f189 (patch)
tree5e42ae9012b4e5cf8856a1806fb8773e14848d5d /test/csv
parent2f348762fbcf97b1de3b91c0dd84ba8b8b430dfd (diff)
* lib/csv.rb (CSV::open): suppress universal newline decorator.
fixes #4603 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/csv')
-rwxr-xr-xtest/csv/test_encodings.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/csv/test_encodings.rb b/test/csv/test_encodings.rb
index 3880f3a..54c34f3 100755
--- a/test/csv/test_encodings.rb
+++ b/test/csv/test_encodings.rb
@@ -79,6 +79,21 @@ class TestCSV::Encodings < TestCSV
end
end
+ def test_read_with_default_encoding
+ data = "abc"
+ default_external = Encoding.default_external
+ each_encoding do |encoding|
+ File.open(@temp_csv_path, "wb", encoding: encoding) {|f| f << data}
+ begin
+ Encoding.default_external = encoding
+ result = CSV.read(@temp_csv_path)[0][0]
+ ensure
+ Encoding.default_external = default_external
+ end
+ assert_equal(encoding, result.encoding)
+ end
+ end
+
#######################################################################
### Stress Test ASCII Compatible and Non-ASCII Compatible Encodings ###
#######################################################################