summaryrefslogtreecommitdiff
path: root/test/csv
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-25 09:04:33 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-12-25 09:04:33 +0000
commit08d99ac9e35ddcd22885303306116cb10c6a992c (patch)
tree3059c36fe97ea5b9784c1e7dbf25df8b64d85f52 /test/csv
parent9ff4e23741448fb6c02090ebc95671d83b2d03a0 (diff)
* lib/csv.rb (CSV.foreach): 'rb' mode is defaulted in open.
* lib/csv.rb (CSV#init_separators): cannonicalize encoding options as Encoding objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/csv')
-rwxr-xr-xtest/csv/test_encodings.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/csv/test_encodings.rb b/test/csv/test_encodings.rb
index 59f43b1..46e9929 100755
--- a/test/csv/test_encodings.rb
+++ b/test/csv/test_encodings.rb
@@ -260,6 +260,23 @@ class TestCSV::Encodings < TestCSV
end unless encoding == __ENCODING__
rescue Encoding::ConverterNotFoundError
end
+ options[:encoding] = encoding.name
+ CSV.open(@temp_csv_path, options) do |csv|
+ csv.each_with_index do |row, i|
+ assert_equal(fields[i], row)
+ end
+ end
+ options.delete(:encoding)
+ options[:external_encoding] = encoding.name
+ options[:internal_encoding] = __ENCODING__.name
+ begin
+ CSV.open(@temp_csv_path, options) do |csv|
+ csv.each_with_index do |row, i|
+ assert_equal(orig_fields[i], row)
+ end
+ end unless encoding == __ENCODING__
+ rescue Encoding::ConverterNotFoundError
+ end
end
def encode_ary(ary, encoding)