summaryrefslogtreecommitdiff
path: root/test/csv
diff options
context:
space:
mode:
authorglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-28 07:46:20 +0000
committerglass <glass@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-28 07:46:20 +0000
commit32eeff17085bb945ce3c721358b9ae5e17fcd05f (patch)
tree8d4116142f627cf557ae289523b6efb5bc5ea638 /test/csv
parentb89d5938b5ac5c9d4c4cfed0730a8c9970943a36 (diff)
csv.rb: fix incompatibility introduced in r59428
* lib/csv.rb: fix incompatibility introduced in r59428. CSV.new takes options as keyword arguments. * test/csv/test_features.rb: add a test to ensure it raises error againt unknown options * test/csv/test_features.rb: add a test to ensure row_sep option is properly applied git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/csv')
-rwxr-xr-xtest/csv/test_features.rb9
-rwxr-xr-xtest/csv/test_interface.rb3
2 files changed, 12 insertions, 0 deletions
diff --git a/test/csv/test_features.rb b/test/csv/test_features.rb
index f8aa0d8..a1f1ddb 100755
--- a/test/csv/test_features.rb
+++ b/test/csv/test_features.rb
@@ -137,6 +137,15 @@ class TestCSV::Features < TestCSV
test_lineno
end
+ def test_unknown_options
+ assert_raise_with_message(ArgumentError, /unknown keyword/) {
+ CSV.new(@sample_data, unknown: :error)
+ }
+ assert_raise_with_message(ArgumentError, /unknown keyword/) {
+ CSV.new(@sample_data, universal_newline: true)
+ }
+ end
+
def test_skip_blanks
assert_equal(4, @csv.to_a.size)
diff --git a/test/csv/test_interface.rb b/test/csv/test_interface.rb
index a12545c..0ae03b0 100755
--- a/test/csv/test_interface.rb
+++ b/test/csv/test_interface.rb
@@ -166,6 +166,9 @@ class TestCSV::Interface < TestCSV
assert_not_nil(line)
assert_instance_of(String, line)
assert_equal("1;2;3\n", line)
+
+ line = CSV.generate_line(%w"1 2", row_sep: nil)
+ assert_equal("1,2", line)
end
def test_write_header_detection