@@ -347,7 +347,7 @@ def test_parse_duplicate_key
347347 assert_equal expected_sym , parse ( '{"a": 1, "a": 2}' , symbolize_names : true )
348348 end
349349
350- if RUBY_ENGINE == 'RUBY_ENGINE '
350+ if RUBY_ENGINE == 'ruby '
351351 assert_deprecated_warning ( /#{ File . basename ( __FILE__ ) } \: #{ __LINE__ + 1 } / ) do
352352 assert_equal expected , parse ( '{"a": 1, "a": 2}' )
353353 end
@@ -397,10 +397,8 @@ def test_freeze
397397 assert_predicate parse ( '[]' , :freeze => true ) , :frozen?
398398 assert_predicate parse ( '"foo"' , :freeze => true ) , :frozen?
399399
400- if string_deduplication_available?
401- assert_same ( -'foo' , parse ( '"foo"' , :freeze => true ) )
402- assert_same ( -'foo' , parse ( '{"foo": 1}' , :freeze => true ) . keys . first )
403- end
400+ assert_same ( -'foo' , parse ( '"foo"' , :freeze => true ) )
401+ assert_same ( -'foo' , parse ( '{"foo": 1}' , :freeze => true ) . keys . first )
404402 end
405403
406404 def test_parse_comments
@@ -637,6 +635,7 @@ def test_parse_array_custom_array_derived_class
637635 def test_parse_array_custom_non_array_derived_class
638636 res = parse ( '[1,2]' , :array_class => SubArrayWrapper )
639637 assert_equal ( [ 1 , 2 ] , res . data )
638+ assert_equal ( 1 , res [ 0 ] )
640639 assert_equal ( SubArrayWrapper , res . class )
641640 assert res . shifted?
642641 end
@@ -698,6 +697,7 @@ def item_set?
698697 def test_parse_object_custom_non_hash_derived_class
699698 res = parse ( '{"foo":"bar"}' , :object_class => SubOpenStruct )
700699 assert_equal "bar" , res . foo
700+ assert_equal "bar" , res [ :foo ]
701701 assert_equal ( SubOpenStruct , res . class )
702702 assert res . item_set?
703703 end
@@ -794,16 +794,6 @@ def test_parse_leading_slash
794794
795795 private
796796
797- def string_deduplication_available?
798- r1 = rand . to_s
799- r2 = r1 . dup
800- begin
801- ( -r1 ) . equal? ( -r2 )
802- rescue NoMethodError
803- false # No String#-@
804- end
805- end
806-
807797 def assert_equal_float ( expected , actual , delta = 1e-2 )
808798 Array === expected and expected = expected . first
809799 Array === actual and actual = actual . first
0 commit comments