summaryrefslogtreecommitdiff
path: root/test/psych/test_array.rb
diff options
context:
space:
mode:
authorAlexander Momchilov <alexander.momchilov@shopify.com>2022-07-27 10:19:37 -0400
committergit <svn-admin@ruby-lang.org>2022-08-09 01:31:24 +0900
commit71f89c287459d5ca313d0b1a16b7a743e0d71b8b (patch)
treecec765a3077ee3b37793517ae955fec538fd0d0b /test/psych/test_array.rb
parent0b7cfdca09651f2eae5cd0e8ae4efed5033493f2 (diff)
[ruby/psych] Don't hardcode expected alias names
https://github.com/ruby/psych/commit/b9ab19094f
Diffstat (limited to 'test/psych/test_array.rb')
-rw-r--r--test/psych/test_array.rb19
1 files changed, 11 insertions, 8 deletions
diff --git a/test/psych/test_array.rb b/test/psych/test_array.rb
index a6be0baf2f..6a9931ab2f 100644
--- a/test/psych/test_array.rb
+++ b/test/psych/test_array.rb
@@ -57,17 +57,20 @@ module Psych
assert_cycle(@list)
end
- def test_recursive_array_uses_alias
+ def test_recursive_array
@list << @list
- expected = <<~eoyaml
- --- &1
- - :a: b
- - foo
- - *1
- eoyaml
+ loaded = Psych.load(Psych.dump(@list), aliases: true)
+
+ assert_same loaded, loaded.last
+ end
+
+ def test_recursive_array_uses_alias
+ @list << @list
- assert_equal expected, Psych.dump(@list)
+ assert_raise(BadAlias) do
+ Psych.load(Psych.dump(@list), aliases: false)
+ end
end
def test_cycle