diff options
author | Seth Boyles <sethboyles@gmail.com> | 2022-01-14 19:58:20 +0000 |
---|---|---|
committer | Seth Boyles <sethboyles@gmail.com> | 2022-01-14 20:09:47 +0000 |
commit | 75bebb37b80c7c3f3c6a157e1dd25112cfae8029 (patch) | |
tree | a6531188e9c0b33bd8b14a2bf83f6fafb1af545b /test/psych/test_numeric.rb | |
parent | ba203f19c03763e6f7b7b97a76ce89e3ae488a6f (diff) | |
download | psych-75bebb37b80c7c3f3c6a157e1dd25112cfae8029.tar.gz |
Add strict_integer option to parse numbers with commas as strings
Authored-by: Seth Boyles <sethboyles@gmail.com>
Diffstat (limited to 'test/psych/test_numeric.rb')
-rw-r--r-- | test/psych/test_numeric.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/psych/test_numeric.rb b/test/psych/test_numeric.rb index 8c3dcd1..9c75c01 100644 --- a/test/psych/test_numeric.rb +++ b/test/psych/test_numeric.rb @@ -43,5 +43,16 @@ module Psych str = Psych.load('--- 1.1.1') assert_equal '1.1.1', str end + + # This behavior is not to YML spec, but is kept for backwards compatibility + def test_string_with_commas + number = Psych.load('--- 12,34,56') + assert_equal 123456, number + end + + def test_string_with_commas_with_strict_integer + str = Psych.load('--- 12,34,56', strict_integer: true) + assert_equal '12,34,56', str + end end end |