diff options
author | Seth Boyles <sethboyles@gmail.com> | 2022-01-14 19:58:20 +0000 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-01-22 10:00:51 +0900 |
commit | c1a6ff046d4f27c972adf96f9a6724abc2f0647a (patch) | |
tree | f3924a5c026669589d07d2eab9a9e6673684c8f8 /test/psych/test_numeric.rb | |
parent | b815a0bd75b660652bf05479467904fa06399092 (diff) |
[ruby/psych] Add strict_integer option to parse numbers with commas as strings
Authored-by: Seth Boyles <sethboyles@gmail.com>
https://github.com/ruby/psych/commit/75bebb37b8
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 8c3dcd173c..9c75c016cd 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 |