[前][次][番号順一覧][スレッド一覧]

ruby-changes:66225

From: Yusuke <ko1@a...>
Date: Mon, 17 May 2021 11:38:43 +0900 (JST)
Subject: [ruby-changes:66225] da5b283963 (master): test/ostruct/test_ostruct.rb: Use YAML.unsafe_load instead of YAML.load

https://git.ruby-lang.org/ruby.git/commit/?id=da5b283963

From da5b28396397ace84d914cb188055cbeb46b8725 Mon Sep 17 00:00:00 2001
From: Yusuke Endoh <mame@r...>
Date: Mon, 17 May 2021 11:36:16 +0900
Subject: test/ostruct/test_ostruct.rb: Use YAML.unsafe_load instead of
 YAML.load

Follow-up of fbb4e3f96c10de2240f2d87eac19cf6f62f65fea
---
 test/ostruct/test_ostruct.rb | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/ostruct/test_ostruct.rb b/test/ostruct/test_ostruct.rb
index ba6b701..7773da4 100644
--- a/test/ostruct/test_ostruct.rb
+++ b/test/ostruct/test_ostruct.rb
@@ -357,18 +357,18 @@ class TC_OpenStruct < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ostruct/test_ostruct.rb#L357
 
   def test_legacy_yaml
     s = "--- !ruby/object:OpenStruct\ntable:\n  :foo: 42\n"
-    o = YAML.load(s)
+    o = YAML.unsafe_load(s)
     assert_equal(42, o.foo)
 
     o = OpenStruct.new(table: {foo: 42})
-    assert_equal({foo: 42}, YAML.load(YAML.dump(o)).table)
+    assert_equal({foo: 42}, YAML.unsafe_load(YAML.dump(o)).table)
   end
 
   def test_yaml
     h = {name: "John Smith", age: 70, pension: 300.42}
     yaml = "--- !ruby/object:OpenStruct\nname: John Smith\nage: 70\npension: 300.42\n"
     os1 = OpenStruct.new(h)
-    os2 = YAML.load(os1.to_yaml)
+    os2 = YAML.unsafe_load(os1.to_yaml)
     assert_equal yaml, os1.to_yaml
     assert_equal os1, os2
     assert_equal true, os1.eql?(os2)
-- 
cgit v1.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]