@@ -7,6 +7,18 @@ class URISingletonTest < Test::Unit::TestCase
77 library "uri"
88 testing "singleton(::URI)"
99
10+ def test_decode_uri_component
11+ assert_send_type (
12+ "(String) -> String" ,
13+ URI , :decode_uri_component , "Hello%20World%20%E6%97%A5%E6%9C%AC%E8%AA%9E"
14+ )
15+
16+ assert_send_type (
17+ "(String, Encoding) -> String" ,
18+ URI , :decode_uri_component , "Hello%20World%20%E6%97%A5%E6%9C%AC%E8%AA%9E" , Encoding ::UTF_8
19+ )
20+ end
21+
1022 def test_decode_www_form
1123 assert_send_type "(String) -> Array[[String, String]]" ,
1224 URI , :decode_www_form , "a=1&a=2&b=3"
@@ -45,6 +57,17 @@ def test_decode_www_form_component
4557 URI , :decode_www_form_component , "%A1" , "sjis"
4658 end
4759
60+ def test_encode_uri_component
61+ assert_send_type (
62+ "(String) -> String" ,
63+ URI , :encode_uri_component , "Hello World 日本語"
64+ )
65+ assert_send_type (
66+ "(String, Encoding) -> String" ,
67+ URI , :encode_uri_component , "Hello World 日本語" , Encoding ::UTF_8
68+ )
69+ end
70+
4871 def test_encode_www_form
4972 assert_send_type "(Array[[String, String | Numeric]]) -> String" ,
5073 URI , :encode_www_form , [ [ "a" , "1" ] , [ "a" , 2 ] , [ "b" , "3" ] ]
0 commit comments