summaryrefslogtreecommitdiff
path: root/test/psych/test_psych.rb
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2020-06-03 10:18:34 -0700
committerAaron Patterson <tenderlove@ruby-lang.org>2020-06-03 10:18:34 -0700
commit3f5e520fd38c39975c25a1bbd8d6c8ec9a132f2d (patch)
tree5bbdf5f950ce1c54c18e5640bafca442cfd2dcc6 /test/psych/test_psych.rb
parentd2deaa9adfc88fc0b870df022a434d6431277d08 (diff)
downloadpsych-3f5e520fd38c39975c25a1bbd8d6c8ec9a132f2d.zip
Fixing compatibility with libyaml 0.2.5
The main issue is that commas aren't allowed in local tags. libyaml was updated to follow the spec, and our tests were out of date. See: https://github.com/yaml/libyaml/issues/196
Diffstat (limited to 'test/psych/test_psych.rb')
-rw-r--r--test/psych/test_psych.rb17
1 files changed, 7 insertions, 10 deletions
diff --git a/test/psych/test_psych.rb b/test/psych/test_psych.rb
index 8fd9d27..55d9f19 100644
--- a/test/psych/test_psych.rb
+++ b/test/psych/test_psych.rb
@@ -178,17 +178,17 @@ class TestPsych < Psych::TestCase
def test_domain_types
got = nil
- Psych.add_domain_type 'foo.bar,2002', 'foo' do |type, val|
+ Psych.add_domain_type 'foo.bar/2002', 'foo' do |type, val|
got = val
end
- Psych.load('--- !foo.bar,2002/foo hello')
+ Psych.load('--- !foo.bar/2002:foo hello')
assert_equal 'hello', got
- Psych.load("--- !foo.bar,2002/foo\n- hello\n- world")
+ Psych.load("--- !foo.bar/2002:foo\n- hello\n- world")
assert_equal %w{ hello world }, got
- Psych.load("--- !foo.bar,2002/foo\nhello: world")
+ Psych.load("--- !foo.bar/2002:foo\nhello: world")
assert_equal({ 'hello' => 'world' }, got)
end
@@ -311,16 +311,13 @@ class TestPsych < Psych::TestCase
types = []
appender = lambda { |*args| types << args }
- Psych.add_builtin_type('foo', &appender)
- Psych.add_domain_type('example.com,2002', 'foo', &appender)
+ Psych.add_domain_type('example.com:2002', 'foo', &appender)
Psych.load <<-eoyml
-- !tag:yaml.org,2002:foo bar
-- !tag:example.com,2002:foo bar
+- !tag:example.com:2002:foo bar
eoyml
assert_equal [
- ["tag:yaml.org,2002:foo", "bar"],
- ["tag:example.com,2002:foo", "bar"]
+ ["tag:example.com:2002:foo", "bar"]
], types
end