@@ -7,6 +7,18 @@ class URISingletonTest < Test::Unit::TestCase
7
7
library "uri"
8
8
testing "singleton(::URI)"
9
9
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
+
10
22
def test_decode_www_form
11
23
assert_send_type "(String) -> Array[[String, String]]" ,
12
24
URI , :decode_www_form , "a=1&a=2&b=3"
@@ -45,6 +57,17 @@ def test_decode_www_form_component
45
57
URI , :decode_www_form_component , "%A1" , "sjis"
46
58
end
47
59
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
+
48
71
def test_encode_www_form
49
72
assert_send_type "(Array[[String, String | Numeric]]) -> String" ,
50
73
URI , :encode_www_form , [ [ "a" , "1" ] , [ "a" , 2 ] , [ "b" , "3" ] ]
0 commit comments