summaryrefslogtreecommitdiff
path: root/test/psych/test_alias_and_anchor.rb
blob: 8c9cd8076a4afa255c9d45dd456812272f28097c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
require_relative 'helper'

module Psych
 class TestAliasAndAnchor < TestCase
   def test_mri_compatibility
     yaml = <<EOYAML
---
- &id001 !ruby/object {}

- *id001
- *id001
EOYAML
     result = Psych.load yaml
     result.each {|el| assert_same(result[0], el) }
   end

   def test_anchor_alias_round_trip
     o = Object.new
     original = [o,o,o]

     yaml = Psych.dump original
     result = Psych.load yaml
     result.each {|el| assert_same(result[0], el) }
   end
 end
end