diff options
author | kvokka <kvokka@yahoo.com> | 2021-05-29 11:29:39 +0100 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-07-27 16:54:26 +0900 |
commit | a288c21a5d46418e75c0f03eb12ff0782e51568d (patch) | |
tree | e45873ce85b2ff7c85dadec5a137bcd96f1d88f9 /test/uri/test_common.rb | |
parent | 82191da2a28c8da0f1049ca6d814c9da992c39a1 (diff) | |
download | ruby-a288c21a5d46418e75c0f03eb12ff0782e51568d.tar.gz |
[ruby/uri] Fix to support Ruby 3.0 Ractor
https://github.com/ruby/uri/commit/1faa4fdc16
Diffstat (limited to 'test/uri/test_common.rb')
-rw-r--r-- | test/uri/test_common.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/uri/test_common.rb b/test/uri/test_common.rb index 1afa35f93d..311adc0049 100644 --- a/test/uri/test_common.rb +++ b/test/uri/test_common.rb @@ -33,6 +33,25 @@ class TestCommon < Test::Unit::TestCase end end + def test_ractor + return unless defined?(Ractor) + r = Ractor.new { URI.parse("https://ruby-lang.org/").inspect } + assert_equal(URI.parse("https://ruby-lang.org/").inspect, r.take) + end + + def test_register_scheme + assert_equal(["FILE", "FTP", "HTTP", "HTTPS", "LDAP", "LDAPS", "MAILTO", "WS"].sort, URI.scheme_list.keys.sort) + + begin + URI::Generic.const_set :FOOBAR, Class.new(URI::Generic) + URI.refresh_scheme_list + assert_equal(["FILE", "FTP", "HTTP", "HTTPS", "LDAP", "LDAPS", "MAILTO", "WS", "FOOBAR"].sort, URI.scheme_list.keys.sort) + ensure + URI::Generic.send(:remove_const, :FOOBAR) + URI.refresh_scheme_list + end + end + def test_regexp EnvUtil.suppress_warning do assert_instance_of Regexp, URI.regexp |