1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/psych] add more tests

https://github.com/ruby/psych/commit/8f71222bf3
This commit is contained in:
Alexandr Opak 2021-01-29 14:10:04 +01:00 committed by Hiroshi SHIBATA
parent beffa72c27
commit 44353d0dee
2 changed files with 10 additions and 6 deletions

View file

@ -13,10 +13,10 @@ module Psych
FLOAT = /^(?:[-+]?([0-9][0-9_,]*)?\.[0-9]*([eE][-+][0-9]+)?(?# base 10))$/x
# Taken from http://yaml.org/type/int.html
INTEGER = /^(?:[-+]?0b[0-1_,]+ (?# base 2)
|[-+]?0[0-7_,]+ (?# base 8)
|[-+]?(?:\d|[1-9][0-9_,]*[^_]) (?# base 10)
|[-+]?0x[0-9a-fA-F_,]+ (?# base 16))$/x
INTEGER = /^(?:[-+]?0b[0-1_,]+ (?# base 2)
|[-+]?0[0-7_,]+ (?# base 8)
|[-+]?(?:0|[1-9]([0-9]|,[0-9]|_[0-9])*) (?# base 10)
|[-+]?0x[0-9a-fA-F_,]+ (?# base 16))$/x
attr_reader :class_loader

View file

@ -115,11 +115,15 @@ module Psych
end
def test_scan_strings_starting_with_underscores
assert_equal "_100", ss.tokenize('_100')
assert_equal '_100', ss.tokenize('_100')
end
def test_scan_strings_starting_with_number
assert_equal '450D', ss.tokenize('450D')
end
def test_scan_strings_ending_with_underscores
assert_equal "100_", ss.tokenize('100_')
assert_equal '100_', ss.tokenize('100_')
end
def test_scan_int_commas_and_underscores