mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00

In Ruby < 3.0, the superclass of StringIO was actually already `Data`,
but it doesn't have the expected shape. So, on these earlier versions it errors:
> NoMethodError: undefined method `members' for #<StringIO:0x00005641dd5f2880>
> vendor/bundle/ruby/2.6.0/gems/psych-5.2.5/lib/psych/visitors/yaml_tree.rb:170:in `visit_Data'
This test doesn't fail on 2.7, presumably because it can pull in a newer `stringio` version.
0f40f56268
14 lines
345 B
Ruby
14 lines
345 B
Ruby
# frozen_string_literal: true
|
|
require_relative 'helper'
|
|
|
|
module Psych
|
|
class TestStringIO < TestCase
|
|
# The superclass of StringIO before Ruby 3.0 was `Data`,
|
|
# which can interfere with the Ruby 3.2+ `Data` dumping.
|
|
def test_stringio
|
|
assert_nothing_raised do
|
|
Psych.dump(StringIO.new("foo"))
|
|
end
|
|
end
|
|
end
|
|
end
|