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

* ext/psych/lib/psych/visitors/yaml_tree.rb: dump empty symbols with a

tag so that they can be parsed on input. [Bug #9873] [ruby-core:62825]
* test/psych/test_symbol.rb: test for change

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tenderlove 2014-06-05 22:42:58 +00:00
parent 88fda023aa
commit 3f6eafaaa0
3 changed files with 19 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Fri Jun 6 07:41:41 2014 Aaron Patterson <aaron@tenderlovemaking.com>
* ext/psych/lib/psych/visitors/yaml_tree.rb: dump empty symbols with a
tag so that they can be parsed on input. [Bug #9873] [ruby-core:62825]
* test/psych/test_symbol.rb: test for change
Thu Jun 5 16:08:39 2014 Koichi Sasada <ko1@atdot.net>
* gc.c (gc_page_sweep): refactoring.

View file

@ -378,7 +378,11 @@ module Psych
end
def visit_Symbol o
@emitter.scalar ":#{o}", nil, nil, true, false, Nodes::Scalar::ANY
if o.empty?
@emitter.scalar "", nil, '!ruby/symbol', false, false, Nodes::Scalar::ANY
else
@emitter.scalar ":#{o}", nil, nil, true, false, Nodes::Scalar::ANY
end
end
private

View file

@ -2,6 +2,14 @@ require_relative 'helper'
module Psych
class TestSymbol < TestCase
def test_cycle_empty
assert_cycle :''
end
def test_cycle_colon
assert_cycle :':'
end
def test_cycle
assert_cycle :a
end