summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2016-06-30 18:34:36 -0700
committerGitHub <noreply@github.com>2016-06-30 18:34:36 -0700
commitb1ad4371ef81de68821af202ca10083cc3375ef4 (patch)
tree737b58728e19f6ccd09c2ae80abd7383e3a7a19a /test
parentdebea6b493019ce664000cbf7deeb82387ed91c4 (diff)
parentd5c9b2d4aee89483b79dc4930b79dec7031ef936 (diff)
downloadpsych-b1ad4371ef81de68821af202ca10083cc3375ef4.zip
Merge pull request #276 from ccutrer/invalid_float
fix serialization of a string that looks like a valid YAML float
Diffstat (limited to 'test')
-rw-r--r--test/psych/test_scalar_scanner.rb4
-rw-r--r--test/psych/test_string.rb4
2 files changed, 8 insertions, 0 deletions
diff --git a/test/psych/test_scalar_scanner.rb b/test/psych/test_scalar_scanner.rb
index 7ad18c5..2599989 100644
--- a/test/psych/test_scalar_scanner.rb
+++ b/test/psych/test_scalar_scanner.rb
@@ -74,6 +74,10 @@ module Psych
assert ss.tokenize('.nan').nan?
end
+ def test_scan_float_with_exponent_but_no_fraction
+ assert_equal(0.0, ss.tokenize('0.E+0'))
+ end
+
def test_scan_null
assert_equal nil, ss.tokenize('null')
assert_equal nil, ss.tokenize('~')
diff --git a/test/psych/test_string.rb b/test/psych/test_string.rb
index 51aef40..25c6353 100644
--- a/test/psych/test_string.rb
+++ b/test/psych/test_string.rb
@@ -99,6 +99,10 @@ module Psych
assert_cycle '+.'
end
+ def test_float_with_no_fractional_before_exponent
+ assert_cycle '0.E+0'
+ end
+
def test_string_subclass_with_anchor
y = Psych.load <<-eoyml
---