2009-11-16 12:27:05 -05:00
|
|
|
require 'test/unit'
|
|
|
|
require 'yaml'
|
|
|
|
|
2010-04-10 20:37:42 -04:00
|
|
|
module Syck
|
2009-11-16 12:27:05 -05:00
|
|
|
class TestHash < Test::Unit::TestCase
|
|
|
|
def setup
|
|
|
|
@hash = { :a => 'b' }
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_to_yaml
|
|
|
|
assert_equal @hash, YAML.load(@hash.to_yaml)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_dump
|
|
|
|
assert_equal @hash, YAML.load(YAML.dump(@hash))
|
|
|
|
end
|
2010-03-22 16:18:57 -04:00
|
|
|
|
|
|
|
def test_ref_append
|
|
|
|
hash = YAML.load(<<-eoyml)
|
|
|
|
---
|
|
|
|
foo: &foo
|
|
|
|
hello: world
|
|
|
|
bar:
|
|
|
|
<<: *foo
|
|
|
|
eoyml
|
|
|
|
assert_equal({"foo"=>{"hello"=>"world"}, "bar"=>{"hello"=>"world"}}, hash)
|
|
|
|
end
|
2009-11-16 12:27:05 -05:00
|
|
|
end
|
|
|
|
end
|