diff options
author | Aaron Patterson <tenderlove@ruby-lang.org> | 2021-05-13 10:49:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-13 10:49:03 -0700 |
commit | 4de7e9c879ae042d0c25d6ade6274d593c4cc5bb (patch) | |
tree | 400c2acb636fe2e4f0a56920165648f28132a9cd /test/psych/test_string.rb | |
parent | 64bee7e2dee741a9f64e5c1b2122c07ef3e6c81a (diff) | |
parent | cb50aa8d3fb8be01897becff77b4922b12a0ab4c (diff) | |
download | psych-4de7e9c879ae042d0c25d6ade6274d593c4cc5bb.zip |
Merge pull request #488 from ruby/add-unsafe
Introduce `Psych.unsafe_load`
Diffstat (limited to 'test/psych/test_string.rb')
-rw-r--r-- | test/psych/test_string.rb | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/test/psych/test_string.rb b/test/psych/test_string.rb index 973f38b..20ab79c 100644 --- a/test/psych/test_string.rb +++ b/test/psych/test_string.rb @@ -104,7 +104,7 @@ module Psych end def test_string_subclass_with_anchor - y = Psych.load <<-eoyml + y = Psych.unsafe_load <<-eoyml --- body: string: &70121654388580 !ruby/string @@ -116,7 +116,7 @@ body: end def test_self_referential_string - y = Psych.load <<-eoyml + y = Psych.unsafe_load <<-eoyml --- string: &70121654388580 !ruby/string str: ! 'foo' @@ -129,32 +129,32 @@ string: &70121654388580 !ruby/string end def test_another_subclass_with_attributes - y = Psych.load Psych.dump Y.new("foo").tap {|o| o.val = 1} + y = Psych.unsafe_load Psych.dump Y.new("foo").tap {|o| o.val = 1} assert_equal "foo", y assert_equal Y, y.class assert_equal 1, y.val end def test_backwards_with_syck - x = Psych.load "--- !str:#{X.name} foo\n\n" + x = Psych.unsafe_load "--- !str:#{X.name} foo\n\n" assert_equal X, x.class assert_equal 'foo', x end def test_empty_subclass assert_match "!ruby/string:#{X}", Psych.dump(X.new) - x = Psych.load Psych.dump X.new + x = Psych.unsafe_load Psych.dump X.new assert_equal X, x.class end def test_empty_character_subclass assert_match "!ruby/string:#{Z}", Psych.dump(Z.new) - x = Psych.load Psych.dump Z.new + x = Psych.unsafe_load Psych.dump Z.new assert_equal Z, x.class end def test_subclass_with_attributes - y = Psych.load Psych.dump Y.new.tap {|o| o.val = 1} + y = Psych.unsafe_load Psych.dump Y.new.tap {|o| o.val = 1} assert_equal Y, y.class assert_equal 1, y.val end |