summaryrefslogtreecommitdiff
path: root/test/psych
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-10 22:26:37 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-11-10 22:26:37 +0000
commitba8d27e670cb728f476bead115c11066f8242885 (patch)
tree1f6e95b01f8678c79e2cabb0f40aa094919cb20c /test/psych
parent49d079ce755b31151f0bfd1326d70ee8c1706299 (diff)
Revert "Merge psych from upstream."
This reverts commit db3101ff301b8e6f52170df0891f4fc35579354f. This caused build error: http://ci.rvm.jp/results/trunk-test@ruby-sky3/1452708 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65658 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/psych')
-rw-r--r--test/psych/test_safe_load.rb40
1 files changed, 20 insertions, 20 deletions
diff --git a/test/psych/test_safe_load.rb b/test/psych/test_safe_load.rb
index e3972712fc..6c7a8d0f5a 100644
--- a/test/psych/test_safe_load.rb
+++ b/test/psych/test_safe_load.rb
@@ -30,12 +30,12 @@ module Psych
def test_explicit_recursion
x = []
x << x
- assert_equal(x, Psych.safe_load(Psych.dump(x), permitted_classes: [], permitted_symbols: [], aliases: true))
+ assert_equal(x, Psych.safe_load(Psych.dump(x), whitelist_classes: [], whitelist_symbols: [], aliases: true))
# deprecated interface
assert_equal(x, Psych.safe_load(Psych.dump(x), [], [], true))
end
- def test_permitted_symbol
+ def test_symbol_whitelist
yml = Psych.dump :foo
assert_raises(Psych::DisallowedClass) do
Psych.safe_load yml
@@ -44,8 +44,8 @@ module Psych
:foo,
Psych.safe_load(
yml,
- permitted_classes: [Symbol],
- permitted_symbols: [:foo]
+ whitelist_classes: [Symbol],
+ whitelist_symbols: [:foo]
)
)
@@ -58,7 +58,7 @@ module Psych
assert_safe_cycle :foo
end
assert_raises(Psych::DisallowedClass) do
- Psych.safe_load '--- !ruby/symbol foo', permitted_classes: []
+ Psych.safe_load '--- !ruby/symbol foo', whitelist_classes: []
end
# deprecated interface
@@ -66,9 +66,9 @@ module Psych
Psych.safe_load '--- !ruby/symbol foo', []
end
- assert_safe_cycle :foo, permitted_classes: [Symbol]
- assert_safe_cycle :foo, permitted_classes: %w{ Symbol }
- assert_equal :foo, Psych.safe_load('--- !ruby/symbol foo', permitted_classes: [Symbol])
+ assert_safe_cycle :foo, whitelist_classes: [Symbol]
+ assert_safe_cycle :foo, whitelist_classes: %w{ Symbol }
+ assert_equal :foo, Psych.safe_load('--- !ruby/symbol foo', whitelist_classes: [Symbol])
# deprecated interface
assert_equal :foo, Psych.safe_load('--- !ruby/symbol foo', [Symbol])
@@ -76,7 +76,7 @@ module Psych
def test_foo
assert_raises(Psych::DisallowedClass) do
- Psych.safe_load '--- !ruby/object:Foo {}', permitted_classes: [Foo]
+ Psych.safe_load '--- !ruby/object:Foo {}', whitelist_classes: [Foo]
end
# deprecated interface
@@ -87,7 +87,7 @@ module Psych
assert_raises(Psych::DisallowedClass) do
assert_safe_cycle Foo.new
end
- assert_kind_of(Foo, Psych.safe_load(Psych.dump(Foo.new), permitted_classes: [Foo]))
+ assert_kind_of(Foo, Psych.safe_load(Psych.dump(Foo.new), whitelist_classes: [Foo]))
# deprecated interface
assert_kind_of(Foo, Psych.safe_load(Psych.dump(Foo.new), [Foo]))
@@ -95,27 +95,27 @@ module Psych
X = Struct.new(:x)
def test_struct_depends_on_sym
- assert_safe_cycle(X.new, permitted_classes: [X, Symbol])
+ assert_safe_cycle(X.new, whitelist_classes: [X, Symbol])
assert_raises(Psych::DisallowedClass) do
- cycle X.new, permitted_classes: [X]
+ cycle X.new, whitelist_classes: [X]
end
end
def test_anon_struct
- assert Psych.safe_load(<<-eoyml, permitted_classes: [Struct, Symbol])
+ assert Psych.safe_load(<<-eoyml, whitelist_classes: [Struct, Symbol])
--- !ruby/struct
foo: bar
eoyml
assert_raises(Psych::DisallowedClass) do
- Psych.safe_load(<<-eoyml, permitted_classes: [Struct])
+ Psych.safe_load(<<-eoyml, whitelist_classes: [Struct])
--- !ruby/struct
foo: bar
eoyml
end
assert_raises(Psych::DisallowedClass) do
- Psych.safe_load(<<-eoyml, permitted_classes: [Symbol])
+ Psych.safe_load(<<-eoyml, whitelist_classes: [Symbol])
--- !ruby/struct
foo: bar
eoyml
@@ -157,14 +157,14 @@ module Psych
private
- def cycle object, permitted_classes: []
- Psych.safe_load(Psych.dump(object), permitted_classes: permitted_classes)
+ def cycle object, whitelist_classes: []
+ Psych.safe_load(Psych.dump(object), whitelist_classes: whitelist_classes)
# deprecated interface test
- Psych.safe_load(Psych.dump(object), permitted_classes)
+ Psych.safe_load(Psych.dump(object), whitelist_classes)
end
- def assert_safe_cycle object, permitted_classes: []
- other = cycle object, permitted_classes: permitted_classes
+ def assert_safe_cycle object, whitelist_classes: []
+ other = cycle object, whitelist_classes: whitelist_classes
assert_equal object, other
end
end