Skip to content
Permalink
Browse files

Support YAML 1.2 Core Schema. Addressed https://bugs.ruby-lang.org/is…

  • Loading branch information
hsbt committed Feb 9, 2016
1 parent 8d3a63e commit b737f0811a9687cf86f44f0a35f61cbde9eac673
Showing with 7 additions and 1 deletion.
  1. +1 −1 lib/psych/visitors/yaml_tree.rb
  2. +6 −0 test/psych/visitors/test_yaml_tree.rb
@@ -330,7 +330,7 @@ def visit_String o
style = Nodes::Scalar::FOLDED
elsif o =~ /^[^[:word:]][^"]*$/
style = Nodes::Scalar::DOUBLE_QUOTED
elsif not String === @ss.tokenize(o)
elsif not String === @ss.tokenize(o) or /\A0[0-7]*[89]/ =~ o
style = Nodes::Scalar::SINGLE_QUOTED
end

@@ -155,6 +155,12 @@ def test_float
assert_equal(-1, Psych.load(Psych.dump(-1 / 0.0)).infinite?)
end

def test_string
assert_match(/'017'/, Psych.dump({'a' => '017'}))
assert_match(/'019'/, Psych.dump({'a' => '019'}))
assert_match(/'01818'/, Psych.dump({'a' => '01818'}))
end

# http://yaml.org/type/null.html
def test_nil
assert_cycle nil

0 comments on commit b737f08

Please sign in to comment.
You can’t perform that action at this time.