summaryrefslogtreecommitdiff
path: root/test/visitors/test_yast_builder.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2009-10-07 11:52:54 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2009-10-07 11:52:54 -0700
commitc330b9e93fdf5eb15aea29ede9dd017c037b3942 (patch)
treef91933139de909a5addde8a39379189ade17f356 /test/visitors/test_yast_builder.rb
parentd3bfc7a71256f84d4ce1b7e31b032739f02dfb55 (diff)
downloadpsych-c330b9e93fdf5eb15aea29ede9dd017c037b3942.zip
structs will round trip
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))