diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2009-10-07 11:52:54 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2009-10-07 11:52:54 -0700 |
commit | c330b9e93fdf5eb15aea29ede9dd017c037b3942 (patch) | |
tree | f91933139de909a5addde8a39379189ade17f356 /test/visitors/test_yast_builder.rb | |
parent | d3bfc7a71256f84d4ce1b7e31b032739f02dfb55 (diff) | |
download | psych-c330b9e93fdf5eb15aea29ede9dd017c037b3942.zip |
structs will round trip
Diffstat (limited to 'test/visitors/test_yast_builder.rb')
-rw-r--r-- | test/visitors/test_yast_builder.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/visitors/test_yast_builder.rb b/test/visitors/test_yast_builder.rb index d35ff3d..4730e7d 100644 --- a/test/visitors/test_yast_builder.rb +++ b/test/visitors/test_yast_builder.rb @@ -8,6 +8,18 @@ module Psych @v = Visitors::YASTBuilder.new end + A = Struct.new(:foo) + + def test_struct + assert_round_trip A.new('bar') + end + + def test_struct_anon + s = Struct.new(:foo).new('bar') + obj = Psych.load(Psych.dump(s)) + assert_equal s.foo, obj.foo + end + def test_exception ex = Exception.new 'foo' loaded = Psych.load(Psych.dump(ex)) |