summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2010-03-23 11:02:41 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2010-03-23 11:02:41 -0700
commit8be32c99e14b9d5cbb6499411c58c41558a0ef31 (patch)
treeb3627773cf52d66380b13a4a977793bb3c856e4d /test
parent668fbbe73c6706b40060f457418b8045c16a667b (diff)
downloadpsych-8be32c99e14b9d5cbb6499411c58c41558a0ef31.zip
adding tests and fixing bugs with ruby symbols. thanks Peter McLain!
Diffstat (limited to 'test')
-rw-r--r--test/psych/test_alias_and_anchor.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/psych/test_alias_and_anchor.rb b/test/psych/test_alias_and_anchor.rb
new file mode 100644
index 0000000..51b048f
--- /dev/null
+++ b/test/psych/test_alias_and_anchor.rb
@@ -0,0 +1,28 @@
+require 'minitest/autorun'
+require 'psych'
+
+module Psych
+ class TestAliasAndAnchor < MiniTest::Unit::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