aboutsummaryrefslogtreecommitdiffstats
path: root/test/csv/test_data_converters.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/csv/test_data_converters.rb')
-rwxr-xr-xtest/csv/test_data_converters.rb17
1 files changed, 9 insertions, 8 deletions
diff --git a/test/csv/test_data_converters.rb b/test/csv/test_data_converters.rb
index 06653f5ec9..fcd03dcb71 100755
--- a/test/csv/test_data_converters.rb
+++ b/test/csv/test_data_converters.rb
@@ -63,24 +63,25 @@ class TestCSV::DataConverters < TestCSV
assert_instance_of(String, CSV::Converters[:date_time]["junk"])
end
- def test_convert_with_builtin
+ def test_convert_with_builtin_integer
# setup parser...
assert(@parser.respond_to?(:convert))
assert_nothing_raised(Exception) { @parser.convert(:integer) }
# and use
assert_equal(["Numbers", ":integer", 1, ":float", "3.015"], @parser.shift)
+ end
- setup # reset
-
+ def test_convert_with_builtin_float
# setup parser...
+ assert(@parser.respond_to?(:convert))
assert_nothing_raised(Exception) { @parser.convert(:float) }
# and use
assert_equal(["Numbers", ":integer", 1.0, ":float", 3.015], @parser.shift)
end
- def test_convert_order
+ def test_convert_order_float_integer
# floats first, then integers...
assert_nothing_raised(Exception) do
@parser.convert(:float)
@@ -90,9 +91,9 @@ class TestCSV::DataConverters < TestCSV
# gets us nothing but floats
assert_equal( [String, String, Float, String, Float],
@parser.shift.map { |field| field.class } )
+ end
- setup # reset
-
+ def test_convert_order_integer_float
# integers have precendance...
assert_nothing_raised(Exception) do
@parser.convert(:integer)
@@ -132,9 +133,9 @@ class TestCSV::DataConverters < TestCSV
# and use
assert_equal(["Numbers", :integer, "1", :float, "3.015"], @parser.shift)
+ end
- setup # reset
-
+ def test_convert_with_custom_code_mix
# mix built-in and custom...
assert_nothing_raised(Exception) { @parser.convert(:numeric) }
assert_nothing_raised(Exception) { @parser.convert(&@custom) }