summaryrefslogtreecommitdiff
path: root/test/psych/test_psych.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/psych/test_psych.rb')
-rw-r--r--test/psych/test_psych.rb23
1 files changed, 12 insertions, 11 deletions
diff --git a/test/psych/test_psych.rb b/test/psych/test_psych.rb
index 30612de..9eea4a0 100644
--- a/test/psych/test_psych.rb
+++ b/test/psych/test_psych.rb
@@ -16,7 +16,7 @@ class TestPsych < Psych::TestCase
end
def test_line_width_invalid
- assert_raises(ArgumentError) { Psych.dump('x', { :line_width => -2 }) }
+ assert_raise(ArgumentError) { Psych.dump('x', { :line_width => -2 }) }
end
def test_line_width_no_limit
@@ -61,7 +61,7 @@ class TestPsych < Psych::TestCase
end
def test_load_argument_error
- assert_raises(TypeError) do
+ assert_raise(TypeError) do
Psych.load nil
end
end
@@ -75,7 +75,7 @@ class TestPsych < Psych::TestCase
end
def test_parse_raises_on_bad_input
- assert_raises(Psych::SyntaxError) { Psych.parse("--- `") }
+ assert_raise(Psych::SyntaxError) { Psych.parse("--- `") }
end
def test_parse_with_fallback
@@ -83,7 +83,7 @@ class TestPsych < Psych::TestCase
end
def test_non_existing_class_on_deserialize
- e = assert_raises(ArgumentError) do
+ e = assert_raise(ArgumentError) do
Psych.load("--- !ruby/object:NonExistent\nfoo: 1")
end
assert_equal 'undefined class/module NonExistent', e.message
@@ -143,7 +143,7 @@ class TestPsych < Psych::TestCase
end
def test_load_stream_raises_on_bad_input
- assert_raises(Psych::SyntaxError) { Psych.load_stream("--- `") }
+ assert_raise(Psych::SyntaxError) { Psych.load_stream("--- `") }
end
def test_parse_stream
@@ -175,7 +175,7 @@ class TestPsych < Psych::TestCase
end
def test_parse_stream_raises_on_bad_input
- assert_raises(Psych::SyntaxError) { Psych.parse_stream("--- `") }
+ assert_raise(Psych::SyntaxError) { Psych.parse_stream("--- `") }
end
def test_add_builtin_type
@@ -214,7 +214,7 @@ class TestPsych < Psych::TestCase
def test_load_freeze_deduplication
unless String.method_defined?(:-@) && (-("a" * 20)).equal?((-("a" * 20)))
- skip "This Ruby implementation doesn't support string deduplication"
+ pend "This Ruby implementation doesn't support string deduplication"
end
data = Psych.load("--- ['a']", freeze: true)
@@ -325,7 +325,7 @@ class TestPsych < Psych::TestCase
t.write("--- !ruby/range\nbegin: 0\nend: 42\nexcl: false\n")
t.close
assert_equal 0..42, Psych.safe_load_file(t.path, permitted_classes: [Range])
- assert_raises(Psych::DisallowedClass) {
+ assert_raise(Psych::DisallowedClass) {
Psych.safe_load_file(t.path)
}
}
@@ -371,17 +371,18 @@ class TestPsych < Psych::TestCase
yaml = <<-eoyml
foo:
bar: baz
+ 1: 2
hoge:
- fuga: piyo
eoyml
result = Psych.load(yaml)
- assert_equal result, { "foo" => { "bar" => "baz"}, "hoge" => [{ "fuga" => "piyo" }] }
+ assert_equal result, { "foo" => { "bar" => "baz", 1 => 2 }, "hoge" => [{ "fuga" => "piyo" }] }
result = Psych.load(yaml, symbolize_names: true)
- assert_equal result, { foo: { bar: "baz" }, hoge: [{ fuga: "piyo" }] }
+ assert_equal result, { foo: { bar: "baz", 1 => 2 }, hoge: [{ fuga: "piyo" }] }
result = Psych.safe_load(yaml, symbolize_names: true)
- assert_equal result, { foo: { bar: "baz" }, hoge: [{ fuga: "piyo" }] }
+ assert_equal result, { foo: { bar: "baz", 1 => 2 }, hoge: [{ fuga: "piyo" }] }
end
end