summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlexandr Opak <opak.alexandr@gmail.com>2021-01-29 13:04:37 +0100
committerAlexandr Opak <opak.alexandr@gmail.com>2021-01-29 13:04:37 +0100
commite0bb853014a7b11477e8e0693b4375cbeed4b364 (patch)
tree14289618d06dddf0e11555b18956f548ba042035 /test
parent0abce07b908fa0128223a3e11f2eeb4be0c191d6 (diff)
downloadpsych-e0bb853014a7b11477e8e0693b4375cbeed4b364.tar.gz
fix parsing integer values with '_' at the end
Diffstat (limited to 'test')
-rw-r--r--test/psych/test_scalar_scanner.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/psych/test_scalar_scanner.rb b/test/psych/test_scalar_scanner.rb
index 1bd6488..f56b45b 100644
--- a/test/psych/test_scalar_scanner.rb
+++ b/test/psych/test_scalar_scanner.rb
@@ -114,13 +114,20 @@ module Psych
assert_equal "_100", ss.tokenize('_100')
end
+ def test_scan_strings_ending_with_underscores
+ assert_equal "100_", ss.tokenize('100_')
+ end
+
def test_scan_int_commas_and_underscores
# NB: This test is to ensure backward compatibility with prior Psych versions,
# not to test against any actual YAML specification.
assert_equal 123_456_789, ss.tokenize('123_456_789')
assert_equal 123_456_789, ss.tokenize('123,456,789')
assert_equal 123_456_789, ss.tokenize('1_2,3,4_5,6_789')
- assert_equal 123_456_789, ss.tokenize('1_2,3,4_5,6_789_')
+
+ assert_equal 1, ss.tokenize('1')
+ assert_equal 1 ss.tokenize('+1')
+ assert_equal -1 ss.tokenize('-1')
assert_equal 0b010101010, ss.tokenize('0b010101010')
assert_equal 0b010101010, ss.tokenize('0b0,1_0,1_,0,1_01,0')