From e6185dda26ea6db7a3515d4f47ab231f5f4ac902 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Sat, 26 Nov 2022 15:10:38 -0500 Subject: [PATCH] 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. --- 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 b1ca9e82..69563168 100644 --- a/test/net/http/test_httpheader.rb +++ b/test/net/http/test_httpheader.rb @@ -28,7 +28,11 @@ def test_initialize 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(ArgumentError){ @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