@@ -61,27 +61,6 @@ def test_dump
6161 assert_send_type "(ToJson, JsonWrite, Integer) -> JsonWrite" , JSON , :dump , ToJson . new , JsonWrite . new , 100
6262 end
6363
64- def test_dump_default_options
65- assert_send_type "() -> { max_nesting: false, allow_nan: true }" , JSON , :dump_default_options
66- end
67-
68- def test_dump_default_options_eq
69- assert_send_type "(max_nesting: false, allow_nan: true, allow_blank: true) -> { max_nesting: false, allow_nan: true, allow_blank: true }" ,
70- JSON ,
71- :dump_default_options= ,
72- { max_nesting : false , allow_nan : true , allow_blank : true }
73- end
74-
75- def test_fast_generate
76- assert_send_type "(ToJson) -> String" , JSON , :fast_generate , ToJson . new
77- assert_send_type "(ToJson, indent: String) -> String" , JSON , :fast_generate , ToJson . new , { indent : "\t " }
78- end
79-
80- def test_fast_unparse
81- assert_send_type "(ToJson) -> String" , JSON , :fast_unparse , ToJson . new
82- assert_send_type "(ToJson, indent: String) -> String" , JSON , :fast_unparse , ToJson . new , { indent : "\t " }
83- end
84-
8564 def test_generate
8665 assert_send_type "(ToJson) -> String" , JSON , :generate , ToJson . new
8766 assert_send_type "(ToJson, indent: String) -> String" , JSON , :generate , ToJson . new , { indent : "\t " }
@@ -95,19 +74,13 @@ def test_generator=
9574 assert_send_type "(singleton(JSON::Ext::Generator)) -> void" , JSON , :generator= , JSON ::Ext ::Generator
9675 end
9776
98- def test_iconv
99- assert_send_type "(Encoding, Encoding, String) -> String" , JSON , :iconv , Encoding ::UTF_8 , Encoding ::UTF_16 , "" . encode ( Encoding ::UTF_16 )
100- assert_send_type "(String, String, String) -> String" , JSON , :iconv , 'UTF-8' , 'UTF-16' , "" . encode ( Encoding ::UTF_16 )
101- assert_send_type "(_ToStr, _ToStr, String) -> String" , JSON , :iconv , JsonToStr . new ( 'UTF-8' ) , JsonToStr . new ( 'UTF-16' ) , "" . encode ( Encoding ::UTF_16 )
102- end
103-
10477 def test_load
10578 assert_send_type "(String) -> 42" , JSON , :load , "42"
10679 assert_send_type "(_ToStr) -> 42" , JSON , :load , JsonToStr . new ( "42" )
10780 assert_send_type "(JsonToReadableIO) -> 42" , JSON , :load , JsonToReadableIO . new
10881 assert_send_type "(JsonRead) -> 42" , JSON , :load , JsonRead . new
109- assert_send_type "(String, Proc) -> 42" , JSON , :load , "42" , proc { }
110- assert_send_type "(String, Proc, Hash[untyped, untyped]) -> 42" , JSON , :load , "42" , proc { } , { alllow_nan : true }
82+ assert_send_type "(String, Proc) -> 42" , JSON , :load , "42" , proc { | a | a }
83+ assert_send_type "(String, Proc, Hash[untyped, untyped]) -> 42" , JSON , :load , "42" , proc { | a | a } , { alllow_nan : true }
11184 end
11285
11386 def test_load_file
@@ -130,14 +103,6 @@ def test_load_file!
130103 end
131104 end
132105
133- def test_load_default_options
134- assert_send_type "() -> Hash[untyped, untyped]" , JSON , :load_default_options
135- end
136-
137- def test_load_default_options_eq
138- assert_send_type "(allow_nan: true) -> Hash[untyped, untyped]" , JSON , :load_default_options= , { allow_nan : true }
139- end
140-
141106 def test_parse
142107 assert_send_type "(String) -> 42" , JSON , :parse , "42"
143108 assert_send_type "(_ToStr) -> 42" , JSON , :parse , JsonToStr . new ( "42" )
@@ -163,36 +128,13 @@ def test_pretty_generate
163128 assert_send_type "(ToJson, indent: String) -> String" , JSON , :pretty_generate , ToJson . new , { indent : "\t " }
164129 end
165130
166- def test_pretty_unparse
167- assert_send_type "(ToJson) -> String" , JSON , :pretty_unparse , ToJson . new
168- assert_send_type "(ToJson, indent: String) -> String" , JSON , :pretty_unparse , ToJson . new , { indent : "\t " }
169- end
170-
171- def test_recurse_proc
172- assert_send_type "(Integer) { (Integer) -> void } -> void" , JSON , :recurse_proc , 42 do |_i | end
173- end
174-
175- def test_restore
176- assert_send_type "(String) -> 42" , JSON , :restore , "42"
177- assert_send_type "(_ToStr) -> 42" , JSON , :restore , JsonToStr . new ( "42" )
178- assert_send_type "(JsonToReadableIO) -> 42" , JSON , :restore , JsonToReadableIO . new
179- assert_send_type "(JsonRead) -> 42" , JSON , :restore , JsonRead . new
180- assert_send_type "(String, Proc) -> 42" , JSON , :restore , "42" , proc { }
181- assert_send_type "(String, Proc, Hash[untyped, untyped]) -> 42" , JSON , :restore , "42" , proc { } , { alllow_nan : true }
182- end
183-
184131 def test_state
185132 assert_send_type "() -> singleton(JSON::Ext::Generator::State)" , JSON , :state
186133 end
187134
188135 def test_state_eq
189136 assert_send_type "(singleton(JSON::Ext::Generator::State)) -> singleton(JSON::Ext::Generator::State)" , JSON , :state= , JSON ::Ext ::Generator ::State
190137 end
191-
192- def test_unparse
193- assert_send_type "(ToJson) -> String" , JSON , :unparse , ToJson . new
194- assert_send_type "(ToJson, indent: String) -> String" , JSON , :unparse , ToJson . new , { indent : "\t " }
195- end
196138end
197139
198140class JSONInstanceTest < Test ::Unit ::TestCase
@@ -217,30 +159,11 @@ def test_dump
217159 assert_send_type "(ToJson, JsonWrite, Integer) -> JsonWrite" , MyJSON . new , :dump , ToJson . new , JsonWrite . new , 100
218160 end
219161
220- def test_fast_generate
221- assert_send_type "(ToJson) -> String" , MyJSON . new , :fast_generate , ToJson . new
222- assert_send_type "(ToJson, indent: String) -> String" , MyJSON . new , :fast_generate , ToJson . new , { indent : "\t " }
223- end
224-
225- def test_fast_unparse
226- assert_send_type "(ToJson) -> String" , MyJSON . new , :fast_unparse , ToJson . new
227- assert_send_type "(ToJson, indent: String) -> String" , MyJSON . new , :fast_unparse , ToJson . new , { indent : "\t " }
228- end
229-
230162 def test_generate
231163 assert_send_type "(ToJson) -> String" , MyJSON . new , :generate , ToJson . new
232164 assert_send_type "(ToJson, indent: String) -> String" , MyJSON . new , :generate , ToJson . new , { indent : "\t " }
233165 end
234166
235- def test_load
236- assert_send_type "(String) -> 42" , MyJSON . new , :load , "42"
237- assert_send_type "(_ToStr) -> 42" , MyJSON . new , :load , JsonToStr . new ( "42" )
238- assert_send_type "(JsonToReadableIO) -> 42" , MyJSON . new , :load , JsonToReadableIO . new
239- assert_send_type "(JsonRead) -> 42" , MyJSON . new , :load , JsonRead . new
240- assert_send_type "(String, Proc) -> 42" , MyJSON . new , :load , "42" , proc { }
241- assert_send_type "(String, Proc, Hash[untyped, untyped]) -> 42" , MyJSON . new , :load , "42" , proc { } , { alllow_nan : true }
242- end
243-
244167 def test_parse
245168 assert_send_type "(String) -> 42" , MyJSON . new , :parse , "42"
246169 assert_send_type "(_ToStr) -> 42" , MyJSON . new , :parse , JsonToStr . new ( "42" )
@@ -258,29 +181,6 @@ def test_pretty_generate
258181 assert_send_type "(ToJson, indent: String) -> String" , MyJSON . new , :pretty_generate , ToJson . new , { indent : "\t " }
259182 end
260183
261- def test_pretty_unparse
262- assert_send_type "(ToJson) -> String" , MyJSON . new , :pretty_unparse , ToJson . new
263- assert_send_type "(ToJson, indent: String) -> String" , MyJSON . new , :pretty_unparse , ToJson . new , { indent : "\t " }
264- end
265-
266- def test_recurse_proc
267- assert_send_type "(Integer) { (Integer) -> void } -> void" , MyJSON . new , :recurse_proc , 42 do |_i | end
268- end
269-
270- def test_restore
271- assert_send_type "(String) -> 42" , MyJSON . new , :restore , "42"
272- assert_send_type "(_ToStr) -> 42" , MyJSON . new , :restore , JsonToStr . new ( "42" )
273- assert_send_type "(JsonToReadableIO) -> 42" , MyJSON . new , :restore , JsonToReadableIO . new
274- assert_send_type "(JsonRead) -> 42" , MyJSON . new , :restore , JsonRead . new
275- assert_send_type "(String, Proc) -> 42" , MyJSON . new , :restore , "42" , proc { }
276- assert_send_type "(String, Proc, Hash[untyped, untyped]) -> 42" , MyJSON . new , :restore , "42" , proc { } , { alllow_nan : true }
277- end
278-
279- def test_unparse
280- assert_send_type "(ToJson) -> String" , MyJSON . new , :unparse , ToJson . new
281- assert_send_type "(ToJson, indent: String) -> String" , MyJSON . new , :unparse , ToJson . new , { indent : "\t " }
282- end
283-
284184 def test_to_json_with_object
285185 assert_send_type "() -> String" , Object . new , :to_json
286186 assert_send_type "(JSON::State) -> String" , Object . new , :to_json , JSON ::State . new
0 commit comments