From d21f0062755c27d4dac1d99b79925831d842f11a Mon Sep 17 00:00:00 2001 From: nick evans Date: Fri, 3 Oct 2025 16:19:56 -0400 Subject: [PATCH 1/6] =?UTF-8?q?=F0=9F=A9=B9=20Workaround=20JRuby=20JSON=20?= =?UTF-8?q?encoding=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/ruby/json/issues/870 --- rakelib/string_prep_tables_generator.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rakelib/string_prep_tables_generator.rb b/rakelib/string_prep_tables_generator.rb index 44f2ce88e..e9132bbcf 100644 --- a/rakelib/string_prep_tables_generator.rb +++ b/rakelib/string_prep_tables_generator.rb @@ -292,6 +292,12 @@ def parse_rfc_text(rfc3454_text) .to_h.compact .transform_values {|t| t.first.size == 2 ? t.to_h : t } tables["titles"] = titles + + # See https://github.com/ruby/json/issues/870 + if RUBY_ENGINE == "jruby" + tables["titles"].transform_values! { _1.dump.undump } + end + tables end From a206618fa436004fbce610e95a59cd71ee2e983d Mon Sep 17 00:00:00 2001 From: nick evans Date: Fri, 3 Oct 2025 18:33:54 -0400 Subject: [PATCH 2/6] =?UTF-8?q?=E2=9C=85=F0=9F=9A=A7=20Mark=202=20::Data?= =?UTF-8?q?=20tests=20as=20pending=20for=20JRuby?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/net/imap/test_data_lite.rb | 54 ++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/test/net/imap/test_data_lite.rb b/test/net/imap/test_data_lite.rb index 42681a0e1..69352f7fa 100644 --- a/test/net/imap/test_data_lite.rb +++ b/test/net/imap/test_data_lite.rb @@ -174,30 +174,32 @@ def initialize(value:, head: nil, tail: nil) end end - # anonymous class - list = klass[value: 1, tail: [2, 3, 4]] - seen = "#" - assert_equal( - "#>>>", - list.inspect - ) - - # named class - Object.const_set(:DoubleLinkList, klass) - list = DoubleLinkList[value: 1, tail: [2, 3, 4]] - seen = "#" - assert_equal( - "#>>>", - list.inspect - ) + pend_if_jruby do + # anonymous class + list = klass[value: 1, tail: [2, 3, 4]] + seen = "#" + assert_equal( + "#>>>", + list.inspect + ) + + # named class + Object.const_set(:DoubleLinkList, klass) + list = DoubleLinkList[value: 1, tail: [2, 3, 4]] + seen = "#" + assert_equal( + "#>>>", + list.inspect + ) + end ensure Object.instance_eval { remove_const(:DoubleLinkList) } rescue nil end @@ -362,7 +364,9 @@ class InheritsClassMethod < AbstractWithClassMethod.define(:foo) end def test_subclass_class_method - assert_equal :ok, InheritsClassMethod.inherited_class_method + pend_if_jruby do + assert_equal :ok, InheritsClassMethod.inherited_class_method + end end class AbstractWithOverride < Data From eac56883c822b2d71e2fd8ddc4956a66e352b5a9 Mon Sep 17 00:00:00 2001 From: nick evans Date: Wed, 7 May 2025 12:25:20 -0400 Subject: [PATCH 3/6] =?UTF-8?q?=E2=9C=85=F0=9F=9A=A7=20Mark=202=20FetchDat?= =?UTF-8?q?a=20tests=20as=20pending=20for=20JRuby?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/net/imap/test_fetch_data.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/net/imap/test_fetch_data.rb b/test/net/imap/test_fetch_data.rb index 37c074bbf..adb0dea0d 100644 --- a/test/net/imap/test_fetch_data.rb +++ b/test/net/imap/test_fetch_data.rb @@ -25,14 +25,14 @@ def fetch_data_class end test "#seqno does not exist" do - data = Net::IMAP::UIDFetchData.new(22222) + data = pend_if_jruby { Net::IMAP::UIDFetchData.new(22222) } or next assert_raise NoMethodError do data.seqno end end test "#uid replaces #seqno" do - data = Net::IMAP::UIDFetchData.new(22222) + data = pend_if_jruby { Net::IMAP::UIDFetchData.new(22222) } or next assert_equal 22222, data.uid end From cf8b1e7faa5c5a358b34bc993a99528ec331ba1d Mon Sep 17 00:00:00 2001 From: nick evans Date: Wed, 7 May 2025 16:38:05 -0400 Subject: [PATCH 4/6] =?UTF-8?q?=E2=9C=85=F0=9F=9A=A7=20Omit=2015=20SSL=20c?= =?UTF-8?q?onnection=20tests=20for=20JRuby?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/net/imap/test_imap.rb | 8 ++++++++ test/net/imap/test_imap_capabilities.rb | 3 +++ test/net/imap/test_imap_deprecated_client_options.rb | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/test/net/imap/test_imap.rb b/test/net/imap/test_imap.rb index 46047a294..95375b18b 100644 --- a/test/net/imap/test_imap.rb +++ b/test/net/imap/test_imap.rb @@ -13,6 +13,7 @@ class IMAPTest < Net::IMAP::TestCase if defined?(OpenSSL::SSL::SSLError) def test_imaps_unknown_ca + omit_if_jruby "SSL tests don't work yet" assert_raise(OpenSSL::SSL::SSLError) do imaps_test do |port| begin @@ -27,6 +28,7 @@ def test_imaps_unknown_ca end def test_imaps_with_ca_file + omit_if_jruby "SSL tests don't work yet" # Assert verified *after* the imaps_test and assert_nothing_raised blocks. # Otherwise, failures can't logout and need to wait for the timeout. verified, imap = :unknown, nil @@ -54,6 +56,7 @@ def test_imaps_with_ca_file end def test_imaps_verify_none + omit_if_jruby "SSL tests don't work yet" # Assert verified *after* the imaps_test and assert_nothing_raised blocks. # Otherwise, failures can't logout and need to wait for the timeout. verified, imap = :unknown, nil @@ -81,6 +84,7 @@ def test_imaps_verify_none end def test_imaps_post_connection_check + omit_if_jruby "SSL tests don't work yet" assert_raise(OpenSSL::SSL::SSLError) do imaps_test do |port| # server_addr is different from the hostname in the certificate, @@ -95,6 +99,7 @@ def test_imaps_post_connection_check if defined?(OpenSSL::SSL) def test_starttls_unknown_ca + omit_if_jruby "SSL tests don't work yet" omit "This test is not working with Windows" if RUBY_PLATFORM =~ /mswin|mingw/ imap = nil @@ -115,6 +120,7 @@ def test_starttls_unknown_ca end def test_starttls + omit_if_jruby "SSL tests don't work yet" initial_verified, initial_ctx, initial_params = :unknown, :unknown, :unknown imap = nil starttls_test do |port| @@ -139,6 +145,7 @@ def test_starttls end def test_starttls_stripping + omit_if_jruby "SSL tests don't work yet" imap = nil starttls_stripping_test do |port| imap = Net::IMAP.new("localhost", :port => port) @@ -497,6 +504,7 @@ def test_connection_closed_during_idle end def test_connection_closed_without_greeting + omit_if_jruby "???" server = create_tcp_server port = server.addr[1] h = { diff --git a/test/net/imap/test_imap_capabilities.rb b/test/net/imap/test_imap_capabilities.rb index c2274798c..9d605d57c 100644 --- a/test/net/imap/test_imap_capabilities.rb +++ b/test/net/imap/test_imap_capabilities.rb @@ -124,6 +124,7 @@ class IMAPCapabilitiesTest < Net::IMAP::TestCase if defined?(OpenSSL::SSL::SSLError) test "#capabilities caches greeting capabilities (implicit TLS)" do + omit_if_jruby with_fake_server(preauth: false, implicit_tls: true) do |server, imap| assert imap.capabilities_cached? assert_equal %w[IMAP4REV1 AUTH=PLAIN], imap.capabilities @@ -136,6 +137,7 @@ class IMAPCapabilitiesTest < Net::IMAP::TestCase test "#capabilities cache is cleared after #starttls" do with_fake_server(preauth: false, cleartext_auth: false) do |server, imap| + omit_if_jruby assert imap.capabilities_cached? assert imap.capable? :IMAP4rev1 refute imap.auth_capable? "plain" @@ -189,6 +191,7 @@ class IMAPCapabilitiesTest < Net::IMAP::TestCase # TODO: should we warn about this? test "#capabilities cache IGNORES tagged OK response to STARTTLS" do + omit_if_jruby with_fake_server(preauth: false) do |server, imap| server.on "STARTTLS" do |cmd| cmd.done_ok code: "[CAPABILITY IMAP4rev1 AUTH=PLAIN fnord]" diff --git a/test/net/imap/test_imap_deprecated_client_options.rb b/test/net/imap/test_imap_deprecated_client_options.rb index 9ff9ad23e..b02b49bdc 100644 --- a/test/net/imap/test_imap_deprecated_client_options.rb +++ b/test/net/imap/test_imap_deprecated_client_options.rb @@ -42,6 +42,7 @@ class InitializeTests < IMAPDeprecatedClientOptionsTest end test "Convert deprecated usessl (= true) and certs, with warning" do + omit_if_jruby "SSL tests don't work yet" run_fake_server_in_thread(implicit_tls: true) do |server| certs = server.config.tls[:ca_file] assert_deprecated_warning(/Call Net::IMAP\.new with keyword/i) do @@ -58,6 +59,7 @@ class InitializeTests < IMAPDeprecatedClientOptionsTest end test "Convert deprecated usessl (= true) and verify (= false), with warning" do + omit_if_jruby "SSL tests don't work yet" run_fake_server_in_thread(implicit_tls: true) do |server| assert_deprecated_warning(/Call Net::IMAP\.new with keyword/i) do with_client("localhost", server.port, true, nil, false) do |client| @@ -89,6 +91,7 @@ class InitializeTests < IMAPDeprecatedClientOptionsTest class StartTLSTests < IMAPDeprecatedClientOptionsTest test "Convert obsolete options hash to keywords" do + omit_if_jruby "SSL tests don't work yet" with_fake_server(preauth: false) do |server, imap| imap.starttls(ca_file: server.config.tls[:ca_file], min_version: :TLS1_2) assert_equal( @@ -101,6 +104,7 @@ class StartTLSTests < IMAPDeprecatedClientOptionsTest end test "Convert deprecated certs, verify with warning" do + omit_if_jruby "SSL tests don't work yet" with_fake_server(preauth: false) do |server, imap| assert_deprecated_warning(/Call Net::IMAP#starttls with keyword/i) do imap.starttls(server.config.tls[:ca_file], false) From d1c671a852716b0cb60cef655575efd1405ffdc3 Mon Sep 17 00:00:00 2001 From: nick evans Date: Fri, 3 Oct 2025 18:25:08 -0400 Subject: [PATCH 5/6] =?UTF-8?q?=E2=9C=85=F0=9F=9A=A7=20Mark=201=20Vanished?= =?UTF-8?q?Data=20test=20as=20pending=20for=20JRuby?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/net/imap/test_vanished_data.rb | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/net/imap/test_vanished_data.rb b/test/net/imap/test_vanished_data.rb index 72e3f53ee..da53e4164 100644 --- a/test/net/imap/test_vanished_data.rb +++ b/test/net/imap/test_vanished_data.rb @@ -54,11 +54,13 @@ class VanishedDataTest < Net::IMAP::TestCase end test ".[], mixing args raises ArgumentError" do - assert_raise ArgumentError do - VanishedData[1, true, uids: "1", earlier: true] + pend_if_jruby do + assert_raise ArgumentError do + VanishedData[1, true, uids: "1", earlier: true] + end + assert_raise ArgumentError do VanishedData["1234", earlier: true] end + assert_raise ArgumentError do VanishedData[nil, true, uids: "1"] end end - assert_raise ArgumentError do VanishedData["1234", earlier: true] end - assert_raise ArgumentError do VanishedData[nil, true, uids: "1"] end end test ".[], missing args raises ArgumentError" do From ccdbbce5d152c209dd525e7d8fae45fad136b623 Mon Sep 17 00:00:00 2001 From: nick evans Date: Mon, 5 May 2025 15:22:03 -0400 Subject: [PATCH 6/6] =?UTF-8?q?=E2=9C=85=F0=9F=9A=A7=20Run=20CI=20with=20J?= =?UTF-8?q?Ruby,=20too?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using jruby-head to get some bugfixes. --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 61fa67d04..6617a3f65 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,6 +21,7 @@ jobs: os: [ ubuntu-latest, macos-latest, windows-latest ] experimental: [false] include: + - { ruby: jruby-head, os: ubuntu-latest, experimental: true } - { ruby: truffleruby-head, os: ubuntu-latest, experimental: true } runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.experimental }}