test/test_format_input.rb in numerals-0.2.1 vs test/test_format_input.rb in numerals-0.3.0
- old
+ new
@@ -247,6 +247,14 @@
f.set_padding! '*'
assert_equal Flt::DecNum('0.667'), f.read("********0.667*******", type: Flt::DecNum)
assert_equal Flt::DecNum('-0.667'), f.read("*******-0.667*******", type: Flt::DecNum)
end
+ def test_alternative_read_parameters
+ assert_same_number 0.1, Format[].read('0.1', type: Float)
+ assert_same_number 0.1, Format[].read('0.1', as: Float)
+ assert_same_number 0.1, Format[].read('0.1', context: Float.context)
+ assert_same_number 0.1, Format[].read('0.1', Float)
+ assert_same_number 0.1, Format[].read(Float, '0.1')
+ end
+
end