diff options
author | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2017-03-03 16:57:06 +0900 |
---|---|---|
committer | SHIBATA Hiroshi <hsbt@ruby-lang.org> | 2017-03-03 16:57:06 +0900 |
commit | 2aba01fe63bcd26ab3880a5f98eb0477c58758d5 (patch) | |
tree | 20bf55f1a2d38b029e323337a29ae034d4b7acb9 /test | |
parent | d65cc11cedc7b0e834cd2ee70b10f95721662082 (diff) | |
download | psych-2aba01fe63bcd26ab3880a5f98eb0477c58758d5.zip |
Removed aliases for Syck module.
* Removed alias for to_yaml.
* Renamed pysch_to_yaml to to_yaml.
* Removed Pysch.quick_emit. Because it caused infinite recuresion call used to_yaml.
Diffstat (limited to 'test')
-rw-r--r-- | test/psych/helper.rb | 10 | ||||
-rw-r--r-- | test/psych/test_deprecated.rb | 37 |
2 files changed, 6 insertions, 41 deletions
diff --git a/test/psych/helper.rb b/test/psych/helper.rb index 0474cf1..7b564bd 100644 --- a/test/psych/helper.rb +++ b/test/psych/helper.rb @@ -50,10 +50,10 @@ module Psych def assert_to_yaml( obj, yaml ) assert_equal( obj, Psych::load( yaml ) ) assert_equal( obj, Psych::parse( yaml ).transform ) - assert_equal( obj, Psych::load( obj.psych_to_yaml ) ) - assert_equal( obj, Psych::parse( obj.psych_to_yaml ).transform ) + assert_equal( obj, Psych::load( obj.to_yaml ) ) + assert_equal( obj, Psych::parse( obj.to_yaml ).transform ) assert_equal( obj, Psych::load( - obj.psych_to_yaml( + obj.to_yaml( :UseVersion => true, :UseHeader => true, :SortKeys => true ) )) @@ -73,11 +73,11 @@ module Psych if obj.nil? assert_nil Psych.load(v.tree.yaml) assert_nil Psych::load(Psych.dump(obj)) - assert_nil Psych::load(obj.psych_to_yaml) + assert_nil Psych::load(obj.to_yaml) else assert_equal(obj, Psych.load(v.tree.yaml)) assert_equal(obj, Psych::load(Psych.dump(obj))) - assert_equal(obj, Psych::load(obj.psych_to_yaml)) + assert_equal(obj, Psych::load(obj.to_yaml)) end end diff --git a/test/psych/test_deprecated.rb b/test/psych/test_deprecated.rb index a806f6b..6489edd 100644 --- a/test/psych/test_deprecated.rb +++ b/test/psych/test_deprecated.rb @@ -8,47 +8,12 @@ module Psych Psych.domain_types.clear end - class QuickEmitter - attr_reader :name - attr_reader :value - - def initialize - @name = 'hello!!' - @value = 'Friday!' - end - - def to_yaml opts = {} - Psych.quick_emit object_id, opts do |out| - out.map taguri, to_yaml_style do |map| - map.add 'name', @name - map.add 'value', nil - end - end - end - end + class QuickEmitter; end def setup - @qe = QuickEmitter.new @orig_verbose, $VERBOSE = $VERBOSE, false end - def test_quick_emit - qe2 = Psych.load @qe.to_yaml - assert_equal @qe.name, qe2.name - assert_instance_of QuickEmitter, qe2 - assert_nil qe2.value - end - - def test_recursive_quick_emit - hash = { :qe => @qe } - hash2 = Psych.load Psych.dump hash - qe = hash2[:qe] - - assert_equal @qe.name, qe.name - assert_instance_of QuickEmitter, qe - assert_nil qe.value - end - class QuickEmitterEncodeWith attr_reader :name attr_reader :value |