@@ -183,7 +183,9 @@ def test_states
183183 assert_equal ( '{"1":2}' , json )
184184 s = JSON . state . new
185185 assert s . check_circular?
186- assert s [ :check_circular? ]
186+ assert_deprecated_warning ( /JSON::State/ ) do
187+ assert s [ :check_circular? ]
188+ end
187189 h = { 1 => 2 }
188190 h [ 3 ] = h
189191 assert_raise ( JSON ::NestingError ) { generate ( h ) }
@@ -193,7 +195,9 @@ def test_states
193195 a << a
194196 assert_raise ( JSON ::NestingError ) { generate ( a , s ) }
195197 assert s . check_circular?
196- assert s [ :check_circular? ]
198+ assert_deprecated_warning ( /JSON::State/ ) do
199+ assert s [ :check_circular? ]
200+ end
197201 end
198202
199203 def test_falsy_state
@@ -375,28 +379,32 @@ def to_s
375379 end
376380
377381 def test_hash_likeness_set_symbol
378- state = JSON . state . new
379- assert_equal nil , state [ :foo ]
380- assert_equal nil . class , state [ :foo ] . class
381- assert_equal nil , state [ 'foo' ]
382- state [ :foo ] = :bar
383- assert_equal :bar , state [ :foo ]
384- assert_equal :bar , state [ 'foo' ]
385- state_hash = state . to_hash
386- assert_kind_of Hash , state_hash
387- assert_equal :bar , state_hash [ :foo ]
382+ assert_deprecated_warning ( /JSON::State/ ) do
383+ state = JSON . state . new
384+ assert_equal nil , state [ :foo ]
385+ assert_equal nil . class , state [ :foo ] . class
386+ assert_equal nil , state [ 'foo' ]
387+ state [ :foo ] = :bar
388+ assert_equal :bar , state [ :foo ]
389+ assert_equal :bar , state [ 'foo' ]
390+ state_hash = state . to_hash
391+ assert_kind_of Hash , state_hash
392+ assert_equal :bar , state_hash [ :foo ]
393+ end
388394 end
389395
390396 def test_hash_likeness_set_string
391- state = JSON . state . new
392- assert_equal nil , state [ :foo ]
393- assert_equal nil , state [ 'foo' ]
394- state [ 'foo' ] = :bar
395- assert_equal :bar , state [ :foo ]
396- assert_equal :bar , state [ 'foo' ]
397- state_hash = state . to_hash
398- assert_kind_of Hash , state_hash
399- assert_equal :bar , state_hash [ :foo ]
397+ assert_deprecated_warning ( /JSON::State/ ) do
398+ state = JSON . state . new
399+ assert_equal nil , state [ :foo ]
400+ assert_equal nil , state [ 'foo' ]
401+ state [ 'foo' ] = :bar
402+ assert_equal :bar , state [ :foo ]
403+ assert_equal :bar , state [ 'foo' ]
404+ state_hash = state . to_hash
405+ assert_kind_of Hash , state_hash
406+ assert_equal :bar , state_hash [ :foo ]
407+ end
400408 end
401409
402410 def test_json_state_to_h_roundtrip
0 commit comments