summaryrefslogtreecommitdiff
path: root/test/test_psych.rb
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2009-10-08 21:12:48 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2009-10-08 21:12:48 -0700
commit4d6d48b119cf62fb01f54730e9efcf76b8ab351a (patch)
tree89427eba988dac667cfe0a81bc89809f7ba0712c /test/test_psych.rb
parent6f5fcb7d4e7388f2ba78f3b0b6b35563fd11135a (diff)
downloadpsych-4d6d48b119cf62fb01f54730e9efcf76b8ab351a.zip
supporting add_domain_ype syntax
Diffstat (limited to 'test/test_psych.rb')
-rw-r--r--test/test_psych.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_psych.rb b/test/test_psych.rb
index 690bf23..4bea1b3 100644
--- a/test/test_psych.rb
+++ b/test/test_psych.rb
@@ -18,4 +18,20 @@ class TestPsych < MiniTest::Unit::TestCase
}
assert_equal %w{ foo bar }, docs
end
+
+ def test_domain_types
+ got = nil
+ Psych.add_domain_type 'foo.bar,2002', 'foo' do |type, val|
+ got = val
+ end
+
+ Psych.load('--- !foo.bar,2002/foo hello')
+ assert_equal 'hello', got
+
+ Psych.load("--- !foo.bar,2002/foo\n- hello\n- world")
+ assert_equal %w{ hello world }, got
+
+ Psych.load("--- !foo.bar,2002/foo\nhello: world")
+ assert_equal({ 'hello' => 'world' }, got)
+ end
end