summaryrefslogtreecommitdiff
path: root/test/psych/test_alias_and_anchor.rb
blob: 48771d6e25b26e1917fb5b8807968d153de68c08 (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 'psych/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