Skip to content

Commit 68bc2f8

Browse files
committed
Skip some tests for CGI removal
Related to ruby/ruby#13275
1 parent a43e90c commit 68bc2f8

File tree

1 file changed

+82
-77
lines changed

1 file changed

+82
-77
lines changed

test/stdlib/CGI_test.rb

Lines changed: 82 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,6 @@ class CGISingletonTest < Test::Unit::TestCase
77
library "cgi"
88
testing "singleton(::CGI)"
99

10-
def test_new
11-
ARGV.replace(%w(abc=001 def=002))
12-
assert_send_type "() -> void",
13-
CGI, :new
14-
assert_send_type "(?::String options) -> void",
15-
CGI, :new, 'html3'
16-
assert_send_type "(?::String options) ?{ (::String name, ::String value) -> void } -> void",
17-
CGI, :new, 'html3' do |name, value| name + value end
18-
assert_send_type "(::Hash[::Symbol, untyped] options_hash) -> void",
19-
CGI, :new, { tag_maker: 'html5', max_multipart_length: 2048 }
20-
assert_send_type "(::Hash[::Symbol, untyped] options_hash) ?{ (::String name, ::String value) -> void } -> void",
21-
CGI, :new, { tag_maker: 'html5', max_multipart_length: 2048 } do |name, value| name + value end
22-
end
23-
24-
def test_accept_charset
25-
assert_send_type "() -> ::encoding",
26-
CGI, :accept_charset
27-
end
28-
29-
def test_accept_charset=
30-
assert_send_type "(::String accept_charset) -> ::String",
31-
CGI, :accept_charset=, 'utf-8'
32-
assert_send_type "(::Encoding accept_charset) -> ::Encoding",
33-
CGI, :accept_charset=, Encoding::UTF_8
34-
end
35-
36-
def test_parse
37-
assert_send_type "(::String query) -> ::Hash[::String, String | Array[String]]",
38-
CGI, :parse, 'a=hoge&b=1&c[]=test1&c[]=test2'
39-
end
40-
4110
def test_escapeURIComponent
4211
assert_send_type(
4312
"(String) -> String",
@@ -59,6 +28,40 @@ def test_unescapeURIComponent
5928
CGI, :unescapeURIComponent, ToStr.new("hogehoge")
6029
)
6130
end
31+
32+
unless RUBY_VERSION >= "3.5"
33+
def test_new
34+
ARGV.replace(%w(abc=001 def=002))
35+
assert_send_type "() -> void",
36+
CGI, :new
37+
38+
assert_send_type "(?::String options) -> void",
39+
CGI, :new, 'html3'
40+
assert_send_type "(?::String options) ?{ (::String name, ::String value) -> void } -> void",
41+
CGI, :new, 'html3' do |name, value| name + value end
42+
assert_send_type "(::Hash[::Symbol, untyped] options_hash) -> void",
43+
CGI, :new, { tag_maker: 'html5', max_multipart_length: 2048 }
44+
assert_send_type "(::Hash[::Symbol, untyped] options_hash) ?{ (::String name, ::String value) -> void } -> void",
45+
CGI, :new, { tag_maker: 'html5', max_multipart_length: 2048 } do |name, value| name + value end
46+
end
47+
48+
def test_accept_charset
49+
assert_send_type "() -> ::encoding",
50+
CGI, :accept_charset
51+
end
52+
53+
def test_accept_charset=
54+
assert_send_type "(::String accept_charset) -> ::String",
55+
CGI, :accept_charset=, 'utf-8'
56+
assert_send_type "(::Encoding accept_charset) -> ::Encoding",
57+
CGI, :accept_charset=, Encoding::UTF_8
58+
end
59+
60+
def test_parse
61+
assert_send_type "(::String query) -> ::Hash[::String, String | Array[String]]",
62+
CGI, :parse, 'a=hoge&b=1&c[]=test1&c[]=test2'
63+
end
64+
end
6265
end
6366

6467
class CGITest < Test::Unit::TestCase
@@ -76,51 +79,53 @@ def test_print
7679
CGI.new, :print, ''
7780
end
7881

79-
def test_http_header
80-
assert_send_type "() -> ::String",
81-
CGI.new, :http_header
82-
assert_send_type "(::String options) -> ::String",
83-
CGI.new, :http_header, 'text/csv'
84-
assert_send_type "(::Hash[::String, untyped] header_hash) -> ::String",
85-
CGI.new, :http_header, { 'type' => 'text/csv', 'nph' => false, 'length' => 1024 }
86-
assert_send_type "(::Hash[::Symbol, untyped] header_hash) -> ::String",
87-
CGI.new, :http_header, { type: 'text/csv', nph: false, length: 1024 }
88-
end
89-
90-
def test_header
91-
assert_send_type "() -> ::String",
92-
CGI.new, :header
93-
assert_send_type "(::String options) -> ::String",
94-
CGI.new, :header, 'text/csv'
95-
assert_send_type "(::Hash[::String, untyped] header_hash) -> ::String",
96-
CGI.new, :header, { 'type' => 'text/csv', 'nph' => false, 'length' => 1024 }
97-
assert_send_type "(::Hash[::Symbol, untyped] header_hash) -> ::String",
98-
CGI.new, :header, { type: 'text/csv', nph: false, length: 1024 }
99-
end
100-
101-
def test_nph?
102-
assert_send_type "() -> ::boolish",
103-
CGI.new, :nph?
104-
end
105-
106-
def test_out
107-
assert_send_type "() { () -> void } -> void",
108-
CGI.new, :out do '' end
109-
assert_send_type "(::String content_type_string) { () -> String } -> void",
110-
CGI.new, :out, 'text/csv' do '' end
111-
assert_send_type "(::Hash[::String, untyped] header_hash) { () -> String } -> void",
112-
CGI.new, :out, { 'type' => 'text/csv', 'nph' => false, 'length' => 1024 } do '' end
113-
assert_send_type "(::Hash[::String | ::Symbol, untyped] header_hash) { () -> String } -> void",
114-
CGI.new, :out, { type: 'text/csv' } do '' end
115-
end
116-
117-
def test_stdinput
118-
assert_send_type "() -> ::IO",
119-
CGI.new, :stdinput
120-
end
121-
122-
def test_stdoutput
123-
assert_send_type "() -> ::IO",
124-
CGI.new, :stdoutput
82+
unless RUBY_VERSION >= "3.5"
83+
def test_http_header
84+
assert_send_type "() -> ::String",
85+
CGI.new, :http_header
86+
assert_send_type "(::String options) -> ::String",
87+
CGI.new, :http_header, 'text/csv'
88+
assert_send_type "(::Hash[::String, untyped] header_hash) -> ::String",
89+
CGI.new, :http_header, { 'type' => 'text/csv', 'nph' => false, 'length' => 1024 }
90+
assert_send_type "(::Hash[::Symbol, untyped] header_hash) -> ::String",
91+
CGI.new, :http_header, { type: 'text/csv', nph: false, length: 1024 }
92+
end
93+
94+
def test_header
95+
assert_send_type "() -> ::String",
96+
CGI.new, :header
97+
assert_send_type "(::String options) -> ::String",
98+
CGI.new, :header, 'text/csv'
99+
assert_send_type "(::Hash[::String, untyped] header_hash) -> ::String",
100+
CGI.new, :header, { 'type' => 'text/csv', 'nph' => false, 'length' => 1024 }
101+
assert_send_type "(::Hash[::Symbol, untyped] header_hash) -> ::String",
102+
CGI.new, :header, { type: 'text/csv', nph: false, length: 1024 }
103+
end
104+
105+
def test_nph?
106+
assert_send_type "() -> ::boolish",
107+
CGI.new, :nph?
108+
end
109+
110+
def test_out
111+
assert_send_type "() { () -> void } -> void",
112+
CGI.new, :out do '' end
113+
assert_send_type "(::String content_type_string) { () -> String } -> void",
114+
CGI.new, :out, 'text/csv' do '' end
115+
assert_send_type "(::Hash[::String, untyped] header_hash) { () -> String } -> void",
116+
CGI.new, :out, { 'type' => 'text/csv', 'nph' => false, 'length' => 1024 } do '' end
117+
assert_send_type "(::Hash[::String | ::Symbol, untyped] header_hash) { () -> String } -> void",
118+
CGI.new, :out, { type: 'text/csv' } do '' end
119+
end
120+
121+
def test_stdinput
122+
assert_send_type "() -> ::IO",
123+
CGI.new, :stdinput
124+
end
125+
126+
def test_stdoutput
127+
assert_send_type "() -> ::IO",
128+
CGI.new, :stdoutput
129+
end
125130
end
126131
end

0 commit comments

Comments
 (0)