From de9e2a5ac7b4ef52a03b1b6a3b07708f11d8d11c Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Sat, 26 Nov 2022 16:06:05 -0500 Subject: [PATCH] [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@e6185dda26ea6db7a3515d4f47ab231f5f4ac902 --- test/net/http/test_httpheader.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/test/net/http/test_httpheader.rb b/test/net/http/test_httpheader.rb index fe43ff0405..69563168db 100644 --- a/test/net/http/test_httpheader.rb +++ b/test/net/http/test_httpheader.rb @@ -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