summaryrefslogtreecommitdiff
path: root/test/visitors/test_yast_builder.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/visitors/test_yast_builder.rb')
-rw-r--r--test/visitors/test_yast_builder.rb12
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))