summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2021-08-04 09:43:06 -0700
committerGitHub <noreply@github.com>2021-08-04 09:43:06 -0700
commit50fd106a657c4437f946cdd5044da39596f028ef (patch)
treecbbcfe257c37f6f592af29be998e5b2357ad0c2d /test
parent0be49786edf40b9956da0693d112f770588424e4 (diff)
parent64cc239557d83058cde9af686900270fc173e105 (diff)
downloadpsych-50fd106a657c4437f946cdd5044da39596f028ef.tar.gz
Merge pull request #473 from OpakAlex/fix-integer-parsing-for-yaml
fix parsing integer values with '_' at the end
Diffstat (limited to 'test')
-rw-r--r--test/psych/test_scalar_scanner.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/test/psych/test_scalar_scanner.rb b/test/psych/test_scalar_scanner.rb
index 1bd6488..2cd129e 100644
--- a/test/psych/test_scalar_scanner.rb
+++ b/test/psych/test_scalar_scanner.rb
@@ -111,7 +111,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_')
end
def test_scan_int_commas_and_underscores
@@ -120,7 +128,10 @@ module Psych
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')