[ruby/net-http] Fix test for Ruby head

The error raised for broken coderanges was changed in ruby/ruby@571d21f
and the test was fixed in that commit but not ported to this repo.

ruby/net-http@e6185dda26
This commit is contained in:
Peter Zhu 2022-11-26 16:06:05 -05:00
parent 26794b95cf
commit de9e2a5ac7

View File

@ -28,7 +28,11 @@ class HTTPHeaderTest < Test::Unit::TestCase
assert_raise(NoMethodError){ @c.initialize_http_header("foo"=>[]) }
assert_raise(ArgumentError){ @c.initialize_http_header("foo"=>"a\nb") }
assert_raise(ArgumentError){ @c.initialize_http_header("foo"=>"a\rb") }
assert_raise(Encoding::CompatibilityError){ @c.initialize_http_header("foo"=>"a\xff") }
end
def test_initialize_with_broken_coderange
error = RUBY_VERSION >= "3.2" ? Encoding::CompatibilityError : ArgumentError
assert_raise(error){ @c.initialize_http_header("foo"=>"a\xff") }
end
def test_initialize_with_symbol